답안 #68732

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
68732 2018-08-18T09:56:52 Z 검수컵(#1978, imsifile) 박스런 (FXCUP3_box) C++
17 / 100
1000 ms 23556 KB
#include<stdio.h>
#include<set>
using namespace std;

int N, ba[505050];
multiset<int> pv, cu;

int mx(multiset<int> &m){
	if(m.empty()) return -1;
	multiset<int>::iterator it = m.end(); it--;
	return *it;
}

int main(){
	scanf("%d", &N);
	for(int i=0; i<N; i++) scanf("%d", &ba[i]);
	pv.insert(ba[0]), cu.insert(ba[1]);
	int sz=1;
	for(int i=1; i<N; i++){
		while(mx(pv) < mx(cu)){
			printf("%d ", i-sz+1);
			sz++;
			if(i<sz) break;
			pv.insert(ba[i-sz]);
			cu.insert(ba[i+1-sz]);
		}
		if(i>=sz) pv.erase(pv.find(ba[i-sz])), cu.erase(cu.find(ba[i+1-sz]));
		pv.insert(ba[i]), cu.insert(ba[i+1]);
	}
	for(; sz<=N; sz++) printf("-1 ");
	return 0;
}

Compilation message

box.cpp: In function 'int main()':
box.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
box.cpp:16:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0; i<N; i++) scanf("%d", &ba[i]);
                         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 520 KB Output is correct
4 Correct 2 ms 520 KB Output is correct
5 Correct 2 ms 520 KB Output is correct
6 Correct 2 ms 520 KB Output is correct
7 Correct 2 ms 520 KB Output is correct
8 Correct 2 ms 520 KB Output is correct
9 Correct 2 ms 548 KB Output is correct
10 Correct 2 ms 548 KB Output is correct
11 Correct 2 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 520 KB Output is correct
4 Correct 2 ms 520 KB Output is correct
5 Correct 2 ms 520 KB Output is correct
6 Correct 2 ms 520 KB Output is correct
7 Correct 2 ms 520 KB Output is correct
8 Correct 2 ms 520 KB Output is correct
9 Correct 2 ms 548 KB Output is correct
10 Correct 2 ms 548 KB Output is correct
11 Correct 2 ms 620 KB Output is correct
12 Correct 3 ms 640 KB Output is correct
13 Correct 6 ms 764 KB Output is correct
14 Correct 100 ms 3100 KB Output is correct
15 Correct 208 ms 6540 KB Output is correct
16 Correct 342 ms 9644 KB Output is correct
17 Execution timed out 1065 ms 23556 KB Time limit exceeded
18 Halted 0 ms 0 KB -