Submission #668388

# Submission time Handle Problem Language Result Execution time Memory
668388 2022-12-03T18:47:15 Z Rifal Zalmoxis (BOI18_zalmoxis) C++14
35 / 100
153 ms 7024 KB
#include <bits/stdc++.h>
//#include <fstream>
#define endl '\n'
#define mod 5000000
#define INF 100000000000000000
//define ll long long
//ofstream fout("split.out");
//ifstream fin("split.in");
//#define cin fin
//#define cout fout
#define fi first
#define se second
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    int n, k ;cin >> n >> k; vector<int> v; stack<int> st;
    for(int i = 0; i < n; i++) {
        int x; cin >> x;
        while(!st.empty() && st.top() < x) {
                int z = st.top();
                v.push_back(z);
                while(z == st.top()) {
                    st.pop();
                    z++;
                }
                st.push(z);
        }
        st.push(x);
        v.push_back(x);
        int y = st.top(); st.pop();
        while(!st.empty() && st.top() == y) {
            st.pop();
            y++;
        }
        if(y < 30) st.push(y);
    }
    while(!st.empty() && st.top() != 30) {
        int y = st.top();
        st.pop();
        v.push_back(y);
        y++;
        while(!st.empty() && st.top()== y) {
            st.pop(); y++;
        }
        if(y != 30) st.push(y);
    }
    for(int i = 0; i < v.size(); i++) {
        cout << v[i] << ' ';

    }
    return 0;
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:49:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |     for(int i = 0; i < v.size(); i++) {
      |                    ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 125 ms 7024 KB Output is correct
2 Correct 153 ms 6904 KB Output is correct
3 Correct 149 ms 6944 KB Output is correct
4 Correct 138 ms 6992 KB Output is correct
5 Correct 126 ms 6948 KB Output is correct
6 Correct 141 ms 6888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 11
2 Correct 135 ms 6844 KB Output is correct
3 Incorrect 126 ms 6936 KB Unexpected end of file - int32 expected
4 Runtime error 1 ms 468 KB Execution killed with signal 11
5 Runtime error 1 ms 468 KB Execution killed with signal 11
6 Runtime error 1 ms 468 KB Execution killed with signal 11
7 Runtime error 1 ms 468 KB Execution killed with signal 11
8 Incorrect 134 ms 6944 KB Unexpected end of file - int32 expected
9 Runtime error 1 ms 468 KB Execution killed with signal 11
10 Runtime error 1 ms 468 KB Execution killed with signal 11
11 Runtime error 1 ms 468 KB Execution killed with signal 11
12 Runtime error 1 ms 340 KB Execution killed with signal 11
13 Runtime error 1 ms 340 KB Execution killed with signal 11
14 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected