Submission #628337

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6283372022-08-13 10:29:29haojiandanThousands Islands (IOI22_islands)C++17
34 / 100
55 ms12108 KiB
#include "islands.h"
#include <bits/stdc++.h>
using namespace std;
#define MP make_pair
const int maxn=(1e5)+10;
int n,m; vector<int> bk[maxn];
int out[maxn],q[maxn],hd,tl;
bool del[maxn];
vector<int> ans,vec,res;
vector<pair<int,int> > g[maxn];
int to[maxn];
int d[maxn],t1,e[maxn],t2;
int pos[maxn],vis[maxn],To[maxn];
int D[maxn],E[maxn];
int at[maxn*2];
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++) bk[V[i]].push_back(U[i]),g[U[i]].push_back(MP(V[i],i)),out[U[i]]++;
int x=0;
for (int i=0;i<n;i++) if (!out[i]) q[++tl]=i,del[i]=1; hd=1;
while (hd<=tl||out[x]==1) {
while (hd<=tl) {
int x=q[hd]; hd++;
for (int &y : bk[x]) { out[y]--; if (!out[y]) q[++tl]=y,del[y]=1; }
}
if (out[0]==0) return false;
while (out[x]==1) {
del[x]=1;
for (int &y : bk[x]) { out[y]--; if (!out[y]) q[++tl]=y,del[y]=1; }
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:21:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   21 |     for (int i=0;i<n;i++) if (!out[i]) q[++tl]=i,del[i]=1; hd=1;
      |     ^~~
islands.cpp:21:60: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   21 |     for (int i=0;i<n;i++) if (!out[i]) q[++tl]=i,del[i]=1; hd=1;
      |                                                            ^~
islands.cpp:44:8: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
   44 |  int l,r;
      |        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...