# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
578216 | 2022-06-16T08:35:04 Z | kingfran1907 | Stranded Far From Home (BOI22_island) | C++14 | 3 ms | 468 KB |
#include <bits/stdc++.h> using namespace std; 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++) { int 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()); 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Incorrect | 3 ms | 340 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Runtime error | 2 ms | 468 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Runtime error | 2 ms | 468 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Runtime error | 2 ms | 468 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Incorrect | 3 ms | 340 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |