# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1079144 | NourWael | Thousands Islands (IOI22_islands) | C++17 | 77 ms | 11476 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "islands.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
int const mxN = 1e3+5;
vector<pair<int,int>> adj[mxN], adj2[mxN];
int n,m, cnt[mxN][mxN];
bool vis[mxN], poss[mxN];
vector<int> from[mxN];
void dfs ( int i ) {
for(auto it:adj[i]) {
if(it.first==0 || vis[it.first]) continue;
vis[it.first] = 1;
dfs(it.first);
}
}
variant<bool,vector<int>> find_journey( int N, int M,vector<int> U, vector<int> V) {
n = N, m = M;
for(int i=0; i<m; i++) { adj[U[i]].push_back({V[i],i}), adj2[V[i]].push_back({U[i],i}); cnt[U[i]][V[i]]++; }
for(auto it:adj[0]) {
memset(vis,0,sizeof vis);
vis[it.first] = 1; dfs(it.first);
for(int i=1; i<n; i++) {
if(vis[i]) from[i].push_back(it.first);
}
}
bool f = 0;
for(int i=1; i<n; i++) if(from[i].size()>1) f = 1;
for(int i=1; i<n; i++) if(cnt[0][i]>1 ) f = 1;
vector<int> v;
if(adj[0].size()>1) return v;
else return false;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |