답안 #647052

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
647052 2022-10-01T13:25:41 Z georgievskiy Zalmoxis (BOI18_zalmoxis) C++17
0 / 100
296 ms 28500 KB
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int &x : a) cin >> x;
	vector<pii> t, q;
	for (int i = 0; i < n; i++)
		t.push_back({a[i], i});
	for (int val = 25; val < 30; val++) {
		vector<pii> nt;
		for (int i = 0; i < t.size(); i++) {
			if (t[i].first != val) {
				nt.push_back(t[i]);
				continue;
			}
			if (i + 1 < t.size() && t[i].first == t[i + 1].first) {
				nt.push_back({t[i].first + 1, t[i + 1].second});
				i++;
			} else {
				nt.push_back({t[i].first + 1, t[i].second});
				q.push_back({t[i].second, t[i].first});
			}
		}
		t = nt;
	}
	assert(q.size() == 1);
	a.insert(a.begin() + q[0].first + 1, q[0].second);
	for (int x : a)
		cout << x << " ";
	return 0;
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:15:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   for (int i = 0; i < t.size(); i++) {
      |                   ~~^~~~~~~~~~
zalmoxis.cpp:20:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |    if (i + 1 < t.size() && t[i].first == t[i + 1].first) {
      |        ~~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 251 ms 28368 KB Execution killed with signal 6
2 Runtime error 226 ms 28400 KB Execution killed with signal 6
3 Runtime error 296 ms 28500 KB Execution killed with signal 6
4 Runtime error 243 ms 28400 KB Execution killed with signal 6
5 Runtime error 252 ms 28376 KB Execution killed with signal 6
6 Runtime error 230 ms 28388 KB Execution killed with signal 6
# 결과 실행 시간 메모리 Grader output
1 Runtime error 222 ms 28404 KB Execution killed with signal 6
2 Runtime error 247 ms 28364 KB Execution killed with signal 6
3 Runtime error 247 ms 28348 KB Execution killed with signal 6
4 Runtime error 224 ms 28396 KB Execution killed with signal 6
5 Runtime error 235 ms 28416 KB Execution killed with signal 6
6 Runtime error 250 ms 28392 KB Execution killed with signal 6
7 Runtime error 246 ms 28392 KB Execution killed with signal 6
8 Runtime error 244 ms 28432 KB Execution killed with signal 6
9 Runtime error 189 ms 24496 KB Execution killed with signal 6
10 Runtime error 73 ms 10504 KB Execution killed with signal 6
11 Runtime error 112 ms 14536 KB Execution killed with signal 6
12 Runtime error 1 ms 340 KB Execution killed with signal 6
13 Runtime error 1 ms 428 KB Execution killed with signal 6
14 Runtime error 2 ms 340 KB Execution killed with signal 6