Submission #635143

# Submission time Handle Problem Language Result Execution time Memory
635143 2022-08-25T14:17:24 Z PanTkd Zalmoxis (BOI18_zalmoxis) C++14
0 / 100
126 ms 10320 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]<<' ';
	}
	cout<<endl;
	return ;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t=1;//cin>>t;
	while (t--) {
		solve();
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 121 ms 10188 KB not a zalsequence
2 Incorrect 115 ms 10228 KB not a zalsequence
3 Incorrect 123 ms 10204 KB not a zalsequence
4 Incorrect 121 ms 10208 KB not a zalsequence
5 Incorrect 122 ms 10204 KB not a zalsequence
6 Incorrect 119 ms 10320 KB not a zalsequence
# Verdict Execution time Memory Grader output
1 Incorrect 116 ms 10200 KB Unexpected end of file - int32 expected
2 Incorrect 113 ms 10196 KB Unexpected end of file - int32 expected
3 Incorrect 119 ms 10176 KB Unexpected end of file - int32 expected
4 Incorrect 115 ms 10184 KB Unexpected end of file - int32 expected
5 Incorrect 121 ms 10192 KB Unexpected end of file - int32 expected
6 Incorrect 115 ms 10204 KB Unexpected end of file - int32 expected
7 Incorrect 120 ms 10184 KB Unexpected end of file - int32 expected
8 Incorrect 126 ms 10316 KB Unexpected end of file - int32 expected
9 Incorrect 99 ms 8248 KB Unexpected end of file - int32 expected
10 Incorrect 36 ms 3184 KB Unexpected end of file - int32 expected
11 Incorrect 60 ms 5252 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