Submission #133670

# Submission time Handle Problem Language Result Execution time Memory
133670 2019-07-21T08:15:25 Z forelax Nizin (COCI16_nizin) C++14
100 / 100
264 ms 6264 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i = 0 ; i < n ; i ++){
        cin>>v[i];
    }
    int i=0,j=n-1,rez=0;
    while(i<j){
        if(i==j)break;
        if(v[i]==v[j]){
            i++;
            j--;
        }else if(v[i]>v[j]){
            v[j-1]+=v[j];
            j--;
            rez++;
        }else if(v[i]<v[j]){
            v[i+1]+=v[i];
            i++;
            rez++;
        }
    }
    cout<<rez;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 760 KB Output is correct
2 Correct 28 ms 888 KB Output is correct
3 Correct 28 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 93 ms 2348 KB Output is correct
2 Correct 117 ms 2904 KB Output is correct
3 Correct 132 ms 3320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 199 ms 4860 KB Output is correct
2 Correct 211 ms 5240 KB Output is correct
3 Correct 240 ms 5752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 264 ms 6116 KB Output is correct
2 Correct 261 ms 6264 KB Output is correct
3 Correct 261 ms 6264 KB Output is correct