#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define endl '\n'
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
const int mod = 1e9 + 7;
const int N = 1e6 + 15;
const ll inf = 1e18;
int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int n,k;
cin >> n >> k;
stack<int> st;
st.push(100);
vector<int> a(n);
map<int,vector<int>> mp;
for (int i=0;i<n;i++){
int x;
cin >> x;
a[i] = x;
if (x < st.top()){
st.push(x);
continue;
}
if (x > st.top()){
while (x > st.top()){
int u = st.top();
mp[i-1].pb(u);
while (u==st.top()){
st.pop();
u++;
}
st.push(u);
}
}
if (x==st.top()){
int u = st.top();
while (u==st.top()){
st.pop();
u++;
}
st.push(u);
}
}
int x = 30;
while (x > st.top()){
int u = st.top();
mp[n-1].pb(u);
st.pop();
st.push(u+1);
}
for (int i=0;i<n;i++){
cout << a[i] << ' ';
for (auto it : mp[i]) cout << it << ' ';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
354 ms |
90564 KB |
Expected EOF |
2 |
Incorrect |
343 ms |
90576 KB |
Expected EOF |
3 |
Incorrect |
362 ms |
90568 KB |
Expected EOF |
4 |
Incorrect |
356 ms |
90568 KB |
Expected EOF |
5 |
Incorrect |
367 ms |
90572 KB |
Expected EOF |
6 |
Incorrect |
349 ms |
90496 KB |
Expected EOF |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
375 ms |
90552 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
305 ms |
90528 KB |
Expected EOF |
3 |
Incorrect |
307 ms |
90572 KB |
Expected EOF |
4 |
Incorrect |
349 ms |
90572 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
354 ms |
90580 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
348 ms |
90560 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
368 ms |
90576 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
352 ms |
90572 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
263 ms |
76420 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
106 ms |
30284 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
167 ms |
49312 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |