#include <bits/stdc++.h>
using namespace std;
#define arr array
#define pii pair<int, int>
#define fir first
#define sec second
const int R = 1e5 + 5, C = 2 + 5, K = 1e5 + 5, INF = 1e9;
int r, c, k;
arr<arr<int, C>, R> vl;
arr<int, K> blnc;
int main() {
// freopen("bl.in", "r", stdin);
cin >> r >> c >> k; assert(c == 2);
for (int i = 1; i <= r; i++)
for (int j = 1; j <= c; j++)
cin >> vl[i][j];
for (int msk = 0; msk < (1 << r); msk++) {
fill(blnc.begin() + 1, blnc.begin() + k + 1, 0);
for (int i = 1; i <= r; i++) {
if (msk & (1 << (i - 1))) blnc[vl[i][1]]++, blnc[vl[i][2]]--;
else blnc[vl[i][1]]--, blnc[vl[i][2]]++;
}
bool hlt = false;
for (int i = 1; i <= k; i++)
if (abs(blnc[i]) >= 2) hlt = true;
if (hlt) continue;
for (int i = 1; i <= r; i++) {
if (msk & (1 << (i - 1))) cout << vl[i][1] << " " << vl[i][2] << endl;
else cout << vl[i][2] << " " << vl[i][1] << endl;
}
break;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Correct |
2 |
Runtime error |
1 ms |
488 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Correct |
2 |
Correct |
1 ms |
2396 KB |
Correct |
3 |
Correct |
1 ms |
2460 KB |
Correct |
4 |
Correct |
1 ms |
2396 KB |
Correct |
5 |
Correct |
1 ms |
2396 KB |
Correct |
6 |
Correct |
23 ms |
2396 KB |
Correct |
7 |
Correct |
1 ms |
2396 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
3412 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
3412 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Correct |
2 |
Correct |
1 ms |
2396 KB |
Correct |
3 |
Correct |
1 ms |
2460 KB |
Correct |
4 |
Correct |
1 ms |
2396 KB |
Correct |
5 |
Correct |
1 ms |
2396 KB |
Correct |
6 |
Correct |
23 ms |
2396 KB |
Correct |
7 |
Correct |
1 ms |
2396 KB |
Correct |
8 |
Incorrect |
36 ms |
3412 KB |
Unexpected end of file - int32 expected |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
3412 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
3412 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Correct |
2 |
Runtime error |
1 ms |
488 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |