# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
386399 | haojiandan | Meetings 2 (JOI21_meetings2) | C++14 | 705 ms | 38508 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
t=0; char ch=getchar(); int f=1;
while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=(2e5)+10;
int n,S,head[maxn],to[maxn*2],tot,nxt[maxn*2];
void add(int x,int y) {
tot++; nxt[tot]=head[x]; head[x]=tot; to[tot]=y;
}
int ans[maxn],N,vis[maxn];
void update(int &x,int y) {
if (x<y) x=y;
}
int sz[maxn],mxsz[maxn],rt;
void getrt(int u,int p) {
sz[u]=1,mxsz[u]=0;
for (int i=head[u],v;i;i=nxt[i]) {
v=to[i];
if (v==p||vis[v]) continue;
getrt(v,u);
sz[u]+=sz[v];
mxsz[u]=max(mxsz[u],sz[v]);
}
//if (u%1000==0) printf("%d %d %d\n",u,sz[u],rt);
mxsz[u]=max(mxsz[u],N-sz[u]);
if (rt==-1||mxsz[u]<mxsz[rt]) rt=u;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |