Submission #510086

# Submission time Handle Problem Language Result Execution time Memory
510086 2022-01-14T16:59:18 Z M_sawas_ Nizin (COCI16_nizin) C++17
0 / 100
130 ms 7864 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,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 time Memory Grader output
1 Correct 0 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 Incorrect 0 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 0 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 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 2880 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 6212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 7864 KB Output isn't correct
2 Halted 0 ms 0 KB -