# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1159810 | YSH2020 | Specijacija (COCI20_specijacija) | C++20 | 508 ms | 1114112 KiB |
#include <bits/stdc++.h>
using namespace std;
int depth(int x) {
if ((int)(pow(8*x+1, 0.5)+1)/2 == (pow(8*x+1, 0.5)+1)/2) return (pow(8*x+1, 0.5)+1)/2-1;
else return (int)(pow(8*x+1, 0.5)+1)/2;
}
//time to deal with binary lifting :(
signed main() {
int n; cin >> n;
int q; cin >> q;
int t; cin >> t;
int a[n+1];
for (int i = 1; i < n+1; i++) {
int x; cin >> x;
a[i] = x-((i-1)*i)/2;
}
pair<int,int> par[n+2][n+2][15]; for (int i = 0; i < n+2; i++) for (int j = 0; j < n+2; j++) par[i][j][0] = {0,0};
for (int i = 2; i < n+2; i++) {
for (int j = 1; j <= i; j++) {
if (j > a[i-1]) par[i][j][0] = {i-1, j-1};
else par[i][j][0] = {i-1,j};
}
}
for (int i = 1; i < 15; i++) {
for (int j = 2; j < n+2; j++) {
for (int k = 1; k <= j; k++) {
par[j][k][i] = par[par[j][k][i-1].first][par[j][k][i-1].second][i-1];
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |