Submission #827358

# Submission time Handle Problem Language Result Execution time Memory
827358 2023-08-16T11:48:16 Z vjudge1 Zalmoxis (BOI18_zalmoxis) C++17
30 / 100
129 ms 59256 KB
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define OYY 1000000005
#define mod 1000000007
#define mid (start+end)/2
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int dizi[1000005],n,k,i=0;
vector <int> cev;

inline void solve(int a){
    if(cev.size()==n+k){
        return ;
    }
    if(cev.size()>=n){
        if(n+k-cev.size()==1)cev.push_back(a);
        else cev.push_back(a-1);
        if(cev.size()<n+k)solve(a-1);
        return;
    }
    if(dizi[i]>a){
        cev.push_back(a);
        solve(a);
    }
    else if(dizi[i]==a){
        cev.push_back(a);
        i++;
    }
    else{
        solve(a-1),solve(a-1);
        return ;
    }
}
int main(){
    faster
    cin>>n>>k;
    for(int i=0;i<n;i++)cin>>dizi[i];
    solve(30);
///////
    for (int i=0;i<cev.size();i++)cout<<cev[i]<<" ";
    cout<<'\n';
    return 0;
}

Compilation message

zalmoxis.cpp: In function 'void solve(int)':
zalmoxis.cpp:12:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   12 |     if(cev.size()==n+k){
      |        ~~~~~~~~~~^~~~~
zalmoxis.cpp:15:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   15 |     if(cev.size()>=n){
      |        ~~~~~~~~~~^~~
zalmoxis.cpp:18:22: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |         if(cev.size()<n+k)solve(a-1);
      |            ~~~~~~~~~~^~~~
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:40:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for (int i=0;i<cev.size();i++)cout<<cev[i]<<" ";
      |                  ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 104 ms 10256 KB Output is correct
2 Correct 110 ms 10264 KB Output is correct
3 Correct 120 ms 10276 KB Output is correct
4 Correct 101 ms 10316 KB Output is correct
5 Correct 101 ms 10280 KB Output is correct
6 Correct 105 ms 10304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 124 ms 58168 KB doesn't contain S as a subsequence
2 Incorrect 125 ms 58184 KB doesn't contain S as a subsequence
3 Incorrect 120 ms 57092 KB doesn't contain S as a subsequence
4 Incorrect 121 ms 58144 KB doesn't contain S as a subsequence
5 Incorrect 121 ms 58168 KB doesn't contain S as a subsequence
6 Incorrect 123 ms 58188 KB doesn't contain S as a subsequence
7 Incorrect 129 ms 58232 KB doesn't contain S as a subsequence
8 Incorrect 122 ms 58048 KB doesn't contain S as a subsequence
9 Incorrect 119 ms 58292 KB doesn't contain S as a subsequence
10 Incorrect 100 ms 58524 KB doesn't contain S as a subsequence
11 Incorrect 102 ms 58656 KB doesn't contain S as a subsequence
12 Incorrect 87 ms 59216 KB doesn't contain S as a subsequence
13 Incorrect 90 ms 59192 KB doesn't contain S as a subsequence
14 Incorrect 89 ms 59256 KB not a zalsequence