-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path102_B.cpp
More file actions
66 lines (61 loc) · 750 Bytes
/
102_B.cpp
File metadata and controls
66 lines (61 loc) · 750 Bytes
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
#include<vector>
#include<iostream>
#include<climits>
using namespace std;
struct laptop
{
int s;
int r;
int h;
int c;
};
int main()
{
int n;
cin>>n;
vector<laptop>a;
for(int i=0;i<n;i++)
{
int s,r,h,c;
cin>>s>>r>>h>>c;
laptop l;
l.s = s;
l.r = r;
l.h = h;
l.c = c;
a.push_back(l);
}
vector<bool>b(n,1);
for(int i=0;i<n;i++)
{
if(b[i])
{
bool good = true;
for(int j=0;j<n;j++)
{
if(a[i].s<a[j].s && a[i].r<a[j].r && a[i].h<a[j].h)
{
good = false;
break;
}
}
if(!good)
b[i] = 0;
}
}
int minm = INT_MAX;
int index = 0;
for(int i=0;i<n;i++)
{
if(b[i])
{
if(a[i].c < minm)
{
minm = a[i].c;
index = i;
}
}
}
cout<<(index+1)<<endl;
return 0;
}