# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25427 | 2017-06-22T06:38:13 Z | 김동현(#1064) | Synchronization (JOI13_synchronization) | C++14 | 169 ms | 21692 KB |
#include <bits/stdc++.h> using namespace std; struct E{ int x, i; }; struct Inf{ int t, x; bool operator<(const Inf &oth) const { return (t == oth.t) ? (x < oth.x) : (t > oth.t); } }; int n, m, q, ch[200010], c[100010]; vector<E> e[100010]; vector<int> tv[100010]; int f1(int x, int p, int t){ int ret = 1; for(auto &i : e[x]){ if(i.x == p) continue; int lt = (int)(upper_bound(tv[i.i].begin(), tv[i.i].end(), t) - tv[i.i].begin() - 1); if(lt < 0) continue; int nt; if(lt & 1) nt = tv[i.i][lt] - 1; else nt = t; ret += f1(i.x, x, nt); } return ret; } const int sz = 131072; struct Seg{ int mx[2 * sz], mn[2 * sz]; } S; int main(){ scanf("%d%d%d", &n, &m, &q); for(int i = 1, x, y; i <= n - 1; i++){ scanf("%d%d", &x, &y); e[x].push_back({y, i}); e[y].push_back({x, i}); } for(int i = 1; i <= m; i++){ scanf("%d", ch + i); tv[ch[i]].push_back(i); } if(q == 1){ scanf("%d", &q); printf("%d\n", f1(q, 0, m + 1)); } else{/* for(int i = 1; i <= m; i++){ c[ch[i]]++; if(c[ch[i]] ^ 1){ } else{ } } for(int x; q--; ){ scanf("%d", &x); printf("%d\n", S.ans(x)); }*/ puts("0"); return 0; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 9928 KB | Output is correct |
2 | Correct | 0 ms | 9928 KB | Output is correct |
3 | Correct | 0 ms | 9928 KB | Output is correct |
4 | Correct | 0 ms | 9928 KB | Output is correct |
5 | Correct | 0 ms | 9928 KB | Output is correct |
6 | Correct | 3 ms | 10060 KB | Output is correct |
7 | Correct | 9 ms | 10588 KB | Output is correct |
8 | Correct | 9 ms | 10588 KB | Output is correct |
9 | Correct | 6 ms | 10588 KB | Output is correct |
10 | Correct | 159 ms | 16396 KB | Output is correct |
11 | Correct | 169 ms | 16528 KB | Output is correct |
12 | Correct | 139 ms | 15868 KB | Output is correct |
13 | Correct | 126 ms | 16932 KB | Output is correct |
14 | Correct | 143 ms | 16792 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 69 ms | 20224 KB | Output is correct |
2 | Correct | 79 ms | 18724 KB | Output is correct |
3 | Correct | 83 ms | 21692 KB | Output is correct |
4 | Correct | 73 ms | 20876 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 9928 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 156 ms | 15868 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 9928 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |