# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
320392 |
2020-11-08T14:13:01 Z |
ryangohca |
Nizin (COCI16_nizin) |
C++17 |
|
177 ms |
10740 KB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main() {
int n; cin >> n;
deque<int> nums;
for (int i = 0; i < n; i++){
int g; cin >> g;
nums.push_back(g);
}
int ans = 0;
while (nums.size() > 1){
if (nums.front() == nums.back()){
nums.pop_front();
nums.pop_back();
} else if (nums.back() < nums.front()){
int to_add = nums[nums.size() - 1] + nums[nums.size() - 2];
nums.pop_back();
nums.pop_back();
nums.push_back(to_add);
ans++;
} else {
int to_add = nums[0] + nums[1];
nums.pop_front();
nums.pop_front();
nums.push_front(to_add);
ans++;
}
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
360 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
1132 KB |
Output is correct |
2 |
Correct |
18 ms |
1388 KB |
Output is correct |
3 |
Correct |
18 ms |
1388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
64 ms |
3936 KB |
Output is correct |
2 |
Correct |
75 ms |
4708 KB |
Output is correct |
3 |
Correct |
87 ms |
5476 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
135 ms |
8180 KB |
Output is correct |
2 |
Correct |
141 ms |
8548 KB |
Output is correct |
3 |
Correct |
161 ms |
9588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
175 ms |
10484 KB |
Output is correct |
2 |
Correct |
177 ms |
10612 KB |
Output is correct |
3 |
Correct |
177 ms |
10740 KB |
Output is correct |