#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';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
2908 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |