#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, s, t;
cin >> n >> s >> t;
vector<int> tot(t);
vector<vector<int>> a(n, vector<int> (s));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < s; ++j) {
cin >> a[i][j];
--a[i][j];
tot[a[i][j]]++;
}
}
vector<vector<int>> cnt(s, vector<int> (t));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 2; ++j) {
int task = a[i][j];
if (cnt[j][task] + 1 > (tot[task] + 1) / 2) {
swap(a[i][0], a[i][1]);
break;
}
}
for (int j = 0; j < 2; ++j) {
int task = a[i][j];
cnt[j][task]++;
assert(cnt[j][task] <= (tot[task] + 1) / 2);
}
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < s; ++j) {
cout << a[i][j] + 1 << " \n"[j == s - 1];
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Incorrect |
0 ms |
348 KB |
maximum and minimum number of simultaneously evaluated submissions for any single task differ more than one |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
22 ms |
15132 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
22 ms |
15132 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Correct |
2 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
maximum and minimum number of simultaneously evaluated submissions for any single task differ more than one |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
maximum and minimum number of simultaneously evaluated submissions for any single task differ more than one |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
maximum and minimum number of simultaneously evaluated submissions for any single task differ more than one |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
22 ms |
15132 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
22 ms |
15132 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct |
2 |
Incorrect |
0 ms |
348 KB |
maximum and minimum number of simultaneously evaluated submissions for any single task differ more than one |
3 |
Halted |
0 ms |
0 KB |
- |