# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
493897 |
2021-12-13T10:30:07 Z |
Karabasan |
Nizin (COCI16_nizin) |
C++17 |
|
62 ms |
6068 KB |
#include <bits/stdc++.h>
#define ll long long
#define fast1 ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,avx")
#pragma GCC optimize("unroll-loops")
int n;
int dizi[1000005];
void solve()
{
cin>>n;
for(int i=1;i<=n;i++)
cin>>dizi[i];
int i=1;
int j=n;
int cevap=0;
while(i<j)
{
if(dizi[i]!=dizi[j])
{
if(dizi[i]+dizi[i+1]==dizi[j])
{
cevap++;
i+=2;
j--;
}
else if(dizi[j]+dizi[j-1]==dizi[i])
{
cevap++;
i++;
j-=2;
}
else
{
cevap+=2;
dizi[i+1]=dizi[i]+dizi[i+1];
dizi[j-1]=dizi[j]+dizi[j-1];
i++;
j--;
}
}
else
{
i++;
j--;
}
}
cout<<cevap;
}
signed main()
{
fast1
int t=1;
//cin>>t;
while(t--)
{
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
2344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
49 ms |
4772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
62 ms |
6068 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |