Submission #82136

# Submission time Handle Problem Language Result Execution time Memory
82136 2018-10-29T08:42:12 Z heon Nizin (COCI16_nizin) C++11
100 / 100
83 ms 19432 KB
#include<bits/stdc++.h>

using namespace std;

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector <int> v(n);
	for(int i = 0; i < n; i++) cin >> v[i];
	int sol = 0, lo = 0, hi = n-1;
	while(lo < hi){
		if(v[lo] == v[hi]){
			lo++, hi--;
			continue;
		}
		else if(v[lo] < v[hi]){
			v[lo + 1] += v[lo];
			lo++;
		}
		else{
			v[hi - 1] += v[hi];
			hi--;
		}
		sol++;
	}
	cout << sol;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 512 KB Output is correct
3 Correct 2 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 2 ms 652 KB Output is correct
3 Correct 2 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1008 KB Output is correct
2 Correct 2 ms 1016 KB Output is correct
3 Correct 2 ms 1028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1028 KB Output is correct
2 Correct 3 ms 1088 KB Output is correct
3 Correct 2 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1088 KB Output is correct
2 Correct 2 ms 1088 KB Output is correct
3 Correct 2 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1088 KB Output is correct
2 Correct 2 ms 1088 KB Output is correct
3 Correct 2 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1396 KB Output is correct
2 Correct 11 ms 1684 KB Output is correct
3 Correct 10 ms 1904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 3664 KB Output is correct
2 Correct 37 ms 4904 KB Output is correct
3 Correct 42 ms 6176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 8768 KB Output is correct
2 Correct 66 ms 10488 KB Output is correct
3 Correct 83 ms 12816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 15108 KB Output is correct
2 Correct 81 ms 17384 KB Output is correct
3 Correct 82 ms 19432 KB Output is correct