Submission #736872

#TimeUsernameProblemLanguageResultExecution timeMemory
736872onlk97Thousands Islands (IOI22_islands)C++17
10 / 100
60 ms49432 KiB
#include "islands.h" #include <variant> #include <vector> #include <bits/stdc++.h> using namespace std; vector <int> bruh[1010][1010]; std::variant<bool, std::vector<int>> find_journey(int N, int M, std::vector<int> U, std::vector<int> V) { if (N==2){ vector <int> a,b; for (int i=0; i<M; i++){ if (!U[i]) a.push_back(i); else b.push_back(i); } if (a.size()>=2&&b.size()){ vector <int> ans; ans.push_back(a[0]); ans.push_back(b[0]); ans.push_back(a[1]); ans.push_back(a[0]); ans.push_back(b[0]); ans.push_back(a[1]); return ans; } return false; } bool subtask2=(N<=400); bool subtask3=(N<=1000); if (N<=1000){ for (int i=0; i<M; i++){ bruh[U[i]][V[i]].push_back(i); } for (int i=0; i<N; i++){ for (int j=0; j<N; j++){ if (i==j) continue; if (bruh[i][j].size()!=1) subtask2=0; } } for (int i=0; i<N; i++){ for (int j=i+1; j<N; j++){ if (bruh[i][j].size()!=bruh[j][i].size()) subtask3=0; } } } if (subtask2){ vector <int> ans; ans.push_back(bruh[0][1][0]); ans.push_back(bruh[1][0][0]); ans.push_back(bruh[0][2][0]); ans.push_back(bruh[2][0][0]); ans.push_back(bruh[1][0][0]); ans.push_back(bruh[0][1][0]); ans.push_back(bruh[2][0][0]); ans.push_back(bruh[0][2][0]); return ans; } }

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:25:10: warning: variable 'subtask3' set but not used [-Wunused-but-set-variable]
   25 |     bool subtask3=(N<=1000);
      |          ^~~~~~~~
islands.cpp:55:1: warning: control reaches end of non-void function [-Wreturn-type]
   55 | }
      | ^
#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...