#include <bits/stdc++.h>
#define f first
#define s second
#define fast_izho ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vec vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)(x).size()
#define pw(x) (1LL<<(x))
#define m_p make_pair
//#pragma GCC optimize ("unroll-loops")
using namespace std;
typedef long long ll;
typedef pair<long long,int> pli;
typedef pair<int,int> pii;
template <class T> bool umin(T &a,const T &b){return (a>b?a=b,1:0);}
template <class T> bool umax(T &a,const T &b){return (a<b?a=b,1:0);}
const int N=1e6+1;
vec<int> g[N];
int mt[N],used[N],tt=1;
bool try_kuhn(int v){
if(used[v]==tt) return 0;
used[v]=tt;
for(auto &z : g[v]){
if(mt[z]==-1){
mt[z]=v;return 1;
}
}
for(auto &z : g[v]){
if(try_kuhn(mt[z])){
mt[z]=v;return 1;
}
}
return 0;
}
signed main(){
fast_izho;
int n,m;
cin>>n>>m;
fill(mt,mt+n,-1);
for(int i=0;i<n;i++){
for(int j=m;j<n+m;j++){
if((i&j)==i)
g[i].pb(j-m);
}
}
for(int i=0;i<n;i++)
try_kuhn(i),tt++;
for(int i=0;i<n;i++)
cout<<mt[i]<<' '<<m+i<<'\n';
return 0;
}
/*
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
23756 KB |
Output is correct |
2 |
Correct |
14 ms |
23804 KB |
Output is correct |
3 |
Correct |
13 ms |
23764 KB |
Output is correct |
4 |
Execution timed out |
1091 ms |
190248 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
25804 KB |
Output is correct |
2 |
Correct |
11 ms |
23800 KB |
Output is correct |
3 |
Correct |
12 ms |
23808 KB |
Output is correct |
4 |
Correct |
15 ms |
23916 KB |
Output is correct |
5 |
Correct |
12 ms |
23884 KB |
Output is correct |
6 |
Execution timed out |
1094 ms |
188724 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
23756 KB |
Output is correct |
2 |
Correct |
12 ms |
23756 KB |
Output is correct |
3 |
Correct |
12 ms |
23756 KB |
Output is correct |
4 |
Correct |
11 ms |
23756 KB |
Output is correct |
5 |
Correct |
11 ms |
23756 KB |
Output is correct |
6 |
Correct |
12 ms |
23884 KB |
Output is correct |
7 |
Correct |
12 ms |
23864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
23756 KB |
Output is correct |
2 |
Correct |
14 ms |
23804 KB |
Output is correct |
3 |
Correct |
13 ms |
23764 KB |
Output is correct |
4 |
Execution timed out |
1091 ms |
190248 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |