# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
613617 |
2022-07-30T08:04:25 Z |
andrei_boaca |
Cake (CEOI14_cake) |
C++14 |
|
2000 ms |
5204 KB |
#include <bits/stdc++.h>
using namespace std;
int n,q,a,d[300005];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n>>a;
for(int i=1;i<=n;i++)
cin>>d[i];
d[0]=d[n+1]=1e9;
cin>>q;
while(q--)
{
char c;
cin>>c;
if(c=='F')
{
int poz;
cin>>poz;
if(poz==a)
{
cout<<0<<'\n';
continue;
}
int st=a-1;
int dr=a+1;
int cnt=1;
while(true)
{
cnt++;
if(d[st]<d[dr])
{
if(st==poz)
{
cout<<cnt-1<<'\n';
break;
}
st--;
}
else
{
if(dr==poz)
{
cout<<cnt-1<<'\n';
break;
}
dr++;
}
}
}
else
{
int poz,val;
cin>>poz>>val;
val=n-val+1;
int old=d[poz];
for(int i=1;i<=n;i++)
{
if(i==poz)
d[i]=val;
else
if(d[i]<=val&&d[i]>=old)
d[i]--;
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
11 ms |
380 KB |
Output is correct |
5 |
Correct |
176 ms |
500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2077 ms |
1996 KB |
Time limit exceeded |
2 |
Execution timed out |
2048 ms |
2900 KB |
Time limit exceeded |
3 |
Execution timed out |
2081 ms |
2252 KB |
Time limit exceeded |
4 |
Execution timed out |
2074 ms |
3032 KB |
Time limit exceeded |
5 |
Execution timed out |
2021 ms |
1156 KB |
Time limit exceeded |
6 |
Execution timed out |
2091 ms |
1544 KB |
Time limit exceeded |
7 |
Execution timed out |
2063 ms |
1288 KB |
Time limit exceeded |
8 |
Execution timed out |
2062 ms |
1672 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2092 ms |
2196 KB |
Time limit exceeded |
2 |
Execution timed out |
2055 ms |
2512 KB |
Time limit exceeded |
3 |
Correct |
1873 ms |
2664 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Execution timed out |
2059 ms |
3508 KB |
Time limit exceeded |
6 |
Execution timed out |
2083 ms |
3372 KB |
Time limit exceeded |
7 |
Execution timed out |
2068 ms |
3760 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
325 ms |
780 KB |
Output is correct |
2 |
Correct |
447 ms |
828 KB |
Output is correct |
3 |
Execution timed out |
2048 ms |
1176 KB |
Time limit exceeded |
4 |
Execution timed out |
2069 ms |
1436 KB |
Time limit exceeded |
5 |
Correct |
576 ms |
1744 KB |
Output is correct |
6 |
Execution timed out |
2091 ms |
1328 KB |
Time limit exceeded |
7 |
Execution timed out |
2054 ms |
1948 KB |
Time limit exceeded |
8 |
Execution timed out |
2084 ms |
1580 KB |
Time limit exceeded |
9 |
Execution timed out |
2032 ms |
3324 KB |
Time limit exceeded |
10 |
Correct |
1962 ms |
5204 KB |
Output is correct |
11 |
Execution timed out |
2048 ms |
1332 KB |
Time limit exceeded |
12 |
Execution timed out |
2066 ms |
2616 KB |
Time limit exceeded |
13 |
Execution timed out |
2073 ms |
3204 KB |
Time limit exceeded |