# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
578224 | 2022-06-16T08:42:39 Z | kingfran1907 | Stranded Far From Home (BOI22_island) | C++14 | 332 ms | 468 KB |
#include <bits/stdc++.h> using namespace std; typedef long long llint; const int maxn = 2010; int n, m; int niz[maxn]; vector< int > graph[maxn]; bool bio[maxn]; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d", niz+i); for (int i = 0; i < m; i++) { int a, b; scanf("%d%d", &a, &b); graph[a].push_back(b); graph[b].push_back(a); } for (int i = 1; i <= n; i++) { llint sum = niz[i]; set< pair<int, int> > s; memset(bio, false, sizeof bio); bio[i] = true; for (int tren : graph[i]) { s.insert({niz[tren], tren}); } while (!s.empty()) { int x = s.begin()->second; int val = s.begin()->first; if (val > sum) break; s.erase(s.begin()); if (bio[x]) continue; bio[x] = true; sum += val; for (int tren : graph[x]) if (!bio[tren]) s.insert({niz[tren], tren}); } printf("%d", s.empty()); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 219 ms | 340 KB | Output is correct |
5 | Correct | 193 ms | 412 KB | Output is correct |
6 | Correct | 332 ms | 412 KB | Output is correct |
7 | Correct | 217 ms | 416 KB | Output is correct |
8 | Correct | 166 ms | 396 KB | Output is correct |
9 | Correct | 297 ms | 440 KB | Output is correct |
10 | Correct | 98 ms | 404 KB | Output is correct |
11 | Correct | 94 ms | 340 KB | Output is correct |
12 | Correct | 113 ms | 404 KB | Output is correct |
13 | Correct | 185 ms | 400 KB | Output is correct |
14 | Correct | 109 ms | 404 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Runtime error | 2 ms | 468 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 219 ms | 340 KB | Output is correct |
5 | Correct | 193 ms | 412 KB | Output is correct |
6 | Correct | 332 ms | 412 KB | Output is correct |
7 | Correct | 217 ms | 416 KB | Output is correct |
8 | Correct | 166 ms | 396 KB | Output is correct |
9 | Correct | 297 ms | 440 KB | Output is correct |
10 | Correct | 98 ms | 404 KB | Output is correct |
11 | Correct | 94 ms | 340 KB | Output is correct |
12 | Correct | 113 ms | 404 KB | Output is correct |
13 | Correct | 185 ms | 400 KB | Output is correct |
14 | Correct | 109 ms | 404 KB | Output is correct |
15 | Correct | 0 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 340 KB | Output is correct |
17 | Runtime error | 1 ms | 468 KB | Execution killed with signal 11 |
18 | Halted | 0 ms | 0 KB | - |