답안 #287706

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
287706 2020-08-31T22:40:33 Z luciocf popa (BOI18_popa) C++14
0 / 100
21 ms 504 KB
#include <bits/stdc++.h>
#include "popa.h"
 
using namespace std;
 
int solve(int N, int *l, int *r)
{
	memset(l, -1, sizeof l); memset(r, -1, sizeof r);

	int n = N;
 
	stack<int> stk;
 
	for (int i = 0; i < n; i++)
	{
		while (stk.size() && query(stk.top(), i, i, i))
		{
			l[i] = stk.top();
			stk.pop();
		}
 
		if (stk.size()) r[stk.top()] = i;
 
		stk.push(i);
	}
 
 	return stk.top();
}

Compilation message

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:8:16: warning: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
    8 |  memset(l, -1, sizeof l); memset(r, -1, sizeof r);
      |                ^~~~~~~~
popa.cpp:8:41: warning: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
    8 |  memset(l, -1, sizeof l); memset(r, -1, sizeof r);
      |                                         ^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB not a binary tree
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 376 KB not a binary tree
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 504 KB not a binary tree
2 Halted 0 ms 0 KB -