Submission #602323

# Submission time Handle Problem Language Result Execution time Memory
602323 2022-07-22T22:01:58 Z UncoolAnon Zalmoxis (BOI18_zalmoxis) C++14
5 / 100
180 ms 10440 KB
#include <bits/stdc++.h> 

#define pii pair<int,int> 
#define F first 
#define S second 
#define mp make_pair 

using namespace std; 
 

signed main(){
	ios_base::sync_with_stdio(0); 
	cin.tie(nullptr); 
	int n,k; 
	cin>>n>>k; 
	vector<int> a(n); 
	for(int&x:a) cin>>x; 
	int answer=(1<<30); 
	for(int&x:a) answer-=(1<<x); 
	vector<int> added,ones; 
	for(int i=0;i<30;i++)
		if((1<<i)&answer){
			added.push_back(i); 
		}

	while(added.size()+ones.size()<k){
		if(added.back()==0){
			added.pop_back(); 
			ones.push_back(0); 
		}
		else{
			int tmp=added.back(); 
			added.pop_back(); 
			added.push_back(tmp-1); 
			added.push_back(tmp-1); 
		}
	}
	vector<int> ans; 
	for(int&x:a) ans.push_back(x); 
	for(int&x:added) ans.push_back(x); 
	for(int&x:ones) ans.push_back(x); 
	sort(ans.begin(),ans.end()); 
	reverse(ans.begin(),ans.end()); 
	for(int&x:ans) cout << x << " " ; 
	return 0 ; 
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:26:32: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |  while(added.size()+ones.size()<k){
      |        ~~~~~~~~~~~~~~~~~~~~~~~~^~
# Verdict Execution time Memory Grader output
1 Incorrect 160 ms 10360 KB doesn't contain S as a subsequence
2 Incorrect 142 ms 10352 KB doesn't contain S as a subsequence
3 Incorrect 180 ms 10364 KB doesn't contain S as a subsequence
4 Incorrect 135 ms 10300 KB doesn't contain S as a subsequence
5 Incorrect 179 ms 10348 KB doesn't contain S as a subsequence
6 Incorrect 134 ms 10328 KB doesn't contain S as a subsequence
# Verdict Execution time Memory Grader output
1 Incorrect 136 ms 10372 KB doesn't contain S as a subsequence
2 Incorrect 142 ms 10332 KB doesn't contain S as a subsequence
3 Incorrect 137 ms 10360 KB doesn't contain S as a subsequence
4 Incorrect 161 ms 10324 KB doesn't contain S as a subsequence
5 Incorrect 134 ms 10300 KB doesn't contain S as a subsequence
6 Incorrect 140 ms 10324 KB doesn't contain S as a subsequence
7 Incorrect 130 ms 10388 KB doesn't contain S as a subsequence
8 Incorrect 146 ms 10392 KB doesn't contain S as a subsequence
9 Incorrect 125 ms 10292 KB doesn't contain S as a subsequence
10 Incorrect 110 ms 10304 KB doesn't contain S as a subsequence
11 Incorrect 111 ms 10336 KB doesn't contain S as a subsequence
12 Incorrect 86 ms 10312 KB doesn't contain S as a subsequence
13 Incorrect 96 ms 10440 KB doesn't contain S as a subsequence
14 Correct 88 ms 10312 KB Output is correct