답안 #647060

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
647060 2022-10-01T13:33:11 Z georgievskiy Zalmoxis (BOI18_zalmoxis) C++17
30 / 100
319 ms 27048 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 = 0; 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;
	}
	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 Correct 276 ms 26592 KB Output is correct
2 Correct 304 ms 26964 KB Output is correct
3 Correct 290 ms 26812 KB Output is correct
4 Correct 288 ms 26784 KB Output is correct
5 Correct 283 ms 26888 KB Output is correct
6 Correct 279 ms 26412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 282 ms 26656 KB Unexpected end of file - int32 expected
2 Incorrect 301 ms 26488 KB Unexpected end of file - int32 expected
3 Incorrect 291 ms 26852 KB Unexpected end of file - int32 expected
4 Incorrect 280 ms 26968 KB Unexpected end of file - int32 expected
5 Incorrect 319 ms 26756 KB Unexpected end of file - int32 expected
6 Incorrect 287 ms 26724 KB Unexpected end of file - int32 expected
7 Incorrect 278 ms 26860 KB Unexpected end of file - int32 expected
8 Incorrect 289 ms 27048 KB Unexpected end of file - int32 expected
9 Incorrect 230 ms 23732 KB Unexpected end of file - int32 expected
10 Incorrect 96 ms 10188 KB Unexpected end of file - int32 expected
11 Incorrect 137 ms 13876 KB Unexpected end of file - int32 expected
12 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
13 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
14 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected