Submission #750263

# Submission time Handle Problem Language Result Execution time Memory
750263 2023-05-29T08:48:43 Z MuntherCarrot Zalmoxis (BOI18_zalmoxis) C++14
30 / 100
138 ms 59248 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;
int n, k;
int arr[1000069];
vector<int> ans;
int i = 0;
void solve(int x){
    if(ans.size() >= n){
        if(ans.size() < n + k){
            ans.push_back((n + k - ans.size() == 1 ? x : x - 1));
            if(ans.size() < n + k)
                solve(x - 1);
        }
        return;
    }
    if(arr[i] > x){
        ans.push_back(x);
    }
    else if(arr[i] < x){
        solve(x - 1);
        solve(x - 1);
        return;
    }
    else{
        ans.push_back(x);
        i++;
    }
}
int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for(int i=0;i<n;i++)
        cin >> arr[i];
    solve(30);
    for(int i : ans)
        cout << i << ' ';
    return 0;
}

Compilation message

zalmoxis.cpp: In function 'void solve(int)':
zalmoxis.cpp:13:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   13 |     if(ans.size() >= n){
      |        ~~~~~~~~~~~^~~~
zalmoxis.cpp:14:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |         if(ans.size() < n + k){
      |            ~~~~~~~~~~~^~~~~~~
zalmoxis.cpp:16:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |             if(ans.size() < n + k)
      |                ~~~~~~~~~~~^~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 130 ms 10324 KB Output is correct
2 Correct 137 ms 10312 KB Output is correct
3 Correct 129 ms 10316 KB Output is correct
4 Correct 138 ms 10308 KB Output is correct
5 Correct 137 ms 10276 KB Output is correct
6 Correct 132 ms 10412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 134 ms 10252 KB doesn't contain S as a subsequence
2 Incorrect 136 ms 10296 KB doesn't contain S as a subsequence
3 Incorrect 128 ms 10404 KB doesn't contain S as a subsequence
4 Incorrect 127 ms 10420 KB doesn't contain S as a subsequence
5 Incorrect 127 ms 10324 KB doesn't contain S as a subsequence
6 Incorrect 131 ms 10516 KB doesn't contain S as a subsequence
7 Incorrect 129 ms 10424 KB doesn't contain S as a subsequence
8 Incorrect 129 ms 10376 KB not a zalsequence
9 Incorrect 127 ms 20132 KB doesn't contain S as a subsequence
10 Incorrect 129 ms 44528 KB doesn't contain S as a subsequence
11 Incorrect 129 ms 34772 KB doesn't contain S as a subsequence
12 Incorrect 111 ms 59248 KB doesn't contain S as a subsequence
13 Incorrect 117 ms 59184 KB doesn't contain S as a subsequence
14 Incorrect 114 ms 59204 KB not a zalsequence