Submission #61881

# Submission time Handle Problem Language Result Execution time Memory
61881 2018-07-27T04:05:21 Z 노영훈(#1796) Zalmoxis (BOI18_zalmoxis) C++11
0 / 100
242 ms 8292 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MX=1000010, inf=2e9;

int n, k;
int A[MX];

void comp(vector<int> &V){
    int sz=V.size();
    if(sz<=1) return;
    if(V[sz-2]==V[sz-1]) V.pop_back(), V[sz-2]++;
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    cin>>n>>k;
    for(int i=1; i<=n; i++) cin>>A[i];
    pii ans=pii(0,0);
    vector<int> V;
    for(int i=1; i<=n; i++){
        if(V.empty()) V.push_back(A[i]);
        else{
            if(V.back()<A[i]) V.push_back(V.back()), ans={V.back(), i};
            comp(V);
            V.push_back(A[i]);
            comp(V);
        }
    }
    if(ans==pii(0,0)) ans={29, 1};
    for(int i=1; i<=n; i++){
        if(ans.second==i) cout<<ans.first<<' ';
        cout<<A[i]<<' ';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 190 ms 7860 KB not a zalsequence
2 Incorrect 195 ms 7972 KB not a zalsequence
3 Incorrect 188 ms 7972 KB not a zalsequence
4 Incorrect 208 ms 8004 KB not a zalsequence
5 Incorrect 204 ms 8024 KB not a zalsequence
6 Incorrect 242 ms 8040 KB not a zalsequence
# Verdict Execution time Memory Grader output
1 Incorrect 184 ms 8084 KB Unexpected end of file - int32 expected
2 Incorrect 211 ms 8120 KB Unexpected end of file - int32 expected
3 Incorrect 179 ms 8188 KB Unexpected end of file - int32 expected
4 Incorrect 193 ms 8188 KB Unexpected end of file - int32 expected
5 Incorrect 213 ms 8220 KB Unexpected end of file - int32 expected
6 Incorrect 183 ms 8220 KB Unexpected end of file - int32 expected
7 Incorrect 192 ms 8220 KB Unexpected end of file - int32 expected
8 Incorrect 215 ms 8292 KB Unexpected end of file - int32 expected
9 Incorrect 145 ms 8292 KB Unexpected end of file - int32 expected
10 Incorrect 59 ms 8292 KB Unexpected end of file - int32 expected
11 Incorrect 108 ms 8292 KB Unexpected end of file - int32 expected
12 Incorrect 3 ms 8292 KB Unexpected end of file - int32 expected
13 Incorrect 3 ms 8292 KB Unexpected end of file - int32 expected
14 Incorrect 2 ms 8292 KB Unexpected end of file - int32 expected