Submission #443362

#TimeUsernameProblemLanguageResultExecution timeMemory
443362leinad2Keys (IOI21_keys)C++17
9 / 100
112 ms21492 KiB
#include "keys.h" #include<bits/stdc++.h> using namespace std; int par[210], chk[210]; int Find(int v){return v==par[v]?v:par[v]=Find(par[v]);} vector<int>find_reachable(vector<int>r, vector<int>u, vector<int>v, vector<int>c) { int n, i, j, k, m, a, b; n=r.size();m=c.size(); vector<int>ans; ans.resize(n); for(i=0;i<n;i++)par[i]=i; for(i=0;i<m;i++)par[Find(u[i])]=Find(v[i]); for(i=0;i<n;i++)chk[Find(i)]++; for(i=0;i<n;i++)if(r[i]==0)ans[i]=chk[Find(i)];else ans[i]=1; int x=1e9;for(i=0;i<n;i++)x=min(x, ans[i]); for(i=0;i<n;i++)ans[i]=(ans[i]==x); return ans; }

Compilation message (stderr)

keys.cpp: In function 'std::vector<int> find_reachable(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
keys.cpp:8:15: warning: unused variable 'j' [-Wunused-variable]
    8 |     int n, i, j, k, m, a, b;
      |               ^
keys.cpp:8:18: warning: unused variable 'k' [-Wunused-variable]
    8 |     int n, i, j, k, m, a, b;
      |                  ^
keys.cpp:8:24: warning: unused variable 'a' [-Wunused-variable]
    8 |     int n, i, j, k, m, a, b;
      |                        ^
keys.cpp:8:27: warning: unused variable 'b' [-Wunused-variable]
    8 |     int n, i, j, k, m, a, b;
      |                           ^
#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...