#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++) {
if (v.empty() == false && v.back().first == a[i]) {
int tut = v.back().second;
v.pop_back();
v.push_back({a[i] + 1,tut});
}
else {
v.push_back({a[i],i});
}
}
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:38:5: warning: 'tut' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (tut == i)
^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
246 ms |
14692 KB |
not a zalsequence |
2 |
Incorrect |
153 ms |
14692 KB |
not a zalsequence |
3 |
Incorrect |
192 ms |
14700 KB |
not a zalsequence |
4 |
Incorrect |
163 ms |
14696 KB |
not a zalsequence |
5 |
Incorrect |
161 ms |
14696 KB |
not a zalsequence |
6 |
Incorrect |
159 ms |
14692 KB |
not a zalsequence |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
163 ms |
14716 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
171 ms |
14664 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
168 ms |
14692 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
159 ms |
14696 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
250 ms |
14724 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
173 ms |
14668 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
158 ms |
14692 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
146 ms |
14692 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
125 ms |
10780 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
44 ms |
4588 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
72 ms |
7504 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 |
3 ms |
476 KB |
Unexpected end of file - int32 expected |