-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1249 - Chocolate Thief.cpp
86 lines (64 loc) · 2.13 KB
/
1249 - Chocolate Thief.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include<bits/stdc++.h>
using namespace std;
/*======================================= Macro Start====================================================*/
#define input freopen("in.txt","r",stdin)
#define output freopen("out.txt","w",stdout)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define count_one(a) __builtin_popcount(a) // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i) __builtin_parity(i) //even parity 0 and odd parity 1
#define blz(a) __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a) __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
/*======================================= Macro End====================================================*/
/*====================================== CONSTANT Start===================================================*/
#define INF (1<<30) //infinity value
#define EPS 1e-9
#define MOD 10007
#define SIZ 1005
/*====================================== CONSTANT End===================================================*/
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
input;
int cn,l,w,h,tc,stdudentNO,vol;
string str,strMAX,strMIN;
set<int> s;
cin>>tc;
for(cn=1;cn<=tc;cn++)
{
int mx=0;
int mn = 2000000;
cin>>stdudentNO;
for(int i=0;i<stdudentNO;i++)
{
cin>>str>>l>>w>>h;
vol = l*w*h;
s.insert(vol);
if(vol>mx)
{
mx=vol;
strMAX = str;
}
if(vol<mn)
{
mn=vol;
strMIN=str;
}
}
int sz = s.size();
if(sz==1)
{
cout<<"Case "<<cn<<": "<<"no thief"<<endl;
}
else
{
cout<<"Case "<<cn<<": "<<strMAX<<" took chocolate from "<<strMIN<<endl;
}
s.clear();
}
return 0;
}