답안 #59785

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
59785 2018-07-23T06:11:35 Z model_code Zalmoxis (BOI18_zalmoxis) C++17
0 / 100
582 ms 62464 KB
/* lightly tested */
#include <cmath>
#include <cassert>
#include <iostream>
#include <list>
#include <deque>
using namespace std;

int main(){
    int n, k;
    cin >> n >> k;

    deque<int> st;
    list<int> res;
    list<list<int>::iterator> increasable;
    int sum = 0;
    for(int i = 0; i <= n; ++i){
        int x;

        if(i == n) x = 30;
        else cin >> x, sum += (1<<x);

        while(!st.empty() && st[0] < x){
            res.push_back(st[0]);
            increasable.push_back(--res.end());
            ++st[0];
            while(st.size() > 1 && st[0] == st[1]){
                st.pop_front();
                ++st[0]; } }
        st.push_front(x);
        while(st.size() > 1 & st[0] == st[1]){
            st.pop_front();
            ++st[0]; }

        if(i != n) res.push_back(x); }

    cerr << sum << endl;
    cerr << (1<<30) - sum << endl;
    cerr << log2((1<<30) - sum) << endl;

    cerr << res.size() << endl;

    while(res.size() < n+k){
        auto it = increasable.front();
        increasable.pop_front();
        if(*it == 0) continue;
        --*it;
        increasable.push_back(it);
        increasable.push_back(res.insert(it, *it)); }

    for(auto x : res) cout << x << ' ';
    return 0; }

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:31:25: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
         while(st.size() > 1 & st[0] == st[1]){
               ~~~~~~~~~~^~~
zalmoxis.cpp:43:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(res.size() < n+k){
           ~~~~~~~~~~~^~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 512 ms 33820 KB Expected EOF
2 Incorrect 539 ms 33912 KB Expected EOF
3 Incorrect 492 ms 33912 KB Expected EOF
4 Incorrect 515 ms 33912 KB Expected EOF
5 Incorrect 547 ms 33920 KB Expected EOF
6 Incorrect 527 ms 33924 KB Expected EOF
# 결과 실행 시간 메모리 Grader output
1 Incorrect 460 ms 33924 KB Expected integer, but "21.8345" found
2 Incorrect 529 ms 33924 KB Expected integer, but "20.1614" found
3 Incorrect 501 ms 33928 KB Expected integer, but "20.265" found
4 Incorrect 542 ms 33964 KB Expected integer, but "22.9155" found
5 Incorrect 473 ms 33964 KB Expected integer, but "20.5333" found
6 Incorrect 582 ms 33968 KB Expected integer, but "21.6439" found
7 Incorrect 552 ms 34040 KB Expected integer, but "22.2095" found
8 Incorrect 468 ms 34048 KB Expected integer, but "19.3417" found
9 Incorrect 527 ms 40140 KB Expected integer, but "27.6149" found
10 Incorrect 503 ms 53760 KB Expected integer, but "29.4914" found
11 Incorrect 489 ms 53760 KB Expected integer, but "28.9541" found
12 Incorrect 458 ms 62336 KB Expected EOF
13 Incorrect 477 ms 62336 KB Expected EOF
14 Incorrect 460 ms 62464 KB Expected EOF