답안 #635142

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
635142 2022-08-25T14:16:33 Z PanTkd Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
135 ms 10288 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;
	for(ll i=0;i<n;i++){cin>>a[i];mp[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==29-n+1&&a[i]==x&&!f){
			f=1;
			cout<<x<<' ';
		}
		cout<<a[i]<<' ';
	}
	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 135 ms 10152 KB not a zalsequence
2 Incorrect 114 ms 10132 KB not a zalsequence
3 Incorrect 119 ms 10188 KB not a zalsequence
4 Incorrect 126 ms 10224 KB not a zalsequence
5 Incorrect 120 ms 10212 KB not a zalsequence
6 Incorrect 121 ms 10192 KB not a zalsequence
# 결과 실행 시간 메모리 Grader output
1 Incorrect 125 ms 10184 KB Unexpected end of file - int32 expected
2 Incorrect 129 ms 10288 KB Unexpected end of file - int32 expected
3 Incorrect 134 ms 10180 KB Unexpected end of file - int32 expected
4 Incorrect 117 ms 10196 KB Unexpected end of file - int32 expected
5 Incorrect 123 ms 10256 KB Unexpected end of file - int32 expected
6 Incorrect 116 ms 10232 KB Unexpected end of file - int32 expected
7 Incorrect 122 ms 10216 KB Unexpected end of file - int32 expected
8 Incorrect 125 ms 10192 KB Unexpected end of file - int32 expected
9 Incorrect 97 ms 8236 KB Unexpected end of file - int32 expected
10 Incorrect 37 ms 3272 KB Unexpected end of file - int32 expected
11 Incorrect 58 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