답안 #750123

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
750123 2023-05-29T07:00:11 Z MrM7md Zalmoxis (BOI18_zalmoxis) C++17
0 / 100
375 ms 139176 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),ans(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<=30;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++){
      for(auto it:kk[i]){
         ans[i].pb(it);
         while(!ans[i].empty()&&k>0&&ans[i].back()>0){
            int x=ans[i].back()-1;
            ans[i].pop_back();
            ans[i].pb(x),ans[i].pb(x);
            k--;
         }
      }
   }
   int id=0;
   for(int i=0;i<n;i++){
      cout<<a[i][0]<<' ';
      for(auto it:ans[i])cout<<it<<' ';
   }
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:27:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |       for(int j=0;j<v.size();j++){
      |                   ~^~~~~~~~~
zalmoxis.cpp:28:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |          if(j+1<v.size()&&v[j][0]==v[j+1][0]&&v[j][0]==i){
      |             ~~~^~~~~~~~~
zalmoxis.cpp:57:8: warning: unused variable 'id' [-Wunused-variable]
   57 |    int id=0;
      |        ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 282 ms 138068 KB Expected EOF
2 Incorrect 299 ms 139008 KB Expected EOF
3 Incorrect 303 ms 138492 KB Expected EOF
4 Incorrect 301 ms 138580 KB Expected EOF
5 Incorrect 308 ms 138772 KB Expected EOF
6 Incorrect 286 ms 137504 KB Expected EOF
# 결과 실행 시간 메모리 Grader output
1 Incorrect 323 ms 138296 KB not a zalsequence
2 Incorrect 287 ms 137520 KB Expected EOF
3 Incorrect 303 ms 138760 KB not a zalsequence
4 Incorrect 333 ms 138980 KB not a zalsequence
5 Incorrect 316 ms 138564 KB not a zalsequence
6 Incorrect 324 ms 138284 KB not a zalsequence
7 Incorrect 375 ms 138732 KB not a zalsequence
8 Incorrect 350 ms 139176 KB not a zalsequence
9 Incorrect 336 ms 128044 KB not a zalsequence
10 Incorrect 183 ms 82380 KB not a zalsequence
11 Incorrect 221 ms 95748 KB not a zalsequence
12 Incorrect 24 ms 47188 KB Unexpected end of file - int32 expected
13 Incorrect 25 ms 47188 KB Unexpected end of file - int32 expected
14 Incorrect 25 ms 47188 KB Unexpected end of file - int32 expected