답안 #750148

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
750148 2023-05-29T07:11:16 Z Essa2006 Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
224 ms 10320 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define FF first
#define SS second
#define all(a) a.begin(), a.end()
#define mod (ll)(1000000007)
int main(){
    int n, k;
    cin>>n>>k;
    vector<int>A(n), B;
    for(int i=0;i<n;i++){
        cin>>A[i];
    }
    if(n==1){
        return cout<<"29 29", 0;
    }
    B=A;
    int l=0, r=1, ind=-1, val;
    while(r<n){
        while(l>=0 && A[r]==A[l]){
            A[r]++;
            l--;
        }
        if(l<0)
            break;
        if(A[r]<A[l])
            l=r++;
        else if(A[r]>A[l]){
            ind=l, val=A[l];
            break;
        }
    }
    /*if(ind==-1){
        A=B;
        reverse(all(A));
        l=0, r=1, ind=-1, val;
        while(r<n){
            while(A[r]==A[l]){
                A[r]++;
                if(l)
                    l--;
            }
            if(A[r]<A[l])
                l=r++;
            else if(A[r]>A[l]){
                ind=l, val=A[l];
                break;
            }
        }
        ind=n-1-ind;
    }*/
    for(int i=0;i<n;i++){
        cout<<B[i]<<' ';
        if(i==ind)
            cout<<val<<' ';
    }
    if(ind==-1){
        if(l==-1)
            cout<<29;
        else
            cout<<A[r-1]<<' ';
    }
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:57:24: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
   57 |             cout<<val<<' ';
      |                        ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 200 ms 10188 KB not a zalsequence
2 Incorrect 204 ms 10132 KB not a zalsequence
3 Incorrect 224 ms 10216 KB not a zalsequence
4 Incorrect 214 ms 10132 KB not a zalsequence
5 Incorrect 206 ms 10228 KB not a zalsequence
6 Incorrect 203 ms 10316 KB not a zalsequence
# 결과 실행 시간 메모리 Grader output
1 Incorrect 210 ms 10188 KB Unexpected end of file - int32 expected
2 Incorrect 202 ms 10092 KB Unexpected end of file - int32 expected
3 Incorrect 204 ms 10188 KB Unexpected end of file - int32 expected
4 Incorrect 205 ms 10236 KB Unexpected end of file - int32 expected
5 Incorrect 208 ms 10320 KB Unexpected end of file - int32 expected
6 Incorrect 201 ms 10220 KB Unexpected end of file - int32 expected
7 Incorrect 202 ms 10220 KB Unexpected end of file - int32 expected
8 Incorrect 206 ms 10232 KB Unexpected end of file - int32 expected
9 Incorrect 165 ms 8280 KB Unexpected end of file - int32 expected
10 Incorrect 67 ms 3152 KB Unexpected end of file - int32 expected
11 Incorrect 109 ms 5192 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 0 ms 212 KB Unexpected end of file - int32 expected