# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
116969 | tmwilliamlin168 | City (JOI17_city) | C++14 | 596 ms | 56272 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 "Encoder.h"
#include <bits/stdc++.h>
using namespace std;
const int mxN=2.5e5, B=1<<8;
vector<int> adj[mxN];
int s[mxN], dt1, dt2;
int encrange(int a, int b) {
return b*(b-1)/2+a;
}
void dfs2(int u) {
int ds=dt2++;
for(int v : adj[u])
dfs2(v);
Code(u, 1<<26|dt1<<15|encrange(ds, dt2));
}
void dfs1(int u=0, int p=-1, int d=0) {
int ds=dt1;
s[u]=1;
if(~p)
adj[u].erase(find(adj[u].begin(), adj[u].end(), p));
for(int v : adj[u]) {
dfs1(v, u, d+1);
s[u]+=s[v];
}
if(u&&s[u]<B)
return;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |