Submission #510086

#TimeUsernameProblemLanguageResultExecution timeMemory
510086M_sawas_Nizin (COCI16_nizin)C++17
0 / 100
130 ms7864 KiB
#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,l=1,r=n; for(int i=1;i<=x&&r>l;i++){ if(a[i]==a[n-i+1]){ l++,r--; } else if(a[i]!=a[(n-i)+1]){ if(a[i]+a[i+1]==a[n-i+1]){ ans++,l+=2,r--; } else if(a[(n-i)+1]+a[n-i]==a[i]){ ans++,l++,r-=2; } else if(a[i]+a[i+1]==a[(n-i)+1]+a[n-i]){ ans+=2,l+=2,r-=2; } } } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...