Submission #510117

#TimeUsernameProblemLanguageResultExecution timeMemory
510117M_sawas_Nizin (COCI16_nizin)C++17
0 / 100
1089 ms9596 KiB
#include <bits/stdc++.h> #define ll long long #define endl "\n" using namespace std; ll n,a[1000007],ans,l,r; int main() { cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } l=1,r=n; while(l<r){ if(a[l]==a[r]){ l++,r--; } else if(a[l]!=a[r]){ if(a[l]+a[l+1]==a[r]){ ans++,l+=2,r--; } else if(a[r]+a[r-1]==a[l]){ ans++,l++,r-=2; } else if(a[l]+a[l+1]==a[r]+a[r-1]){ 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...