# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601484 | 2022-07-22T05:38:11 Z | 반딧불(#8472) | Stranded Far From Home (BOI22_island) | C++17 | 1000 ms | 524288 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, m; ll arr[200002]; ll sum[200002]; bool ans[200002]; vector<int> link[200002]; void dfs(int x, int p=-1){ sum[x] = arr[x]; for(auto y: link[x]){ if(y==p) continue; dfs(y, x); sum[x] += sum[y]; } if(p==-1 || arr[p] <= sum[x]) ans[x] = 1; } int main(){ scanf("%d %d", &n, &m); for(int i=1; i<=n; i++) scanf("%lld", &arr[i]); for(int i=1; i<=m; i++){ int x, y; scanf("%d %d", &x, &y); link[x].push_back(y); link[y].push_back(x); } dfs(1); for(int i=1; i<=n; i++) printf("%d", ans[i]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 239 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4948 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 137 ms | 20956 KB | Output is correct |
4 | Incorrect | 144 ms | 21080 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4948 KB | Output is correct |
2 | Incorrect | 174 ms | 30232 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4948 KB | Output is correct |
2 | Execution timed out | 1096 ms | 371708 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 239 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |