답안 #568558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
568558 2022-05-25T16:55:45 Z urosk Zalmoxis (BOI18_zalmoxis) C++14
5 / 100
1000 ms 38964 KB
// __builtin_popcount(x)
// __builtin_popcountll(x)
#define here cerr<<"===========================================\n"
#include <bits/stdc++.h>
#define ld double
#define ll long long
#define ull unsigned long long
#define llinf 100000000000000000LL // 10^17
#define iinf 2000000000 // 2*10^9
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) int(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
using namespace std;

#define maxn 1000005
ll n,k;
vector<ll> v;
ll a[maxn];
int main(){
	ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0);
    cin >> n >> k;
    bool bio = 0;
    ll last = -1;
    ll e = -1;
    for(ll i = 1;i<=n;i++){
        cin >> a[i];
        ll x = a[i];
        if(v.empty()||(sz(v)&&v.back()!=x)) v.pb(x);
        else{
            while(sz(v)&&x==v.back()){
                v.popb();
                v.pb(x+1);
                last = i;
                e = x+1;
                bio = 1;
            }
        }
    }
    if(bio){
        for(ll i = 1;i<=n;i++){
            cout<<a[i]<< " ";
            if(last==i){
                cout<<e<< " ";
            }
        }
        cout<<endl;
    }else{
        while(1) here;
        ll mn = llinf;
        for(ll i = 1;i<=n;i++) mn = min(mn,a[i]);
        for(ll i = 1;i<=n;i++){
            cout<<a[i]<< " ";
            if(a[i]==mn&&k>0){
                cout<<mn<< " ";
                k--;
            }
        }
        cout<<endl;
    }
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 122 ms 16292 KB not a zalsequence
2 Incorrect 129 ms 16360 KB not a zalsequence
3 Correct 138 ms 16348 KB Output is correct
4 Incorrect 115 ms 16332 KB not a zalsequence
5 Incorrect 135 ms 16384 KB not a zalsequence
6 Incorrect 121 ms 16412 KB not a zalsequence
# 결과 실행 시간 메모리 Grader output
1 Incorrect 155 ms 16404 KB Unexpected end of file - int32 expected
2 Incorrect 124 ms 16376 KB Unexpected end of file - int32 expected
3 Incorrect 119 ms 16236 KB Unexpected end of file - int32 expected
4 Incorrect 149 ms 16308 KB Unexpected end of file - int32 expected
5 Incorrect 118 ms 16352 KB Unexpected end of file - int32 expected
6 Incorrect 126 ms 16316 KB Unexpected end of file - int32 expected
7 Incorrect 124 ms 16292 KB Unexpected end of file - int32 expected
8 Incorrect 122 ms 16272 KB Unexpected end of file - int32 expected
9 Incorrect 131 ms 12140 KB Unexpected end of file - int32 expected
10 Incorrect 37 ms 5060 KB Unexpected end of file - int32 expected
11 Incorrect 58 ms 7992 KB Unexpected end of file - int32 expected
12 Execution timed out 1071 ms 38496 KB Time limit exceeded
13 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
14 Execution timed out 1092 ms 38964 KB Time limit exceeded