Submission #219131

# Submission time Handle Problem Language Result Execution time Memory
219131 2020-04-03T18:09:01 Z 2fat2code Zalmoxis (BOI18_zalmoxis) C++17
0 / 100
175 ms 29284 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(a) (a).begin(), (a).end()
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define sz() size()
#define fr first
#define sc second
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
#define mp make_pair
#define int long long
#define rc(s) return cout<<s,0
#define rcc(s) cout<<s,exit(0)
using namespace std;

const int mod=1e9+7;
const int modp=1999999973;
const int modulo=998244353;

const int nmax=1000005;

int n,k,a[nmax];
vector<pair<int,int>>pref;
vector<int>vecc,ans;

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    srand(chrono::steady_clock::now().time_since_epoch().count());
 //   ifstream cin("input.in");
    cin >> n >> k;
    for(int i=1;i<=n;i++) cin >> a[i];
    for(int i=1;i<=n;i++){
        if(vecc.size()){
            if(a[i]>=vecc.back()){
                while(a[i]>vecc.back()){
                    int curr=vecc.back();
                    vecc.pop_back();
                    vecc.push_back(curr+1);
                    pref.push_back({curr,1});
                }
                pref.push_back({a[i],0});
                int curr=a[i];
                while(vecc.size() && curr==vecc.back()){
                    vecc.pop_back();
                    curr++;
                }
                vecc.push_back(curr);
            }
            else{
                pref.push_back({a[i],0});
                vecc.push_back(a[i]);
            }
        }
        else{
            vecc.push_back(a[i]);
            pref.push_back({a[i],0});
        }
    }
    for(auto it:pref) cout << it.fr << ' ';
}
# Verdict Execution time Memory Grader output
1 Incorrect 173 ms 28276 KB Unexpected end of file - int32 expected
2 Incorrect 170 ms 28096 KB Unexpected end of file - int32 expected
3 Incorrect 166 ms 28096 KB Unexpected end of file - int32 expected
4 Incorrect 167 ms 28096 KB Unexpected end of file - int32 expected
5 Incorrect 169 ms 28096 KB Unexpected end of file - int32 expected
6 Incorrect 165 ms 28188 KB Unexpected end of file - int32 expected
# Verdict Execution time Memory Grader output
1 Incorrect 167 ms 28208 KB Unexpected end of file - int32 expected
2 Incorrect 163 ms 28232 KB Expected EOF
3 Incorrect 159 ms 28352 KB Expected EOF
4 Incorrect 172 ms 28100 KB Unexpected end of file - int32 expected
5 Incorrect 161 ms 28096 KB Unexpected end of file - int32 expected
6 Incorrect 158 ms 28096 KB Unexpected end of file - int32 expected
7 Incorrect 175 ms 28416 KB Unexpected end of file - int32 expected
8 Incorrect 165 ms 28096 KB Unexpected end of file - int32 expected
9 Incorrect 149 ms 29284 KB Unexpected end of file - int32 expected
10 Incorrect 69 ms 13432 KB Unexpected end of file - int32 expected
11 Incorrect 117 ms 23684 KB Unexpected end of file - int32 expected
12 Incorrect 5 ms 384 KB Unexpected end of file - int32 expected
13 Incorrect 4 ms 384 KB Unexpected end of file - int32 expected
14 Incorrect 5 ms 384 KB Unexpected end of file - int32 expected