답안 #92897

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
92897 2019-01-05T13:44:46 Z Pajaraja popa (BOI18_popa) C++17
0 / 100
2 ms 504 KB
#include <bits/stdc++.h>
#include "popa.h"
#define MAXN 1007
using namespace std;
int ls[MAXN],rs[MAXN],dm[MAXN];
int rek(int lt,int rt)
{
	if(lt>rt) return -1;
	int l;
	for(int i=lt;i<=rt;i++) {if(dm[i]<=lt) l=i; break;}
	ls[l]=rek(lt,l-1);
	rs[l]=rek(l+1,rt);
	return l;
}
int solve(int N,int* Left,int* Right)
{
	stack<int> st; st.push(-1);	
	for(int i=0;i<N;i++)
	{
		while(st.empty()>1 && !query(st.top(),st.top(),st.top(),i)) st.pop();
		dm[i]=st.top()+1;
	}
	int a=rek(0,N-1);
	for(int i=0;i<N;i++) Left[i]=ls[i];
	for(int i=0;i<N;i++) Right[i]=rs[i];
	return a;
}

Compilation message

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:20:19: warning: comparison of constant '1' with boolean expression is always false [-Wbool-compare]
   while(st.empty()>1 && !query(st.top(),st.top(),st.top(),i)) st.pop();
         ~~~~~~~~~~^~
popa.cpp: In function 'int rek(int, int)':
popa.cpp:12:7: warning: 'l' may be used uninitialized in this function [-Wmaybe-uninitialized]
  rs[l]=rek(l+1,rt);
  ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 500 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -