# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
603479 | 2022-07-24T07:27:51 Z | almothana05 | Stranded Far From Home (BOI22_island) | C++14 | 1000 ms | 26624 KB |
#include<bits/stdc++.h> #define mod 1000000007 using namespace std; queue<int>q; priority_queue<pair<int, int> >pri; vector<int>gr[200000]; int num[200000] , vis[200000]; int main(){ int menge , numm = 0, nummer , ed; cin >> menge >> ed; for(int i = 0 ;i < menge ; i++){ cin >> numm; num[i + 1] = numm; } for(int i = 0 ; i< ed ; i++){ cin >> numm >> nummer; gr[numm].push_back(nummer); gr[nummer].push_back(numm); } for(int i = 1 ; i <= menge ; i++){ int fl = 1; int cmp = 0; vis[i] = 1; q.push(i); while(q.size()){ int jet = q.front(); q.pop(); cmp += num[jet]; for(int i = 0 ; i < gr[jet].size() ; i++){ int kind = gr[jet][i]; pri.push({-num[kind] , kind }); } while(pri.size() && -pri.top().first <= cmp){ if(vis[pri.top().second] == 0){ vis[pri.top().second] = 1; q.push(pri.top().second); } pri.pop(); } } while(pri.size()){ pri.pop(); } for(int j = 1 ; j <=menge ; j++){ if(vis[j] == 0){ fl = 0; } vis[j] = 0; } cout << fl ; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4948 KB | Output is correct |
2 | Correct | 3 ms | 4912 KB | Output is correct |
3 | Correct | 3 ms | 5000 KB | Output is correct |
4 | Incorrect | 144 ms | 5088 KB | Output isn't correct |
5 | 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 | Runtime error | 235 ms | 26624 KB | Execution killed with signal 11 |
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 | 1067 ms | 16140 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 5004 KB | Output is correct |
2 | Execution timed out | 1060 ms | 16056 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 | Correct | 3 ms | 4912 KB | Output is correct |
3 | Correct | 3 ms | 5000 KB | Output is correct |
4 | Incorrect | 144 ms | 5088 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |