#include <bits/stdc++.h>
#define int long long
using namespace std;
int N, S, T, A[22], B[22];
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>N>>S>>T;
for(int i=1; i<=N; i++) cin>>A[i]>>B[i];
for(int i=0; i<(1<<N); i++) {
int C[22]={0}, C2[22]={0};
for(int j=1; j<=N; j++) {
if(i&(1<<(j-1))) C[A[j]]++, C2[B[j]]++;
else C[B[j]]++, C2[A[j]]++;
}
bool flag=true;
for(int j=1; j<=T; j++) if(abs(C[j]-C2[j])>1) flag=false;
if(flag) {
for(int j=1; j<=N; j++) {
if(i&(1<<(j-1))) cout<<A[j]<<" "<<B[j]<<"\n";
else cout<<B[j]<<" "<<A[j]<<"\n";
}
break;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Correct |
2 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Correct |
2 |
Correct |
1 ms |
348 KB |
Correct |
3 |
Correct |
1 ms |
344 KB |
Correct |
4 |
Correct |
0 ms |
348 KB |
Correct |
5 |
Correct |
0 ms |
600 KB |
Correct |
6 |
Correct |
26 ms |
452 KB |
Correct |
7 |
Correct |
0 ms |
348 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Correct |
2 |
Correct |
1 ms |
348 KB |
Correct |
3 |
Correct |
1 ms |
344 KB |
Correct |
4 |
Correct |
0 ms |
348 KB |
Correct |
5 |
Correct |
0 ms |
600 KB |
Correct |
6 |
Correct |
26 ms |
452 KB |
Correct |
7 |
Correct |
0 ms |
348 KB |
Correct |
8 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Correct |
2 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |
3 |
Halted |
0 ms |
0 KB |
- |