Submission #510208

# Submission time Handle Problem Language Result Execution time Memory
510208 2022-01-14T19:22:30 Z khaled_whebe Nizin (COCI16_nizin) C++17
80 / 100
248 ms 55800 KB
#include<bits/stdc++.h>
#define endl '\n'
typedef long long ll;
using namespace std;
const int N=555555;
ll n,a[N],pre[N],suf[N],ans;
set <ll> st;
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    for (ll i=0;i<n;i++){
        cin>>a[i];

    }
    pre[0]=a[0];
    st.insert(pre[0]);
    for (ll i=1;i<n;i++){
        pre[i]=pre[i-1]+a[i];
        st.insert(pre[i]);
    }
    suf [n-1]=a[n-1];
    st.insert(suf[n-1]);
    for (ll i=n-2;i>=0;i--)
    {
        suf[i]=suf[i+1]+a[i];
        st.insert(suf[i]);
    }
    ans=st.size()-n;
    cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 8748 KB Output is correct
2 Correct 40 ms 11136 KB Output is correct
3 Correct 38 ms 11372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 149 ms 37892 KB Output is correct
2 Correct 193 ms 47420 KB Output is correct
3 Correct 248 ms 55800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 4556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 4548 KB Output isn't correct
2 Halted 0 ms 0 KB -