답안 #61959

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
61959 2018-07-27T06:32:02 Z khsoo01 popa (BOI18_popa) C++11
100 / 100
141 ms 704 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;
    ~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 376 KB Output is correct
2 Correct 25 ms 376 KB Output is correct
3 Correct 12 ms 376 KB Output is correct
4 Correct 13 ms 440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 636 KB Output is correct
2 Correct 141 ms 636 KB Output is correct
3 Correct 84 ms 636 KB Output is correct
4 Correct 99 ms 696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 114 ms 696 KB Output is correct
2 Correct 127 ms 696 KB Output is correct
3 Correct 119 ms 696 KB Output is correct
4 Correct 61 ms 704 KB Output is correct