#include<bits/stdc++.h>
using namespace std;
const int LIMIT=200000;
int level[(2*LIMIT)+2];
int Objetivos, Rounds, MyArcher;
int solve(int ini){
vector<pair<int,int>> Obj;
int z=1;
///cout<<"-----\n";
for(int i=2;i<=Objetivos*2;i+=2){
if(ini==z){
Obj.push_back(make_pair(level[i],MyArcher));
i--;
}else{
Obj.push_back(make_pair(level[i],level[i+1]));
}
///cout<<Obj.back().first<<' '<<Obj.back().second<<'\n';
z++;
}
int ultimo=0;
int pos=0;
for(int i=1;i<=Rounds;i++){
for(int j=0;j<Objetivos;j++){
if(j==0){
if(Obj[j].first<Obj[j].second){
ultimo=Obj[j].second;
}else{
ultimo=Obj[j].first;
Obj[j].first=Obj[j].second;
}
Obj[j].second=-1;
if(Obj[j].first==MyArcher){
pos=j+1;
}else if(ultimo==MyArcher){
pos=Objetivos;
}
}else{
if(Obj[j].first<Obj[j].second){
Obj[j-1].second=Obj[j].first;
Obj[j].first=Obj[j].second;
}else{
Obj[j-1].second=Obj[j].second;
}
Obj[j].second=-1;
if(Obj[j].first==MyArcher){
pos=j+1;
}else if(Obj[j-1].second==MyArcher){
pos=j;
}
}
}
Obj[Objetivos-1].second=ultimo;
}
return pos;
};
int main(){
ios_base::sync_with_stdio(0);cin.tie();
cin>>Objetivos>>Rounds>>MyArcher;
for(int i=2;i<=Objetivos*2;i++){
cin>>level[i];
}
int gano,mgano=100000;
int res=0;
for(int i=1;i<=Objetivos;i++){
gano=solve(i);
if(mgano>=gano){
mgano=gano;
res=i;
}
}
cout<<res<<'\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
2087 ms |
332 KB |
Time limit exceeded |
3 |
Execution timed out |
2086 ms |
204 KB |
Time limit exceeded |
4 |
Execution timed out |
2076 ms |
332 KB |
Time limit exceeded |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Execution timed out |
2071 ms |
204 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
2085 ms |
204 KB |
Time limit exceeded |
3 |
Execution timed out |
2070 ms |
332 KB |
Time limit exceeded |
4 |
Execution timed out |
2085 ms |
588 KB |
Time limit exceeded |
5 |
Execution timed out |
2033 ms |
4144 KB |
Time limit exceeded |
6 |
Execution timed out |
2073 ms |
204 KB |
Time limit exceeded |
7 |
Execution timed out |
2050 ms |
332 KB |
Time limit exceeded |
8 |
Execution timed out |
2090 ms |
588 KB |
Time limit exceeded |
9 |
Execution timed out |
2080 ms |
844 KB |
Time limit exceeded |
10 |
Execution timed out |
2027 ms |
332 KB |
Time limit exceeded |
11 |
Execution timed out |
2090 ms |
844 KB |
Time limit exceeded |
12 |
Execution timed out |
2079 ms |
332 KB |
Time limit exceeded |
13 |
Execution timed out |
2029 ms |
2444 KB |
Time limit exceeded |
14 |
Execution timed out |
2073 ms |
460 KB |
Time limit exceeded |
15 |
Execution timed out |
2091 ms |
884 KB |
Time limit exceeded |
16 |
Correct |
63 ms |
204 KB |
Output is correct |
17 |
Execution timed out |
2092 ms |
332 KB |
Time limit exceeded |
18 |
Execution timed out |
2054 ms |
332 KB |
Time limit exceeded |
19 |
Execution timed out |
2086 ms |
332 KB |
Time limit exceeded |
20 |
Execution timed out |
2081 ms |
460 KB |
Time limit exceeded |
21 |
Execution timed out |
2080 ms |
844 KB |
Time limit exceeded |
22 |
Execution timed out |
2049 ms |
848 KB |
Time limit exceeded |
23 |
Execution timed out |
2005 ms |
4160 KB |
Time limit exceeded |
24 |
Correct |
39 ms |
204 KB |
Output is correct |
25 |
Execution timed out |
2080 ms |
332 KB |
Time limit exceeded |
26 |
Execution timed out |
2061 ms |
460 KB |
Time limit exceeded |
27 |
Execution timed out |
2080 ms |
844 KB |
Time limit exceeded |
28 |
Execution timed out |
2075 ms |
2472 KB |
Time limit exceeded |
29 |
Execution timed out |
2091 ms |
332 KB |
Time limit exceeded |
30 |
Execution timed out |
2078 ms |
460 KB |
Time limit exceeded |
31 |
Execution timed out |
2060 ms |
844 KB |
Time limit exceeded |
32 |
Execution timed out |
2052 ms |
4208 KB |
Time limit exceeded |
33 |
Correct |
53 ms |
204 KB |
Output is correct |
34 |
Execution timed out |
2091 ms |
204 KB |
Time limit exceeded |
35 |
Execution timed out |
2097 ms |
332 KB |
Time limit exceeded |
36 |
Execution timed out |
2089 ms |
332 KB |
Time limit exceeded |
37 |
Execution timed out |
2078 ms |
828 KB |
Time limit exceeded |
38 |
Execution timed out |
2096 ms |
872 KB |
Time limit exceeded |
39 |
Execution timed out |
2091 ms |
204 KB |
Time limit exceeded |
40 |
Execution timed out |
2088 ms |
332 KB |
Time limit exceeded |
41 |
Execution timed out |
2094 ms |
332 KB |
Time limit exceeded |
42 |
Execution timed out |
2091 ms |
332 KB |
Time limit exceeded |
43 |
Execution timed out |
2091 ms |
460 KB |
Time limit exceeded |
44 |
Execution timed out |
2093 ms |
588 KB |
Time limit exceeded |
45 |
Execution timed out |
2094 ms |
844 KB |
Time limit exceeded |
46 |
Execution timed out |
2099 ms |
844 KB |
Time limit exceeded |
47 |
Execution timed out |
2093 ms |
3940 KB |
Time limit exceeded |