Submission #63016

# Submission time Handle Problem Language Result Execution time Memory
63016 2018-07-31T09:52:38 Z hamzqq9 Zalmoxis (BOI18_zalmoxis) C++14
5 / 100
294 ms 11496 KB
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define sz(x) (x.size())
#define orta ((bas+son)>>1)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 1000500000
#define MOD 1000000007
#define N 305
#define LOG 20
using namespace std;

int n,k,x;
stack<int> s;
vector<int> ans;

int main() {

//	freopen("input.txt","r",stdin);

	scanf("%d %d",&n,&k);

	for(int i=1;i<=n;i++) {

		scanf("%d",&x);

		while(sz(s) && s.top()<x) {

			int val=s.top();

			ans.pb(val);

			while(sz(s) && s.top()==val) {

				s.pop();

				val++;

			}

			s.push(val);

		}

		int tut=x;

		while(sz(s) && s.top()==tut) {

			s.pop();

			tut++;

		}

		s.push(tut);

		ans.pb(x);

	}

	while(sz(ans)<k) {

		int val=s.top();
		s.pop();

		ans.pb(val);

		s.push(val+1);

	}

	for(auto x:ans) printf("%d ",x);

}

Compilation message

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:71:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(sz(ans)<k) {
               ^
zalmoxis.cpp:31: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:35:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
   ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 211 ms 6492 KB Unexpected end of file - int32 expected
2 Incorrect 222 ms 6516 KB Unexpected end of file - int32 expected
3 Incorrect 238 ms 6712 KB Unexpected end of file - int32 expected
4 Incorrect 241 ms 6712 KB Unexpected end of file - int32 expected
5 Incorrect 215 ms 6712 KB Unexpected end of file - int32 expected
6 Incorrect 208 ms 6712 KB Unexpected end of file - int32 expected
# Verdict Execution time Memory Grader output
1 Incorrect 223 ms 6712 KB Unexpected end of file - int32 expected
2 Correct 234 ms 6716 KB Output is correct
3 Incorrect 294 ms 6716 KB Unexpected end of file - int32 expected
4 Incorrect 219 ms 6716 KB Unexpected end of file - int32 expected
5 Incorrect 210 ms 6724 KB Unexpected end of file - int32 expected
6 Incorrect 253 ms 6756 KB Unexpected end of file - int32 expected
7 Incorrect 212 ms 6952 KB Unexpected end of file - int32 expected
8 Incorrect 207 ms 6952 KB Unexpected end of file - int32 expected
9 Incorrect 216 ms 6952 KB Unexpected end of file - int32 expected
10 Incorrect 109 ms 6952 KB Unexpected end of file - int32 expected
11 Incorrect 135 ms 6952 KB Unexpected end of file - int32 expected
12 Incorrect 114 ms 11408 KB Unexpected end of file - int32 expected
13 Incorrect 144 ms 11496 KB Unexpected end of file - int32 expected
14 Incorrect 159 ms 11496 KB Unexpected end of file - int32 expected