Submission #1864834
Source Code Expand
/////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// // _oo0oo_ // // o8888888o // // 88" . "88 ------ hzt1 // // (| -_- |) // // 0\ = /0 // // ___/`---'\___ // // .' \| |// '. // // / \||| : |||// \ // // / _||||| -:- |||||- \ // // | | \ - /// | | // // | \_| ''\---/'' |_/ | // // \ .-\__ '-' ___/-. / // // ___'. .' /--.--\ `. .'___ // // ."" '< `.___\_<|>_/___.' >' "". // // | | : `- \`.;`\ _ /`;.`/ - ` : | | // // \ \ `_. \_ __\ /__ _/ .-` / / // // =====`-.____`.___ \_____/___.-`___.-'===== // // `=---=' // // // // // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // // // God-He Bless All. // // This Code Will Never Explode. // // // // // /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// #include<cstdio> #include<cstring> #include<cctype> #include<algorithm> #include<vector> #define pb push_back #define mp make_pair #define xx first #define yy second #define rep(i,a,b) for(int i=(a),i##_end_=(b);i<=i##_end_;i++) #define dwn(i,a,b) for(int i=(a),i##_end_=(b);i>=i##_end_;i--) using namespace std; const int Size=1<<16; char buffer[Size],*head,*tail; inline char Getchar() { if(head==tail) { int l=fread(buffer,1,Size,stdin); tail=(head=buffer)+l; } if(head==tail) return -1; return *head++; } inline int read() { int x=0,f=1;char c=getchar(); for(;!isdigit(c);c=getchar()) if(c=='-') f=-1; for(;isdigit(c);c=getchar()) x=x*10+c-'0'; return x*f; } typedef long long ll; typedef pair<int,int> pii; const int maxn=3010; int n,A[maxn],first[maxn],nxt[maxn<<1],to[maxn<<1],e; void AddEdge(int v,int u) { to[++e]=v;nxt[e]=first[u];first[u]=e; to[++e]=u;nxt[e]=first[v];first[v]=e; } int work(int x) { int ok=1; for(int i=first[x];i;i=nxt[i]) if(A[to[i]]<A[x]&&(!work(to[i]))) return 1; return 0; } int main() { n=read(); rep(i,1,n) A[i]=read(); rep(i,1,n-1) AddEdge(read(),read()); rep(i,1,n) if(work(i)) printf("%d ",i); return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Tree Game |
User | wzj52501 |
Language | C++14 (GCC 5.4.1) |
Score | 1600 |
Code Size | 3080 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1600 / 1600 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in2.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in3.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in38.txt, in39.txt, in4.txt, in40.txt, in41.txt, in42.txt, in43.txt, in44.txt, in45.txt, in46.txt, in47.txt, in48.txt, in49.txt, in5.txt, in50.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 1 ms | 256 KB |
in10.txt | AC | 1 ms | 256 KB |
in11.txt | AC | 1 ms | 256 KB |
in12.txt | AC | 1 ms | 256 KB |
in13.txt | AC | 1 ms | 256 KB |
in14.txt | AC | 1 ms | 256 KB |
in15.txt | AC | 1 ms | 256 KB |
in16.txt | AC | 1 ms | 256 KB |
in17.txt | AC | 1 ms | 256 KB |
in18.txt | AC | 1 ms | 256 KB |
in19.txt | AC | 1 ms | 256 KB |
in2.txt | AC | 1 ms | 256 KB |
in20.txt | AC | 1 ms | 256 KB |
in21.txt | AC | 1 ms | 256 KB |
in22.txt | AC | 1 ms | 256 KB |
in23.txt | AC | 1 ms | 256 KB |
in24.txt | AC | 1 ms | 256 KB |
in25.txt | AC | 1 ms | 256 KB |
in26.txt | AC | 1 ms | 256 KB |
in27.txt | AC | 1 ms | 256 KB |
in28.txt | AC | 1 ms | 256 KB |
in29.txt | AC | 1 ms | 256 KB |
in3.txt | AC | 1 ms | 256 KB |
in30.txt | AC | 1 ms | 256 KB |
in31.txt | AC | 1 ms | 256 KB |
in32.txt | AC | 1 ms | 256 KB |
in33.txt | AC | 1 ms | 256 KB |
in34.txt | AC | 1 ms | 256 KB |
in35.txt | AC | 1 ms | 256 KB |
in36.txt | AC | 1 ms | 128 KB |
in37.txt | AC | 0 ms | 128 KB |
in38.txt | AC | 0 ms | 128 KB |
in39.txt | AC | 0 ms | 128 KB |
in4.txt | AC | 1 ms | 256 KB |
in40.txt | AC | 1 ms | 256 KB |
in41.txt | AC | 1 ms | 256 KB |
in42.txt | AC | 1 ms | 256 KB |
in43.txt | AC | 1 ms | 256 KB |
in44.txt | AC | 1 ms | 256 KB |
in45.txt | AC | 1 ms | 256 KB |
in46.txt | AC | 1 ms | 256 KB |
in47.txt | AC | 1 ms | 256 KB |
in48.txt | AC | 1 ms | 256 KB |
in49.txt | AC | 1 ms | 256 KB |
in5.txt | AC | 1 ms | 256 KB |
in50.txt | AC | 1 ms | 256 KB |
in6.txt | AC | 1 ms | 256 KB |
in7.txt | AC | 1 ms | 256 KB |
in8.txt | AC | 1 ms | 256 KB |
in9.txt | AC | 1 ms | 256 KB |
sample1.txt | AC | 1 ms | 128 KB |
sample2.txt | AC | 0 ms | 128 KB |
sample3.txt | AC | 0 ms | 128 KB |