# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
292710 | 2020-09-07T12:08:12 Z | 반딧불(#5810) | Express 20/19 (ROI19_express) | C++17 | 265 ms | 28432 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int t; int n, m, q, p; vector<pair<int, ll> > link[500002]; set<int> st[5002]; int main(){ scanf("%d", &t); while(t--){ scanf("%d %d %d %d", &n, &m, &q, &p); for(int i=1; i<=n; i++) link[i].clear(); for(int i=1; i<=m; i++){ int x, y; ll d; scanf("%d %d %lld", &x, &y, &d); if(d > 5000) continue; link[x].push_back({y, d}); } for(int i=1; i<=n; i++) st[i].clear(); st[1].insert(0); for(int i=1; i<=n; i++){ for(auto nxt: link[i]){ for(auto v: st[i]){ if(v + nxt.second <= 5000) st[nxt.first].insert(v + nxt.second); } } } string s; for(int i=1; i<=q; i++){ int f; ll r; scanf("%d %lld", &f, &r); auto it = st[f].lower_bound(r); if(it == st[f].end()){ s.push_back('0'); continue; } if(*it * (p-1) <= r * p) s.push_back('1'); else s.push_back('0'); } cout << s << endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 12288 KB | Output is correct |
2 | Correct | 8 ms | 12288 KB | Output is correct |
3 | Correct | 9 ms | 12288 KB | Output is correct |
4 | Correct | 8 ms | 12288 KB | Output is correct |
5 | Incorrect | 16 ms | 12288 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 12288 KB | Output is correct |
2 | Correct | 9 ms | 12288 KB | Output is correct |
3 | Correct | 8 ms | 12288 KB | Output is correct |
4 | Correct | 10 ms | 12416 KB | Output is correct |
5 | Correct | 9 ms | 12288 KB | Output is correct |
6 | Correct | 9 ms | 12288 KB | Output is correct |
7 | Correct | 8 ms | 12288 KB | Output is correct |
8 | Correct | 9 ms | 12288 KB | Output is correct |
9 | Correct | 8 ms | 12288 KB | Output is correct |
10 | Correct | 13 ms | 12544 KB | Output is correct |
11 | Correct | 36 ms | 14968 KB | Output is correct |
12 | Correct | 13 ms | 12672 KB | Output is correct |
13 | Correct | 102 ms | 28432 KB | Output is correct |
14 | Correct | 13 ms | 12288 KB | Output is correct |
15 | Correct | 13 ms | 12288 KB | Output is correct |
16 | Correct | 13 ms | 12288 KB | Output is correct |
17 | Correct | 15 ms | 12416 KB | Output is correct |
18 | Correct | 12 ms | 12288 KB | Output is correct |
19 | Correct | 18 ms | 12544 KB | Output is correct |
20 | Correct | 12 ms | 12288 KB | Output is correct |
21 | Correct | 15 ms | 12416 KB | Output is correct |
22 | Correct | 13 ms | 12928 KB | Output is correct |
23 | Correct | 15 ms | 13312 KB | Output is correct |
24 | Correct | 21 ms | 12672 KB | Output is correct |
25 | Correct | 21 ms | 12672 KB | Output is correct |
26 | Correct | 40 ms | 13176 KB | Output is correct |
27 | Correct | 27 ms | 13568 KB | Output is correct |
28 | Correct | 11 ms | 12288 KB | Output is correct |
29 | Correct | 11 ms | 12288 KB | Output is correct |
30 | Correct | 11 ms | 12288 KB | Output is correct |
31 | Correct | 11 ms | 12416 KB | Output is correct |
32 | Correct | 10 ms | 12416 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 12288 KB | Output is correct |
2 | Runtime error | 265 ms | 24952 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 12288 KB | Output is correct |
2 | Runtime error | 265 ms | 24952 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 12288 KB | Output is correct |
2 | Correct | 8 ms | 12288 KB | Output is correct |
3 | Correct | 9 ms | 12288 KB | Output is correct |
4 | Correct | 11 ms | 12288 KB | Output is correct |
5 | Correct | 9 ms | 12320 KB | Output is correct |
6 | Correct | 9 ms | 12288 KB | Output is correct |
7 | Correct | 9 ms | 12288 KB | Output is correct |
8 | Incorrect | 9 ms | 12416 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 12288 KB | Output is correct |
2 | Correct | 8 ms | 12288 KB | Output is correct |
3 | Correct | 9 ms | 12288 KB | Output is correct |
4 | Correct | 11 ms | 12288 KB | Output is correct |
5 | Correct | 9 ms | 12320 KB | Output is correct |
6 | Correct | 9 ms | 12288 KB | Output is correct |
7 | Correct | 9 ms | 12288 KB | Output is correct |
8 | Incorrect | 9 ms | 12416 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 12288 KB | Output is correct |
2 | Correct | 8 ms | 12288 KB | Output is correct |
3 | Correct | 9 ms | 12288 KB | Output is correct |
4 | Correct | 8 ms | 12288 KB | Output is correct |
5 | Incorrect | 16 ms | 12288 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |