Submission #61958

# Submission time Handle Problem Language Result Execution time Memory
61958 2018-07-27T06:31:25 Z 김현수(#2139) popa (BOI18_popa) C++11
100 / 100
126 ms 700 KB
#include<bits/stdc++.h>
#include"popa.h"
using namespace std;

int solve (int N, int *Left, int *Right) {
	for(int i=0;i<N;i++) {
		Left[i] = Right[i] = -1;
	}
	vector<int> S;
	S.push_back(0);
	for(int i=1;i<N;i++) {
		int T;
		while(!S.empty()) {
			T = S.back();
			if(query(T, T, T, i)) {
				Left[i] = Right[T];
				Right[T] = i;
				break;
			}
			else S.pop_back();
		}
		if(S.empty()) {
			Left[i] = T;
		}
		S.push_back(i);
	}
	return S[0];
}

Compilation message

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:23:12: warning: 'T' may be used uninitialized in this function [-Wmaybe-uninitialized]
    Left[i] = T;
    ~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 19 ms 376 KB Output is correct
2 Correct 14 ms 376 KB Output is correct
3 Correct 15 ms 540 KB Output is correct
4 Correct 12 ms 540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 540 KB Output is correct
2 Correct 86 ms 540 KB Output is correct
3 Correct 61 ms 540 KB Output is correct
4 Correct 106 ms 636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 85 ms 636 KB Output is correct
2 Correct 106 ms 692 KB Output is correct
3 Correct 91 ms 700 KB Output is correct
4 Correct 126 ms 700 KB Output is correct