답안 #145677

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
145677 2019-08-20T18:32:09 Z Blagojce Zalmoxis (BOI18_zalmoxis) C++11
0 / 100
1000 ms 26604 KB
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x),end(x)

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
ll const inf = 1e9;
ll const mod = 998244853;
ld const eps = 1e-9;


bool f(pii A, pii B){
        if(A.st < B.st)return true;
        else return A.nd > B.nd;
}
int main()
{
        int n, k;
        cin >> n >> k;
        int a[n];
        int b[n];
        int MIN = 40;
        int nxt[n];
        fr(i, 0, n){
                cin >> a[i];
                b[i] = a[i];
                MIN = min(a[i], MIN);
                nxt[i] = i + 1;
        }
        nxt[n - 1] = n - 1;
        vector<pii> v;
        int sz = n;
        fr(mi, MIN, 30){
                int p = 0;
                int CNT = 0;
                fr(i, 0, sz - 1){
                        if(a[p] == mi){
                                if(a[nxt[p]] == mi){
                                        a[p] = mi + 1;
                                        nxt[p] = nxt[nxt[p]];
                                        CNT ++;
                                }
                                else{
                                        v.pb({i, mi});
                                        a[p] = mi + 1;
                                }
                        }
                        p = nxt[p];
                }
                sz -= CNT;
        }
        if(a[0] == 29){
                v.pb({0, 29});
        }
        sort(v.begin(), v.end(), f);

        int j = 0;
        k -= v.size();
        if(k < 0){
                cout << 2 / 0 << endl;
                
        }
        fr(i, 0, n){
                while(j < v.size() && v[j].st == i){

                        cout << v[j].nd <<' ';
                        j ++;
                }
                cout << b[i] <<' ';
        }
        cout <<endl;


        return 0;
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:66:27: warning: division by zero [-Wdiv-by-zero]
                 cout << 2 / 0 << endl;
                         ~~^~~
zalmoxis.cpp:70:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 while(j < v.size() && v[j].st == i){
                       ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 400 ms 15864 KB Unexpected end of file - int32 expected
2 Incorrect 403 ms 15964 KB Unexpected end of file - int32 expected
3 Incorrect 396 ms 15864 KB Unexpected end of file - int32 expected
4 Incorrect 407 ms 15928 KB Unexpected end of file - int32 expected
5 Incorrect 396 ms 15864 KB Unexpected end of file - int32 expected
6 Incorrect 398 ms 15736 KB Unexpected end of file - int32 expected
# 결과 실행 시간 메모리 Grader output
1 Incorrect 416 ms 16124 KB Unexpected end of file - int32 expected
2 Incorrect 406 ms 16152 KB Unexpected end of file - int32 expected
3 Runtime error 326 ms 26604 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Incorrect 403 ms 16248 KB Unexpected end of file - int32 expected
5 Incorrect 405 ms 16248 KB Unexpected end of file - int32 expected
6 Incorrect 397 ms 15484 KB Unexpected end of file - int32 expected
7 Incorrect 411 ms 15352 KB Unexpected end of file - int32 expected
8 Incorrect 401 ms 15736 KB Unexpected end of file - int32 expected
9 Runtime error 316 ms 23524 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Execution timed out 1070 ms 6636 KB Time limit exceeded
11 Runtime error 200 ms 16212 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Incorrect 2 ms 256 KB Unexpected end of file - int32 expected
13 Incorrect 2 ms 376 KB Unexpected end of file - int32 expected
14 Incorrect 2 ms 252 KB Unexpected end of file - int32 expected