답안 #635144

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
635144 2022-08-25T14:19:26 Z PanTkd Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
130 ms 10244 KB
//
//  main.cpp
//
//  Created by Panagiotis Chadjicostas on
//  Copyright © Panagiotis Hadjicostas. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iterator>
#include <limits>
#include <list>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#define fo(i,a,b) for(int i = a; i<=b; i++)
#define f(i,b) for(int i=0;i<b;i++)
#define F first
#define S second
#define sz size
#define ls s,m,idx<<1
#define rs m+1,e,idx<<1|1
#ifdef panas
	#define p(x) cerr<<#x<<x<<endl;
#else
	#define p(x) {}
#endif

const ll MOD=ll(1e9)+7;
const ll MAXN=2*ll(1e6);
void checker(){
	ll n=rand()%20+2;
	vi a(n,ll());
	for(ll i=0;i<n;i++){
		a[i]=rand()%20+2;
	}
	for(ll b=0;b<(1<<n);b++){
		vi on,off;
		for(ll i=0;i<n;i++){
			if(i&(1<<i)){
				on.push_back(i);
			}
			else{
				off.push_back(i);
			}
		}
	}
}
///////////////////////////////////////////////////////////////////////
void solve(){
	ll n,k;cin>>n>>k;
	vector<ll> a(n,ll());
	map<ll,ll> mp;
	ll mini=MOD;
	for(ll i=0;i<n;i++){cin>>a[i];mp[a[i]]++;mini=min(mini,a[i]);}
	ll x=0;
	for(ll i=1;i<=29;i++){
		while(mp[i]>=2){
			mp[i]-=2;
			mp[i+1]++;
		}
		if (mp[i]==1){
			x=i;
			break;
		}
	}
	bool f=0;
	
	for(ll i=0;i<n;i++){
		if(x-1==a[i]&&!f){
			f=1;
			cout<<x<<' ';
		}else if(x==mini&&a[i]==x&&!f){
			f=1;
			cout<<x<<' ';
		}
		cout<<a[i]<<' ';
	}
	cout<<endl;
	return ;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t=1;//cin>>t;
	while (t--) {
		solve();
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 130 ms 10188 KB not a zalsequence
2 Incorrect 122 ms 10212 KB not a zalsequence
3 Incorrect 128 ms 10184 KB not a zalsequence
4 Incorrect 122 ms 10208 KB not a zalsequence
5 Incorrect 128 ms 10192 KB not a zalsequence
6 Incorrect 114 ms 10120 KB not a zalsequence
# 결과 실행 시간 메모리 Grader output
1 Incorrect 117 ms 10188 KB Unexpected end of file - int32 expected
2 Incorrect 114 ms 10184 KB Unexpected end of file - int32 expected
3 Incorrect 123 ms 10184 KB Unexpected end of file - int32 expected
4 Incorrect 115 ms 10192 KB Unexpected end of file - int32 expected
5 Incorrect 124 ms 10244 KB Unexpected end of file - int32 expected
6 Incorrect 116 ms 10192 KB Unexpected end of file - int32 expected
7 Incorrect 119 ms 10184 KB Unexpected end of file - int32 expected
8 Incorrect 120 ms 10156 KB Unexpected end of file - int32 expected
9 Incorrect 104 ms 8320 KB Unexpected end of file - int32 expected
10 Incorrect 37 ms 3284 KB Unexpected end of file - int32 expected
11 Incorrect 59 ms 5196 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