답안 #144994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
144994 2019-08-18T10:46:27 Z MKopchev Zalmoxis (BOI18_zalmoxis) C++14
35 / 100
201 ms 18760 KB
#include<bits/stdc++.h>
using namespace std;
const int nmax=1e6+42;
int n,k;
int inp[nmax];
vector<int> output;
int pos=1;
void go(int num)
{
    if(pos>n||inp[pos]>num)
    {
        output.push_back(num);
        return;
    }
    if(inp[pos]==num)
    {
        pos++;
        output.push_back(num);
        return;
    }

    go(num-1);
    go(num-1);
}
int main()
{
    scanf("%i%i",&n,&k);
    for(int i=1;i<=n;i++)scanf("%i",&inp[i]);

    go(30);

    assert(output.size()==n+k);

    for(auto p:output)
        printf("%i ",p);
    return 0;
}

Compilation message

In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from zalmoxis.cpp:1:
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:32:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     assert(output.size()==n+k);
            ~~~~~~~~~~~~~^~~~~
zalmoxis.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i%i",&n,&k);
     ~~~~~^~~~~~~~~~~~~~
zalmoxis.cpp:28:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1;i<=n;i++)scanf("%i",&inp[i]);
                          ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 194 ms 12380 KB Output is correct
2 Correct 195 ms 12380 KB Output is correct
3 Correct 201 ms 12384 KB Output is correct
4 Correct 194 ms 12380 KB Output is correct
5 Correct 195 ms 12508 KB Output is correct
6 Correct 193 ms 12384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 125 ms 18524 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Correct 194 ms 12356 KB Output is correct
3 Runtime error 125 ms 18700 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 125 ms 18740 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 125 ms 18760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 125 ms 18596 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 125 ms 18688 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 133 ms 18652 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 105 ms 16092 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 47 ms 7144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 76 ms 11100 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 3 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)