# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
61932 |
2018-07-27T05:46:31 Z |
alex(#2140) |
popa (BOI18_popa) |
C++11 |
|
0 ms |
0 KB |
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <iterator>
#include "popa.h"
using namespace std;
int query(int, int, int, int);
int chi[1010][2];
int f(int l, int r)
{
if(r < l)
return -1;
for(int i = l; i <= r; i++)
{
if(query(l, r, i, i))
{
chi[i][0] = f(l, i - 1);
chi[i][1] = f(i + 1, r);
return i;
}
}
assert(false);
}
int solve(int n, int *l, int *r)
{
int r = f(0, n - 1);
for(int i = 0; i < n; i++)
{
l[i] = chi[i][0];
r[i] = chi[i][1];
}
return r;
}
Compilation message
popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:46:9: error: declaration of 'int r' shadows a parameter
int r = f(0, n - 1);
^
popa.cpp:50:12: error: invalid types 'int[int]' for array subscript
r[i] = chi[i][1];
^