# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
271389 |
2020-08-18T05:55:46 Z |
최은수(#5096) |
Archery (IOI09_archery) |
C++17 |
|
2000 ms |
3756 KB |
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,r;
cin>>n>>r;
r=(r-n*2)%n+n*2;
int s;
cin>>s;
vector<int>p(n*2-1);
for(int&t:p)
cin>>t;
int mx=inf,mi=-1;
for(int i=n;i>0;i--)
{
vector<pi>v(n+1);
for(int j=1;j<i;j++)
v[j]=pi(p[j*2-2],p[j*2-1]);
v[i]=pi(s,p[i*2-2]);
for(int j=i;j++<n;)
v[j]=pi(p[j*2-3],p[j*2-2]);
for(int j=0;j<r;j++)
{
for(int k=1;k++<n;)
if(v[k].fi<v[k].se)
swap(v[k].fi,v[k].se);
if(v[1].fi>v[1].se)
swap(v[1].fi,v[1].se);
for(int k=0;k<n;k++)
v[k].se=v[k+1].se;
v[n].se=v[0].se;
}
int id=-1;
for(int j=0;j++<n;)
if(v[j].fi==s||v[j].se==s)
id=j;
if(id<mx)
mx=id,mi=i;
}
cout<<mi<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Execution timed out |
2065 ms |
384 KB |
Time limit exceeded |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Execution timed out |
2028 ms |
384 KB |
Time limit exceeded |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
36 ms |
392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
48 ms |
384 KB |
Output is correct |
3 |
Execution timed out |
2052 ms |
384 KB |
Time limit exceeded |
4 |
Execution timed out |
2072 ms |
768 KB |
Time limit exceeded |
5 |
Execution timed out |
2076 ms |
3192 KB |
Time limit exceeded |
6 |
Correct |
36 ms |
384 KB |
Output is correct |
7 |
Execution timed out |
2050 ms |
384 KB |
Time limit exceeded |
8 |
Execution timed out |
2052 ms |
768 KB |
Time limit exceeded |
9 |
Execution timed out |
2084 ms |
1028 KB |
Time limit exceeded |
10 |
Execution timed out |
2075 ms |
384 KB |
Time limit exceeded |
11 |
Execution timed out |
2066 ms |
896 KB |
Time limit exceeded |
12 |
Execution timed out |
2068 ms |
384 KB |
Time limit exceeded |
13 |
Execution timed out |
2058 ms |
2560 KB |
Time limit exceeded |
14 |
Execution timed out |
2068 ms |
512 KB |
Time limit exceeded |
15 |
Execution timed out |
2069 ms |
1152 KB |
Time limit exceeded |
16 |
Correct |
44 ms |
384 KB |
Output is correct |
17 |
Execution timed out |
2066 ms |
384 KB |
Time limit exceeded |
18 |
Execution timed out |
2070 ms |
384 KB |
Time limit exceeded |
19 |
Execution timed out |
2054 ms |
384 KB |
Time limit exceeded |
20 |
Execution timed out |
2071 ms |
512 KB |
Time limit exceeded |
21 |
Execution timed out |
2069 ms |
896 KB |
Time limit exceeded |
22 |
Execution timed out |
2060 ms |
1024 KB |
Time limit exceeded |
23 |
Execution timed out |
2032 ms |
3456 KB |
Time limit exceeded |
24 |
Correct |
53 ms |
384 KB |
Output is correct |
25 |
Execution timed out |
2005 ms |
384 KB |
Time limit exceeded |
26 |
Execution timed out |
2066 ms |
512 KB |
Time limit exceeded |
27 |
Execution timed out |
2075 ms |
972 KB |
Time limit exceeded |
28 |
Execution timed out |
2033 ms |
2552 KB |
Time limit exceeded |
29 |
Execution timed out |
2069 ms |
512 KB |
Time limit exceeded |
30 |
Execution timed out |
2071 ms |
512 KB |
Time limit exceeded |
31 |
Execution timed out |
2068 ms |
1052 KB |
Time limit exceeded |
32 |
Execution timed out |
2083 ms |
3320 KB |
Time limit exceeded |
33 |
Correct |
46 ms |
384 KB |
Output is correct |
34 |
Correct |
39 ms |
384 KB |
Output is correct |
35 |
Execution timed out |
2082 ms |
384 KB |
Time limit exceeded |
36 |
Execution timed out |
2043 ms |
384 KB |
Time limit exceeded |
37 |
Execution timed out |
2060 ms |
888 KB |
Time limit exceeded |
38 |
Execution timed out |
2093 ms |
1024 KB |
Time limit exceeded |
39 |
Correct |
38 ms |
384 KB |
Output is correct |
40 |
Execution timed out |
2085 ms |
384 KB |
Time limit exceeded |
41 |
Execution timed out |
2073 ms |
384 KB |
Time limit exceeded |
42 |
Execution timed out |
2033 ms |
384 KB |
Time limit exceeded |
43 |
Execution timed out |
2008 ms |
488 KB |
Time limit exceeded |
44 |
Execution timed out |
2060 ms |
640 KB |
Time limit exceeded |
45 |
Execution timed out |
2032 ms |
932 KB |
Time limit exceeded |
46 |
Execution timed out |
2069 ms |
896 KB |
Time limit exceeded |
47 |
Execution timed out |
2037 ms |
3756 KB |
Time limit exceeded |