# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
103943 |
2019-04-03T11:31:56 Z |
MrTEK |
Zalmoxis (BOI18_zalmoxis) |
C++14 |
|
179 ms |
7776 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> ii;
const int N = 1e6 + 5;
const int inf = 1e9;
vector <ii> v;
int n,k,a[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> n >> k;
for (int i = 1 ; i <= n ; i++)
cin >> a[i];
for (int i = 1 ; i <= n ; i++) {
int x = a[i],tut = i;
while(v.empty() == false && v.back().first == x) {
tut = v.back().second;
v.pop_back();
x++;
}
v.push_back({x,tut});
}
int mn = inf,tut;
for (auto i : v) {
if (i.first < mn) {
mn = i.first;
tut = i.second;
}
}
for (int i = 1 ; i <= n ; i++) {
if (tut == i)
cout << mn << " ";
cout << a[i] << " ";
}
}
Compilation message
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:37:5: warning: 'tut' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (tut == i)
^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
147 ms |
6360 KB |
Output is correct |
2 |
Correct |
147 ms |
6268 KB |
Output is correct |
3 |
Correct |
153 ms |
6392 KB |
Output is correct |
4 |
Correct |
160 ms |
6364 KB |
Output is correct |
5 |
Correct |
179 ms |
6392 KB |
Output is correct |
6 |
Correct |
146 ms |
6396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
154 ms |
6300 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
140 ms |
6492 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
179 ms |
6648 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
135 ms |
6264 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
163 ms |
6268 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
148 ms |
6364 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
143 ms |
6392 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
145 ms |
6336 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
143 ms |
7776 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
46 ms |
3816 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
76 ms |
6508 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
2 ms |
384 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
2 ms |
384 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
2 ms |
384 KB |
Unexpected end of file - int32 expected |