QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#492506 | #7278. Brought Down the Grading Server? | shiomusubi496 | 10 | 39ms | 9300kb | C++14 | 1.3kb | 2024-07-26 12:56:40 | 2024-07-26 12:56:42 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)
#define all(v) begin(v), end(v)
using namespace std;
using ll = long long;
constexpr ll inf = 1e18;
template<class T, class U> bool chmin(T& a, const U& b) { return a > b ? a = b, true : false; }
template<class T, class U> bool chmax(T& a, const U& b) { return a < b ? a = b, true : false; }
int main() {
int N, S, T; cin >> N >> S >> T;
vector<vector<int>> A(N, vector<int>(S));
rep (i, N) rep (j, S) cin >> A[i][j], --A[i][j];
vector<int> B(T);
rep (i, N) rep (j, S) ++B[A[i][j]];
rep (bt, 1 << N) {
vector<int> cnt(T);
rep (i, N) {
if (bt >> i & 1) ++cnt[A[i][0]];
else ++cnt[A[i][1]];
}
bool ok = true;
rep (i, T) {
if (abs(cnt[i] * 2 - B[i]) > 1) ok = false;
}
if (ok) {
rep (i, N) {
if (bt >> i & 1) cout << A[i][0] + 1 << " " << A[i][1] + 1 << endl;
else cout << A[i][1] + 1 << " " << A[i][0] + 1 << endl;
}
return 0;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 3588kb
input:
3 2 3 1 2 2 3 2 3
output:
2 1 2 3 3 2
result:
ok
Test #2:
score: 10
Accepted
time: 1ms
memory: 3464kb
input:
20 2 20 18 2 12 5 20 9 4 2 17 4 7 15 9 2 5 5 13 15 19 5 3 5 10 19 8 5 7 10 9 11 3 16 7 18 9 5 3 8 18 4
output:
2 18 12 5 9 20 2 4 4 17 7 15 9 2 5 5 15 13 5 19 3 5 19 10 5 8 10 7 11 9 16 3 18 7 5 9 8 3 4 18
result:
ok
Test #3:
score: 10
Accepted
time: 0ms
memory: 3568kb
input:
20 2 12 12 11 1 9 12 12 3 4 3 9 8 3 8 11 10 9 4 3 6 7 11 6 11 3 7 10 12 10 11 10 11 11 11 2 1 12 6 12 2 7
output:
11 12 1 9 12 12 4 3 9 3 8 3 11 8 9 10 3 4 6 7 11 6 3 11 7 10 10 12 10 11 11 11 2 11 12 1 12 6 7 2
result:
ok
Test #4:
score: 10
Accepted
time: 1ms
memory: 3808kb
input:
20 2 8 7 7 7 8 6 4 7 4 6 2 4 6 1 3 2 3 8 3 6 7 1 5 6 3 2 5 1 4 2 2 6 2 6 3 2 5 5 3 3 3
output:
7 7 7 8 6 4 4 7 6 2 6 4 1 3 2 3 8 3 7 6 1 5 3 6 5 2 4 1 2 2 2 6 3 6 5 2 3 5 3 3
result:
ok
Test #5:
score: 10
Accepted
time: 0ms
memory: 3764kb
input:
12 2 20 13 1 4 14 14 13 17 1 8 15 14 5 3 7 20 6 1 9 19 11 6 20 11 13
output:
1 13 14 4 13 14 1 17 15 8 5 14 7 3 6 20 9 1 11 19 20 6 13 11
result:
ok
Test #6:
score: 10
Accepted
time: 19ms
memory: 3600kb
input:
20 2 19 2 15 16 8 1 11 15 18 7 17 19 7 14 2 3 10 12 5 14 10 8 5 17 11 16 11 3 13 12 9 4 17 1 6 6 4 13 19 18 5
output:
15 2 16 8 1 11 18 15 7 17 19 7 2 14 10 3 12 5 14 10 8 5 11 17 11 16 3 13 9 12 17 4 6 1 4 6 13 19 5 18
result:
ok
Test #7:
score: 10
Accepted
time: 1ms
memory: 3596kb
input:
18 2 18 12 15 7 18 12 13 9 14 8 5 5 3 4 1 10 9 17 7 4 2 10 14 16 6 1 2 16 11 3 8 15 13 17 18 11 6
output:
15 12 7 18 12 13 9 14 5 8 3 5 1 4 10 9 17 7 4 2 14 10 16 6 2 1 11 16 8 3 13 15 18 17 6 11
result:
ok
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 39ms
memory: 9300kb
input:
100000 2 100000 70318 14894 32116 90327 63866 29061 53683 63612 70370 78264 42647 76881 39251 31741 61186 66491 57686 65819 53278 59145 71962 26052 81040 55279 50859 51310 46800 24546 85013 91165 61530 21890 84003 29099 33573 86182 49212 10639 91851 97312 57682 14067 5243 69674 99007 62508 26290 555...
output:
result:
wrong output format Unexpected end of file - int32 expected
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%
Subtask #5:
score: 0
Wrong Answer
Test #56:
score: 0
Wrong Answer
time: 0ms
memory: 3524kb
input:
3 4 3 2 3 2 2 2 3 3 2 2 2 3 2
output:
result:
wrong output format Unexpected end of file - int32 expected
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #6:
0%
Subtask #8:
score: 0
Skipped
Dependency #2:
0%
Subtask #9:
score: 0
Skipped
Dependency #3:
0%
Subtask #10:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%