# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
68598 | aome | popa (BOI18_popa) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
// int a[N], L[N], R[N];
int par[N];
// int get(int l, int r) {
// int gcd = 0;
// for (int i = l; i <= r; ++i) gcd = __gcd(gcd, a[i]);
// return gcd;
// }
// int query(int a, int b, int c, int d) {
// return get(a, b) == get(c, d);
// }
int solve(int n, int* L, int* R) {
memset(par, -1, sizeof par);
L[0] = R[0] = -1;
for (int i = 1; i < n; ++i) {
int cur = i - 1;
L[i] = R[i] = -1;
while (1) {
if (query(cur, i, i, i)) {
if (par[cur] == -1) {
par[cur] = i, L[i] = cur; break;
}