#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,k;
cin >> n >> k;
list <pair<ll,ll>> arr;
vector <ll> ori;
for (int z=0;z<n;z++){
ll temp;
cin >> temp;
arr.push_back(make_pair(temp,z));
ori.push_back(temp);
}
for (auto it = arr.begin();it != arr.end();it++){
auto ita = it;
ita++;
if (it->first == ita->first){
auto p = it;
p--;
arr.insert(it,make_pair(it->first+1,it->second));
arr.erase(it);
arr.erase(ita);
it = p;
}
// for (auto itq = arr.begin();itq != arr.end();itq++){
// cout << itq->first << " ";
// } cout << endl;
}
ll i = 0;
ll q = 0;
arr.push_back(make_pair(LLONG_MAX,0));
for (auto it = arr.begin();it != arr.end();it++){
auto ita = it;
ita++;
if (*ita > *it){
i = it->second;
q = it->first;
break;
}
}
for (int z=0;z<n;z++){
if (z == i) cout << q << " ";
cout << ori[z] << " ";
}
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
264 ms |
57620 KB |
not a zalsequence |
2 |
Incorrect |
361 ms |
57552 KB |
not a zalsequence |
3 |
Incorrect |
262 ms |
57548 KB |
not a zalsequence |
4 |
Incorrect |
265 ms |
57564 KB |
not a zalsequence |
5 |
Incorrect |
261 ms |
57644 KB |
not a zalsequence |
6 |
Incorrect |
286 ms |
57448 KB |
not a zalsequence |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
266 ms |
57456 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
261 ms |
57552 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
259 ms |
57552 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
261 ms |
57580 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
273 ms |
57552 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
362 ms |
57516 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
259 ms |
57424 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
260 ms |
57552 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
208 ms |
46160 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
82 ms |
17628 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
132 ms |
29024 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - int32 expected |