Submission #1370518
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef double db; typedef long long ll; typedef long double ld; typedef pair<int,int> pa; typedef unsigned int uint; typedef unsigned long long ull; #define w1 first #define ls (x<<1) #define w2 second #define rs (x<<1|1) #define mp make_pair #define pb push_back #define mid ((l+r)>>1) #define SZ(x) (int((x).size())) #define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++) #define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--) #define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)]) #define Rep2(p,x) for(int (p)=cur[(x)];(p);(p)=nxt[(p)]) template<class T>void read(T&num){ num=0;T f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar(); num*=f; } const int maxn=3e3+5; int n,tot; int head[maxn],des[maxn<<1],nxt[maxn<<1]; int win[maxn],a[maxn]; void adde(int x,int y){ des[++tot]=y;nxt[tot]=head[x];head[x]=tot; } void dfs(int x,int fa){ win[x]=0; Rep(p,x)if(des[p]!=fa&&a[des[p]]<a[x]&&!win[des[p]])win[x]=1; } int main(){ read(n); rep(i,1,n)read(a[i]); rep(i,1,n-1){ int x,y;read(x);read(y); adde(x,y);adde(y,x); } rep(i,1,n){ dfs(i,0); if(win[i])printf("%d ",i); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Tree Game |
User | Vegetable |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1321 Byte |
Status | WA |
Exec Time | 2 ms |
Memory | 384 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 2 ms | 384 KB |
in10.txt | WA | 2 ms | 384 KB |
in11.txt | WA | 2 ms | 384 KB |
in12.txt | WA | 1 ms | 256 KB |
in13.txt | WA | 1 ms | 256 KB |
in14.txt | WA | 2 ms | 384 KB |
in15.txt | WA | 2 ms | 384 KB |
in16.txt | WA | 2 ms | 384 KB |
in17.txt | WA | 2 ms | 384 KB |
in18.txt | WA | 2 ms | 384 KB |
in19.txt | WA | 2 ms | 384 KB |
in2.txt | WA | 2 ms | 384 KB |
in20.txt | WA | 2 ms | 384 KB |
in21.txt | WA | 2 ms | 384 KB |
in22.txt | WA | 2 ms | 384 KB |
in23.txt | WA | 2 ms | 384 KB |
in24.txt | WA | 2 ms | 384 KB |
in25.txt | WA | 2 ms | 384 KB |
in26.txt | WA | 2 ms | 384 KB |
in27.txt | WA | 2 ms | 384 KB |
in28.txt | WA | 2 ms | 384 KB |
in29.txt | WA | 2 ms | 384 KB |
in3.txt | WA | 2 ms | 384 KB |
in30.txt | WA | 2 ms | 384 KB |
in31.txt | WA | 2 ms | 384 KB |
in32.txt | WA | 2 ms | 384 KB |
in33.txt | WA | 2 ms | 384 KB |
in34.txt | WA | 2 ms | 384 KB |
in35.txt | WA | 2 ms | 384 KB |
in36.txt | AC | 1 ms | 256 KB |
in37.txt | AC | 1 ms | 256 KB |
in38.txt | AC | 1 ms | 256 KB |
in39.txt | AC | 1 ms | 256 KB |
in4.txt | WA | 2 ms | 384 KB |
in40.txt | AC | 2 ms | 384 KB |
in41.txt | AC | 2 ms | 384 KB |
in42.txt | AC | 2 ms | 384 KB |
in43.txt | AC | 2 ms | 384 KB |
in44.txt | AC | 2 ms | 384 KB |
in45.txt | AC | 2 ms | 256 KB |
in46.txt | AC | 2 ms | 256 KB |
in47.txt | WA | 2 ms | 384 KB |
in48.txt | WA | 2 ms | 384 KB |
in49.txt | WA | 2 ms | 384 KB |
in5.txt | WA | 2 ms | 384 KB |
in50.txt | WA | 2 ms | 384 KB |
in6.txt | WA | 2 ms | 384 KB |
in7.txt | WA | 2 ms | 384 KB |
in8.txt | WA | 2 ms | 384 KB |
in9.txt | WA | 2 ms | 384 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |