Submission #81799

# Submission time Handle Problem Language Result Execution time Memory
81799 2018-10-26T17:05:11 Z Plurm Zalmoxis (BOI18_zalmoxis) C++11
30 / 100
320 ms 38344 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	vector<int> ans;
	stack<pair<int,int> > stk;
	for(int i = 0; i < n; i++){
		int cur;
		scanf("%d",&cur);
		ans.push_back(cur);
		while(!stk.empty() && cur == stk.top().second){
			cur++;
			stk.pop();
		}
		stk.emplace(i,cur);
	}
	int mindex = -1;
	int mn = 1e9;
	while(!stk.empty()){
		auto cur = stk.top();
		stk.pop();
		if(cur.second < mn){
			mn = cur.second;
			mindex = cur.first;
		}
	}
	ans.insert(ans.begin() + mindex + 1,mn);
	for(auto x : ans){
		printf("%d ",x);
	}
	return 0;
}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:5:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&k);
  ~~~~~^~~~~~~~~~~~~~
zalmoxis.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&cur);
   ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 212 ms 8580 KB Output is correct
2 Correct 221 ms 10648 KB Output is correct
3 Correct 221 ms 12752 KB Output is correct
4 Correct 249 ms 14744 KB Output is correct
5 Correct 235 ms 16972 KB Output is correct
6 Correct 204 ms 19040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 234 ms 21076 KB Unexpected end of file - int32 expected
2 Incorrect 227 ms 23116 KB Unexpected end of file - int32 expected
3 Incorrect 217 ms 25180 KB Unexpected end of file - int32 expected
4 Incorrect 226 ms 27248 KB Unexpected end of file - int32 expected
5 Incorrect 239 ms 29300 KB Unexpected end of file - int32 expected
6 Incorrect 216 ms 31268 KB Unexpected end of file - int32 expected
7 Incorrect 219 ms 33472 KB Unexpected end of file - int32 expected
8 Incorrect 320 ms 35600 KB Unexpected end of file - int32 expected
9 Incorrect 175 ms 38344 KB Unexpected end of file - int32 expected
10 Incorrect 67 ms 38344 KB Unexpected end of file - int32 expected
11 Incorrect 119 ms 38344 KB Unexpected end of file - int32 expected
12 Incorrect 2 ms 38344 KB Unexpected end of file - int32 expected
13 Incorrect 2 ms 38344 KB Unexpected end of file - int32 expected
14 Incorrect 2 ms 38344 KB Unexpected end of file - int32 expected