# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
750113 | 2023-05-29T06:56:08 Z | MrM7md | Zalmoxis (BOI18_zalmoxis) | C++17 | 323 ms | 115700 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define F first #define S second #define pb push_back #define all(a) a.begin(),a.end() const int N=1e6; const int off=(1<<18); const int MOD = 1e9+7; vector<vector<int>>kk(N); signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,k; cin >> n >> k; vector<array<int,3>> a(n); for(int i=0;i<n;i++){ cin >> a[i][0]; a[i][1]=a[i][2]=i; } vector<array<int,3>>v=a; for(int i=0;i<=29;i++){ vector<array<int,3>>t; for(int j=0;j<v.size();j++){ if(j+1<v.size()&&v[j][0]==v[j+1][0]&&v[j][0]==i){ t.pb({v[j][0]+1,v[j][1],v[j+1][2]}); j++; } else if(v[j][0]==i){ t.pb({v[j][0]+1,v[j][1],v[j][2]}); kk[v[j][2]].pb(v[j][0]); // sort(all(kk[v[j][2]])); k--; // cout<<kk.F<<endl; } else{ t.pb(v[j]); } } v=t; } for(int i=0;i<n;i++){ while(!kk[i].empty()&&k>0&&kk[i].back()>0){ int x=kk[i].back()-1; kk[i].pop_back(); kk[i].pb(x),kk[i].pb(x); k--; } } int id=0; for(int i=0;i<n;i++){ cout<<a[i][0]<<' '; for(auto it:kk[i])cout<<it<<' '; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 292 ms | 114644 KB | Output is correct |
2 | Correct | 294 ms | 115452 KB | Output is correct |
3 | Correct | 317 ms | 115000 KB | Output is correct |
4 | Correct | 302 ms | 115076 KB | Output is correct |
5 | Correct | 323 ms | 115304 KB | Output is correct |
6 | Correct | 290 ms | 114004 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 322 ms | 114816 KB | Unexpected end of file - int32 expected |
2 | Correct | 259 ms | 114048 KB | Output is correct |
3 | Correct | 293 ms | 115416 KB | Output is correct |
4 | Correct | 284 ms | 115500 KB | Output is correct |
5 | Correct | 298 ms | 115056 KB | Output is correct |
6 | Correct | 278 ms | 114772 KB | Output is correct |
7 | Incorrect | 281 ms | 115256 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 296 ms | 115700 KB | Unexpected end of file - int32 expected |
9 | Correct | 252 ms | 104488 KB | Output is correct |
10 | Incorrect | 147 ms | 58580 KB | Unexpected end of file - int32 expected |
11 | Correct | 195 ms | 72132 KB | Output is correct |
12 | Incorrect | 13 ms | 23764 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 13 ms | 23764 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 13 ms | 23764 KB | Unexpected end of file - int32 expected |