# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601300 | 2022-07-21T15:53:12 Z | patrikpavic2 | Stranded Far From Home (BOI22_island) | C++17 | 1000 ms | 14252 KB |
#include <cstdio> #include <cstring> #include <algorithm> #include <vector> #include <set> #define X first #define Y second #define PB push_back using namespace std; typedef pair < int, int > pii; typedef vector < int > vi; typedef long long ll; const int N = 2e5 + 500; vector < int > v[N]; int vel[N], bio[N], n, m; set < pii > S; bool check(int x){ for(int i = 1;i <= n;i++) bio[i] = 0; S.clear(); ll sm = 0; S.insert({0, x}); bio[x] = 1; for(;(int)S.size() > 0 && S.begin() -> X <= sm;){ int y = S.begin() -> Y; S.erase(S.begin()); sm += vel[y]; for(int z : v[y]){ if(bio[z]) continue; bio[z] = 1; S.insert({vel[z], z}); } } for(int i = 1;i <= n;i++) if(!bio[i]) return 0; return 1; } int main(){ scanf("%d%d", &n, &m); for(int i = 1;i <= n;i++) scanf("%d", vel + i); for(int i = 0;i < m;i++){ int a, b; scanf("%d%d", &a, &b); v[a].PB(b), v[b].PB(a); } for(int i = 1;i <= n;i++) printf("%d", check(i)); printf("\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4948 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 2 ms | 4948 KB | Output is correct |
4 | Correct | 227 ms | 5076 KB | Output is correct |
5 | Correct | 199 ms | 5076 KB | Output is correct |
6 | Correct | 314 ms | 5076 KB | Output is correct |
7 | Correct | 197 ms | 5084 KB | Output is correct |
8 | Correct | 138 ms | 5056 KB | Output is correct |
9 | Incorrect | 332 ms | 5116 KB | Output isn't correct |
10 | 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 | Execution timed out | 1091 ms | 14252 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4948 KB | Output is correct |
2 | Execution timed out | 1091 ms | 12756 KB | Time limit exceeded |
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 | 1072 ms | 13140 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4948 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 2 ms | 4948 KB | Output is correct |
4 | Correct | 227 ms | 5076 KB | Output is correct |
5 | Correct | 199 ms | 5076 KB | Output is correct |
6 | Correct | 314 ms | 5076 KB | Output is correct |
7 | Correct | 197 ms | 5084 KB | Output is correct |
8 | Correct | 138 ms | 5056 KB | Output is correct |
9 | Incorrect | 332 ms | 5116 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |