# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
70161 |
2018-08-22T12:06:24 Z |
octopuses |
popa (BOI18_popa) |
C++17 |
|
165 ms |
596 KB |
#include <bits/stdc++.h>
#include "popa.h"
#pragma GCC optimize("O3")
using namespace std;
#define ll int
#define pb push_back
#define fr first
#define sc second
#define MAX ((ll)(1e12+100))
#define MX ((ll)(1e6+100))
#define ARRS ((ll)(2e6+100))
#define HS ((ll)(233))
#define MOD ((ll)(1e9+7))
#define EP ((double)(1e-9))
#define LG 21
#define mul(a,b) a=((a)*(b))%MOD
using namespace std;
int l[1020], r[1020];
int n, now;
void root()
{
int p = now - 1;
int rt = now;
now ++;
while(now < n && query(p, now, p, p))
{
if(query(rt, now, now, now))
{
l[now] = rt;
rt = now;
now ++;
} else
root();
}
r[p] = rt;
}
int solve(int NN, int* L, int* R)
{
n = NN;
for(int i = 0; i < n; ++ i)
l[i] = r[i] = -1;
int rt = 0;
now = 1;
while(now < n)
{
if(query(rt, now, now, now))
{
l[now] = rt;
rt = now;
now ++;
continue;
}
root();
}
for(int i = 0; i < n; ++ i)
L[i] = l[i], R[i] = r[i];
return rt;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
248 KB |
Output is correct |
2 |
Correct |
16 ms |
436 KB |
Output is correct |
3 |
Correct |
22 ms |
436 KB |
Output is correct |
4 |
Correct |
12 ms |
436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
480 KB |
Output is correct |
2 |
Correct |
66 ms |
492 KB |
Output is correct |
3 |
Correct |
58 ms |
492 KB |
Output is correct |
4 |
Correct |
165 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
596 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |