답안 #750058

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
750058 2023-05-29T06:13:04 Z vqpahmad Zalmoxis (BOI18_zalmoxis) C++14
30 / 100
415 ms 88556 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define endl '\n'
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
const int mod = 1e9 + 7;
const int N = 1e6 + 15;
const ll inf = 1e18;

int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n,k;
    cin >> n >> k;
    stack<int> st;
    st.push(100);
    vector<int> a(n);
    map<int,vector<int>> mp;
    for (int i=0;i<n;i++){
        int x;
        cin >> x;
        a[i] = x;
        if (x < st.top()){
            st.push(x);
            continue;
        }
        if (x > st.top()){
            while (x > st.top()){
                int u = st.top();
                mp[i-1].pb(u);
                while (u==st.top()){
                    st.pop();
                    u++;
                }
                st.push(u);
            }
        }
        if (x==st.top()){
            int u = st.top();
            while (u==st.top()){
                st.pop();
                u++;
            }
            st.push(u);
        }
    }
    int x = 30;
    while (x > st.top()){
        int u = st.top();
        mp[n-1].pb(u);
        while (u==st.top()){
            st.pop();
            u++;
        }
        st.push(u);
    }
    for (int i=0;i<n;i++){
        cout << a[i] << ' ';
        for (auto it : mp[i]) cout << it << ' ';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 391 ms 88556 KB Output is correct
2 Correct 415 ms 88504 KB Output is correct
3 Correct 395 ms 88516 KB Output is correct
4 Correct 380 ms 88412 KB Output is correct
5 Correct 380 ms 88472 KB Output is correct
6 Correct 366 ms 88384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 381 ms 88388 KB Unexpected end of file - int32 expected
2 Incorrect 297 ms 88380 KB Expected EOF
3 Incorrect 360 ms 88448 KB Expected EOF
4 Incorrect 371 ms 88512 KB Unexpected end of file - int32 expected
5 Incorrect 382 ms 88452 KB Unexpected end of file - int32 expected
6 Incorrect 356 ms 88524 KB Unexpected end of file - int32 expected
7 Incorrect 376 ms 88524 KB Unexpected end of file - int32 expected
8 Incorrect 382 ms 88528 KB Unexpected end of file - int32 expected
9 Incorrect 259 ms 74636 KB Unexpected end of file - int32 expected
10 Incorrect 124 ms 29644 KB Unexpected end of file - int32 expected
11 Incorrect 165 ms 48280 KB Unexpected end of file - int32 expected
12 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
13 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
14 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected