Submission #750110

# Submission time Handle Problem Language Result Execution time Memory
750110 2023-05-29T06:53:34 Z Essa2006 Zalmoxis (BOI18_zalmoxis) C++17
0 / 100
230 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];
    }
    B=A;
    int l=0, r=1, ind, 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;
        }
    }
    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:34:24: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
   34 |             cout<<val<<' ';
      |                        ^~~
zalmoxis.cpp:33:9: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |         if(i==ind)
      |         ^~
# Verdict Execution time Memory Grader output
1 Incorrect 216 ms 10140 KB not a zalsequence
2 Incorrect 205 ms 10164 KB not a zalsequence
3 Incorrect 209 ms 10220 KB not a zalsequence
4 Incorrect 230 ms 10224 KB not a zalsequence
5 Incorrect 209 ms 10216 KB not a zalsequence
6 Incorrect 209 ms 10192 KB not a zalsequence
# Verdict Execution time Memory Grader output
1 Incorrect 208 ms 10092 KB Unexpected end of file - int32 expected
2 Incorrect 220 ms 10120 KB Unexpected end of file - int32 expected
3 Incorrect 209 ms 10216 KB Unexpected end of file - int32 expected
4 Incorrect 205 ms 10232 KB Unexpected end of file - int32 expected
5 Incorrect 222 ms 10188 KB Unexpected end of file - int32 expected
6 Incorrect 204 ms 10216 KB Unexpected end of file - int32 expected
7 Incorrect 206 ms 10316 KB Unexpected end of file - int32 expected
8 Incorrect 210 ms 10188 KB Unexpected end of file - int32 expected
9 Incorrect 175 ms 8168 KB Unexpected end of file - int32 expected
10 Incorrect 61 ms 3264 KB Unexpected end of file - int32 expected
11 Incorrect 102 ms 5196 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