답안 #827356

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
827356 2023-08-16T11:46:41 Z vjudge1 Zalmoxis (BOI18_zalmoxis) C++17
30 / 100
142 ms 60316 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:39:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for (int i=0;i<cev.size();i++)cout<<cev[i]<<" ";
      |                  ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 12376 KB Output is correct
2 Correct 101 ms 12332 KB Output is correct
3 Correct 123 ms 12404 KB Output is correct
4 Correct 104 ms 12424 KB Output is correct
5 Correct 108 ms 12416 KB Output is correct
6 Correct 103 ms 12352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 140 ms 60172 KB doesn't contain S as a subsequence
2 Incorrect 124 ms 60212 KB doesn't contain S as a subsequence
3 Incorrect 119 ms 59192 KB doesn't contain S as a subsequence
4 Incorrect 124 ms 60260 KB doesn't contain S as a subsequence
5 Incorrect 142 ms 60316 KB doesn't contain S as a subsequence
6 Incorrect 124 ms 60296 KB doesn't contain S as a subsequence
7 Incorrect 120 ms 60264 KB doesn't contain S as a subsequence
8 Incorrect 124 ms 60064 KB doesn't contain S as a subsequence
9 Incorrect 116 ms 59944 KB doesn't contain S as a subsequence
10 Incorrect 108 ms 59252 KB doesn't contain S as a subsequence
11 Incorrect 106 ms 59680 KB doesn't contain S as a subsequence
12 Incorrect 90 ms 59144 KB doesn't contain S as a subsequence
13 Incorrect 87 ms 59192 KB doesn't contain S as a subsequence
14 Incorrect 82 ms 59192 KB not a zalsequence