-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path106B.cpp
More file actions
60 lines (56 loc) · 1.33 KB
/
106B.cpp
File metadata and controls
60 lines (56 loc) · 1.33 KB
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
# include <bits/stdc++.h>
using namespace std;
#define fo(i, n) for(i=0;i<n;i++)
struct a{
int speed , ram , hdd , cost ;
};
void solution(){
int n , i ;
cin >> n ;
a b[n] ;
fo(i,n){
int speed , ram , hdd , cost ;
cin >> speed >> ram >> hdd >> cost ;
b[i].speed = speed ;
b[i].ram = ram ;
b[i].hdd = hdd ;
b[i].cost = cost ;
}
// fo(i,n){
// cout << b[i].speed << " " << b[i].ram << " " << b[i].hdd << " " << b[i].cost << endl ;
// }
fo(i,n){
for (int j = 0 ; j < n ; j++)
{
if((j!=i) && (b[i].speed>b[j].speed) && (b[i].ram>b[j].ram)
&& (b[i].hdd>b[j].hdd)){
b[j].speed = 0 ;
b[j].ram = 0 ;
b[j].hdd = 0 ;
b[j].cost = 0 ;
}
}
}
int A = 1001 , B , C = 0 ;
fo(i,n){
if(b[i].cost>0){
B = A ;
A = min(A,b[i].cost);
if(B!=A){
C = i ;
// cout << A << " " << endl ;
// cout << C << " " << endl ;
}
}
}
cout << C + 1 ;
// fo(i,n){
// cout << b[i].speed << " " << b[i].ram << " " << b[i].hdd << " " << b[i].cost << endl ;
// }
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solution();
return 0;
}