Submission #750068

# Submission time Handle Problem Language Result Execution time Memory
750068 2023-05-29T06:25:04 Z MuntherCarrot Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
126 ms 10316 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define endl '\n'
#define all(x) x.begin(),x.end()
const ll MOD = 1e9 + 7, SZ = 1e5 + 10, INF = 1e18;
int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, k;
    cin >> n >> k;
    int arr[n];
    int frq[31] = {};
    for(int &i : arr){
        cin >> i;
        frq[i]++;
    }
    int num, x;
    for(int i=0;i<31;i++){
        // cout << i << ' ' << frq[i] << endl;
        if(frq[i]%2){
            x = i;
        }
        frq[i + 1] += frq[i]/2;
        frq[i] %= 2;
        if(frq[i]%2){
            num = i;
            break;
        }
    }
    for(int i : arr){
        if(i == x || i + 1 == x){
            cout << num << ' ';
            x = -69;
        }
        cout << i << ' ';
    }
    return 0;
}

Compilation message

zalmoxis.cpp: In function 'int32_t main()':
zalmoxis.cpp:32:19: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   32 |         if(i == x || i + 1 == x){
      |            ~~~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 115 ms 10148 KB not a zalsequence
2 Incorrect 118 ms 10188 KB not a zalsequence
3 Incorrect 107 ms 10180 KB not a zalsequence
4 Incorrect 109 ms 10176 KB not a zalsequence
5 Incorrect 117 ms 10168 KB not a zalsequence
6 Incorrect 109 ms 10188 KB not a zalsequence
# Verdict Execution time Memory Grader output
1 Incorrect 110 ms 10184 KB Unexpected end of file - int32 expected
2 Incorrect 108 ms 10160 KB Unexpected end of file - int32 expected
3 Incorrect 107 ms 10140 KB Unexpected end of file - int32 expected
4 Incorrect 109 ms 10316 KB Unexpected end of file - int32 expected
5 Incorrect 108 ms 10216 KB Unexpected end of file - int32 expected
6 Incorrect 118 ms 10184 KB Unexpected end of file - int32 expected
7 Incorrect 109 ms 10168 KB Unexpected end of file - int32 expected
8 Incorrect 126 ms 10176 KB Unexpected end of file - int32 expected
9 Incorrect 85 ms 8192 KB Unexpected end of file - int32 expected
10 Incorrect 35 ms 3184 KB Unexpected end of file - int32 expected
11 Incorrect 58 ms 5232 KB Unexpected end of file - int32 expected
12 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
13 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
14 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected