# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
510111 |
2022-01-14T17:41:17 Z |
M_sawas_ |
Nizin (COCI16_nizin) |
C++17 |
|
1000 ms |
7904 KB |
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
ll n,a[1000007],ans,x,l,r;
int main()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
x=n/2,r=n;
for(int i=1;i<=x&&r>i;){
if(a[i]==a[r]){
i++,r--;
}
else if(a[i]!=a[r]){
if(a[i]+a[i+1]==a[r]){
ans++,i+=2,r--;
}
else if(a[r]+a[r-1]==a[i]){
ans++,i++,r-=2;
}
else if(a[i]+a[i+1]==a[r]+a[r-1]){
ans+=2,i+=2,r-=2;
}
}
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Execution timed out |
1088 ms |
204 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
844 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
2884 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
6084 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1072 ms |
7904 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |