# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
123241 | 2019-06-30T16:06:00 Z | miguel | Valley (BOI19_valley) | C++14 | 817 ms | 262148 KB |
#pragma GCC optimize("Ofast") #include<bits/stdc++.h> using namespace std; #define rc(x) return cout<<x<<endl,0 #define pb push_back #define dbg(x) cout << #x << '=' << x << '\n'; #define ll long long #define sz size() #define x first #define y second #define pi pair <int, int> #define pii pair <pi, int> #define vi vector <int> const ll mod = 1000000007; //#define int ll int n, s, q, e; vector<int> d; int f[100001], l[100001]; pi road[100001]; bitset<100001> sh; vector <pi> g[100001]; void dfs(int p, int cur){ d.pb(cur); for(pi i: g[cur]){ if(i.x!=p) dfs(cur, i.x); } d.pb(cur); } int32_t main(){ ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cin>>n>>s>>q>>e; for(int i=1; i<=n; i++){ int x, y, z; cin>>x>>y>>z; road[i]={x, y}; g[x].pb({y, z}); g[y].pb({x, z}); } for(int i=1; i<=s; i++){ int x; cin>>x; sh[x]=1; } if(s==n){ dfs(0, e); for(int i=0; i<d.size(); i++){ l[d[i]]=i; if(!f[i]) f[d[i]]=i; } for(int i=1; i<=q; i++){ int rd, r; cin>>rd>>r; int x=road[rd].x, y=road[rd].y; if(f[x]<=f[r] && l[x]>=l[r] && f[y]<=f[r] && l[y]>=l[r]) cout<<0<<"\n"; else cout<<"escaped"; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2680 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2680 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 817 ms | 262148 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 2680 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |