Submission #964547

#TimeUsernameProblemLanguageResultExecution timeMemory
96454712345678Sob (COCI19_sob)C++17
39 / 110
5 ms2908 KiB
#include <bits/stdc++.h> using namespace std; const int nx=1e3+5; int n, m, vs[nx], pa[nx]; vector<int> d[nx]; bool solve(int u) { if (vs[u]) return 0; vs[u]=1; for (auto v:d[u]) if (pa[v]==-1||solve(pa[v])) return pa[v]=u, 1; return 0; } int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n>>m; for (int i=0; i<n; i++) for (int j=m; j<m+n; j++) if ((i&j)==i) d[i].push_back(j-m); for (int i=0; i<n; i++) pa[i]=-1; for (int i=0; i<n; i++) { for (int j=0; j<m; j++) vs[j]=0; solve(i); } for (int i=0; i<n; i++) cout<<pa[i]<<' '<<i+m<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...