Submission #61921

# Submission time Handle Problem Language Result Execution time Memory
61921 2018-07-27T05:22:20 Z 김세빈(#1797) popa (BOI18_popa) C++11
100 / 100
114 ms 628 KB
#include "popa.h"

int S[1010];

int solve(int n, int* L, int* R)
{
	int i, j, k, s;
	
	s = 0;
	
	for(i=0; i<n; i++){
		L[i] = R[i] = -1;
		
		for(j=s; j && query(S[j], i, i, i); j--){
			if(j < s) R[S[j]] = S[j + 1];
			L[i] = S[j];
		}
		
		s = j + 1; S[s] = i;
	}
	
	for(i=1; i<s; i++) R[S[i]] = S[i + 1];
	
	return S[1];
}

Compilation message

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:7:12: warning: unused variable 'k' [-Wunused-variable]
  int i, j, k, s;
            ^
# Verdict Execution time Memory Grader output
1 Correct 16 ms 376 KB Output is correct
2 Correct 15 ms 440 KB Output is correct
3 Correct 12 ms 440 KB Output is correct
4 Correct 12 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 512 KB Output is correct
2 Correct 114 ms 512 KB Output is correct
3 Correct 68 ms 512 KB Output is correct
4 Correct 82 ms 624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 87 ms 628 KB Output is correct
2 Correct 57 ms 628 KB Output is correct
3 Correct 108 ms 628 KB Output is correct
4 Correct 74 ms 628 KB Output is correct