답안 #750093

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
750093 2023-05-29T06:43:08 Z MrM7md Zalmoxis (BOI18_zalmoxis) C++17
30 / 100
363 ms 92280 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=1e3+25;
const int off=(1<<18);
const int MOD = 1e9+7;


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;
   pair<int,int>kk,vv;
   vv=kk={-1,-1};

   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&&kk.F==-1){
            t.pb({v[j][0]+1,v[j][1],v[j][2]});
            kk={v[j][0],v[j][2]};
            // cout<<kk.F<<endl;
         }
         else if(v[j][0]==i&&vv.F==-1){
            t.pb({v[j][0]+1,v[j][1],v[j][2]});
            vv={v[j][0],v[j][2]};
            // cout<<kk.F<<endl;
         }
         else{
            t.pb(v[j]);
         }
      }
      v=t;
   }
   for(int i=0;i<n;i++){
      cout<<a[i][0]<<' ';
      if(i==kk.S)cout<<kk.F<<' ';
      if(i==vv.S)cout<<vv.F<<' ';
   }
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:29: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]
   29 |       for(int j=0;j<v.size();j++){
      |                   ~^~~~~~~~~
zalmoxis.cpp:30: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]
   30 |          if(j+1<v.size()&&v[j][0]==v[j+1][0]&&v[j][0]==i){
      |             ~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 246 ms 91152 KB Output is correct
2 Correct 271 ms 91908 KB Output is correct
3 Correct 274 ms 91456 KB Output is correct
4 Correct 267 ms 91664 KB Output is correct
5 Correct 273 ms 91960 KB Output is correct
6 Correct 250 ms 90784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 265 ms 91372 KB Unexpected end of file - int32 expected
2 Incorrect 247 ms 90560 KB Unexpected end of file - int32 expected
3 Incorrect 282 ms 91780 KB Unexpected end of file - int32 expected
4 Incorrect 287 ms 92008 KB Unexpected end of file - int32 expected
5 Incorrect 266 ms 91672 KB Unexpected end of file - int32 expected
6 Incorrect 270 ms 91276 KB Unexpected end of file - int32 expected
7 Incorrect 271 ms 91804 KB Unexpected end of file - int32 expected
8 Incorrect 287 ms 92280 KB Unexpected end of file - int32 expected
9 Incorrect 310 ms 78812 KB Unexpected end of file - int32 expected
10 Incorrect 139 ms 33124 KB Unexpected end of file - int32 expected
11 Incorrect 363 ms 46364 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 1 ms 212 KB Unexpected end of file - int32 expected