# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
675105 | vjudge1 | Uzastopni (COCI15_uzastopni) | C++17 | 63 ms | 65536 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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 1e4 + 5;
int n, a[maxn], p[maxn];
vector <int> adj[maxn];
bool f[maxn][105][105];
vector <int> vt;
bool cmp(int i, int j) {
return a[i] < a[j];
}
void DFS1(int u) {
vt.push_back(u);
for(int v : adj[u]) {
if(v == p[u]) continue;
p[v] = u;
DFS1(v);
}
}
void solve() {
for(int id = int(vt.size() - 1); id >= 0; --id) {
int u = vt[id];
int d = lower_bound(adj[u].begin(), adj[u].end(), u, cmp) - adj[u].begin();
f[u][a[u]][a[u]] = 1;
for(int i = d - 1; i >= 0; --i) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |