Submission #72002

# Submission time Handle Problem Language Result Execution time Memory
72002 2018-08-26T04:35:24 Z ----------넘사벽----------(#2265, gs18113, jaeyong0201) Box Run (FXCUP3_box) C++11
100 / 100
180 ms 5564 KB
#include<bits/stdc++.h>
#define N 500005

using namespace std;
typedef pair<int, int> pp;

int h[N];

stack<pp> st;

int main(){
	int n, i;
	scanf("%d", &n);
	for(i=1;i<=n;i++) scanf("%d", h+i);
	st.push(pp(0, INT_MAX));
	int c=1;
	for(i=1;i<=n;i++){
		while(!st.empty()&&st.top().second<h[i]) st.pop();
		while(c<i-st.top().first){
			//printf("%d ", i);
			printf("%d ", i-c);
			c++;
		}
		st.push(pp(i, h[i]));
	}
	while(c<=n){printf("-1 ");c++;}
	printf("\n");
	return 0;
}

Compilation message

box.cpp: In function 'int main()':
box.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
box.cpp:14:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=1;i<=n;i++) scanf("%d", h+i);
                    ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 600 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 2 ms 600 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 3 ms 600 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 2 ms 600 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 2 ms 600 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 3 ms 600 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 3 ms 600 KB Output is correct
13 Correct 3 ms 620 KB Output is correct
14 Correct 15 ms 876 KB Output is correct
15 Correct 23 ms 1148 KB Output is correct
16 Correct 34 ms 1404 KB Output is correct
17 Correct 81 ms 2940 KB Output is correct
18 Correct 135 ms 3652 KB Output is correct
19 Correct 148 ms 4812 KB Output is correct
20 Correct 180 ms 5564 KB Output is correct
21 Correct 178 ms 5564 KB Output is correct