Submission #861850

# Submission time Handle Problem Language Result Execution time Memory
861850 2023-10-17T04:51:49 Z maks007 Zalmoxis (BOI18_zalmoxis) C++14
35 / 100
118 ms 12400 KB
#include "bits/stdc++.h"

using namespace std;

int last;
vector <int> ans, a;
map <int,int> wiped;

void f(int v) {
	if(a.size() == 0) {
		ans.push_back(v);
		return;
	}
	if(v == a.back()) {
		ans.push_back(v);
		a.pop_back();
		return;
	}
	if(a.back() > v) {
		ans.push_back(v);
		return;
	}
	f(v-1);
	f(v-1);
}

signed main () {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, k, cnt = 0;
	cin >> n >> k;
	for(int i = 0; i < n; i ++) {
		int x;
		cin >> x;
		wiped[x] ++;
		a.push_back(x);
	}
	reverse(a.begin(), a.end());
	// int need = (1 << 30) - cnt;
	// cnt = 0;
	// while(need > 1) {
	// 	cnt ++;
	// 	need /= 2;
	// }
	f(30);
	for(auto i : ans) cout << i << " ";
	return 0;
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:30:12: warning: unused variable 'cnt' [-Wunused-variable]
   30 |  int n, k, cnt = 0;
      |            ^~~
# Verdict Execution time Memory Grader output
1 Correct 110 ms 10428 KB Output is correct
2 Correct 114 ms 11560 KB Output is correct
3 Correct 113 ms 10588 KB Output is correct
4 Correct 110 ms 11196 KB Output is correct
5 Correct 109 ms 11452 KB Output is correct
6 Correct 110 ms 10940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 114 ms 10684 KB Unexpected end of file - int32 expected
2 Correct 110 ms 11332 KB Output is correct
3 Incorrect 112 ms 12224 KB Unexpected end of file - int32 expected
4 Incorrect 110 ms 11460 KB Unexpected end of file - int32 expected
5 Incorrect 111 ms 11716 KB Unexpected end of file - int32 expected
6 Incorrect 113 ms 12400 KB Unexpected end of file - int32 expected
7 Incorrect 110 ms 10944 KB Unexpected end of file - int32 expected
8 Incorrect 118 ms 11476 KB Unexpected end of file - int32 expected
9 Incorrect 98 ms 9660 KB Unexpected end of file - int32 expected
10 Incorrect 44 ms 4564 KB Unexpected end of file - int32 expected
11 Incorrect 68 ms 8524 KB Unexpected end of file - int32 expected
12 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
13 Incorrect 1 ms 344 KB Unexpected end of file - int32 expected
14 Incorrect 1 ms 344 KB Unexpected end of file - int32 expected