Submission #750121

# Submission time Handle Problem Language Result Execution time Memory
750121 2023-05-29T06:59:27 Z Essa2006 Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
215 ms 10316 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(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;
        }
    }
    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<<' ';
    }
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:37:30: warning: right operand of comma operator has no effect [-Wunused-value]
   37 |         l=0, r=1, ind=-1, val;
      |                              ^
zalmoxis.cpp:56:24: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
   56 |             cout<<val<<' ';
      |                        ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 198 ms 10100 KB not a zalsequence
2 Incorrect 205 ms 10236 KB not a zalsequence
3 Incorrect 198 ms 10204 KB not a zalsequence
4 Incorrect 202 ms 10220 KB not a zalsequence
5 Incorrect 210 ms 10228 KB not a zalsequence
6 Incorrect 202 ms 10092 KB not a zalsequence
# Verdict Execution time Memory Grader output
1 Incorrect 215 ms 10224 KB Unexpected end of file - int32 expected
2 Incorrect 200 ms 10188 KB Unexpected end of file - int32 expected
3 Incorrect 208 ms 10212 KB Unexpected end of file - int32 expected
4 Incorrect 202 ms 10188 KB Unexpected end of file - int32 expected
5 Incorrect 203 ms 10232 KB Unexpected end of file - int32 expected
6 Incorrect 206 ms 10104 KB Unexpected end of file - int32 expected
7 Incorrect 198 ms 10224 KB Unexpected end of file - int32 expected
8 Incorrect 206 ms 10316 KB Unexpected end of file - int32 expected
9 Incorrect 160 ms 8168 KB Unexpected end of file - int32 expected
10 Incorrect 64 ms 3268 KB Unexpected end of file - int32 expected
11 Incorrect 102 ms 5200 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