Submission #867450

# Submission time Handle Problem Language Result Execution time Memory
867450 2023-10-28T12:07:20 Z pizzamoeger Zalmoxis (BOI18_zalmoxis) C++14
10 / 100
101 ms 18516 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main () {
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	int n, k; cin >> n >> k;
	vector<int> S (n);
	for (int i = 0; i < n; i++) cin >> S[i];

	assert(k == 1);

	stack<int> nums;
	int insert = -1;
	for (int i = 0; i < n && insert == -1; i++) {
		int cur = S[i];
		while (!nums.empty()) {
			int top = nums.top();
			//cerr << cur << " " << top << " " << i << "\n";
			if (cur == top) {
				cur++;
				nums.pop();
			} else if (cur > top) {
				insert = i;
				break;
			} else break;
		}
		if (insert != -1) break;
		nums.push(cur);
	}
	if (insert == -1) insert = n-1;
	for (int i = 0; i < n; i++) {
		if (i == insert) cout << nums.top() << " ";
		cout << S[i] << " ";
	}
	cout << "\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 94 ms 12192 KB not a zalsequence
2 Incorrect 92 ms 12296 KB not a zalsequence
3 Incorrect 101 ms 12376 KB not a zalsequence
4 Correct 93 ms 12360 KB Output is correct
5 Correct 92 ms 12244 KB Output is correct
6 Incorrect 93 ms 12372 KB not a zalsequence
# Verdict Execution time Memory Grader output
1 Runtime error 45 ms 18516 KB Execution killed with signal 6
2 Runtime error 47 ms 18512 KB Execution killed with signal 6
3 Runtime error 46 ms 18368 KB Execution killed with signal 6
4 Runtime error 45 ms 18516 KB Execution killed with signal 6
5 Runtime error 51 ms 18388 KB Execution killed with signal 6
6 Runtime error 45 ms 18392 KB Execution killed with signal 6
7 Runtime error 44 ms 18504 KB Execution killed with signal 6
8 Runtime error 45 ms 18508 KB Execution killed with signal 6
9 Runtime error 36 ms 14936 KB Execution killed with signal 6
10 Runtime error 17 ms 5976 KB Execution killed with signal 6
11 Runtime error 24 ms 9556 KB Execution killed with signal 6
12 Runtime error 1 ms 600 KB Execution killed with signal 6
13 Runtime error 1 ms 604 KB Execution killed with signal 6
14 Runtime error 1 ms 604 KB Execution killed with signal 6