Submission #728570

#TimeUsernameProblemLanguageResultExecution timeMemory
728570groguThousands Islands (IOI22_islands)C++17
3.50 / 100
34 ms4440 KiB
#include "islands.h" #include <iostream> #include <vector> #include <variant> #define dbg(x) cerr<<#x<<": "<<x<<endl #define ll int #define pll pair<ll,ll> #define pb push_back using namespace std; #define maxn 405 ll n,m; vector<ll> g[maxn]; ll id[maxn][maxn]; variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { n = N; m = M; for(ll &x : U) x++; for(ll &x : V) x++; if(n==2){ vector<vector<ll> > cnt(3); for(ll i = 0;i<m;i++){ ll x = U[i],y = V[i]; cnt[x].pb(i); } bool ok = cnt[1].size()>=2&&cnt[2].size()>=1; if(!ok) return ok; ll x = cnt[1][0],y = cnt[1][1]; ll w = cnt[2][0],t = cnt[2][1]; vector<ll> ans; ans.pb(x); ans.pb(w); ans.pb(y); ans.pb(t); ans.pb(w); ans.pb(x); ans.pb(t); ans.pb(y); return ans; } return n!=2; for(ll i = 0;i<m;i++){ ll x = U[i],y = V[i]; g[x].pb(y); g[y].pb(x); id[x][y] = i; } }

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:23:25: warning: unused variable 'y' [-Wunused-variable]
   23 |             ll x = U[i],y = V[i];
      |                         ^
#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...