Submission #639773

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6397732022-09-11 15:08:37studyThousands Islands (IOI22_islands)C++17
11.90 / 100
50 ms16392 KiB
#include <bits/stdc++.h>
#include "islands.h"
using namespace std;
const int N = 2e5;
vector<int> ans,to[N],canoe[N],prev_all;
deque<pair<int,int>> cycle,prev_cycle;
bitset<N> vu,vu3,path,prev_path,vu2;
bool impo = false, first_cycle = false;
int op1 = 0, op2 = 0, except = 0;
bool dfs2(int node){
if (path[node]){
op2 = node;
return true;
}
if (vu[node]) return false;
vu[node] = true;
path[node] = true;
for (int i=0; i<to[node].size(); ++i){
if (!vu3[canoe[node][i]] and (prev_path[canoe[node][i]] or dfs2(to[node][i]))){
if (prev_path[canoe[node][i]]){
op2 = canoe[node][i];
first_cycle = true;
}
else cycle.emplace_back(canoe[node][i],node);
return true;
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

islands.cpp: In function 'bool dfs2(int)':
islands.cpp:21:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for (int i=0; i<to[node].size(); ++i){
      |                ~^~~~~~~~~~~~~~~~
islands.cpp: In function 'bool dfs(int)':
islands.cpp:44:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |  for (int i=0; i<to[node].size(); ++i){
      |                ~^~~~~~~~~~~~~~~~
islands.cpp: In function 'void construct(int)':
islands.cpp:75:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |   for (int j=0; j<2*to[deb].size(); ++j){
      |                 ~^~~~~~~~~~~~~~~~~
#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...