Submission #1041487

# Submission time Handle Problem Language Result Execution time Memory
1041487 2024-08-02T04:44:12 Z 정민찬(#11002) Brought Down the Grading Server? (CEOI23_balance) C++17
10 / 100
30 ms 5724 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
    ios_base :: sync_with_stdio(false); cin.tie(NULL);
    ll N, S, T;
    cin >> N >> S >> T;
    vector<vector<ll>> a(N, vector<ll>(S));
    for (ll i=0; i<N; i++) {
        for (ll j=0; j<S; j++) {
            cin >> a[i][j];
        }
    }
    for (ll msk=0; msk<(1<<N); msk++) {
        bool flag = true;
        for (ll i=1; i<=T; i++) {
            ll fir = 0, sec = 0;
            for (ll j=0; j<N; j++) {
                if (msk & (1<<j)) {
                    if (a[j][0] == i) fir ++;
                    if (a[j][1] == i) sec ++;
                }
                else {
                    if (a[j][0] == i) sec ++;
                    if (a[j][1] == i) fir ++;
                }
            }
            if (abs(fir - sec) > 1) {
                flag = false;
                break;
            }
        }
        if (flag) {
            for (ll j=0; j<N; j++) {
                if (!(msk & (1<<j))) swap(a[j][0], a[j][1]);
                cout << a[j][0] << ' ' << a[j][1] << '\n';
            }
            return 0;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Correct
3 Correct 1 ms 348 KB Correct
4 Correct 0 ms 348 KB Correct
5 Correct 0 ms 348 KB Correct
6 Correct 30 ms 432 KB Correct
7 Correct 1 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 5724 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 5724 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct
2 Correct 0 ms 348 KB Correct
3 Correct 1 ms 348 KB Correct
4 Correct 0 ms 348 KB Correct
5 Correct 0 ms 348 KB Correct
6 Correct 30 ms 432 KB Correct
7 Correct 1 ms 344 KB Correct
8 Incorrect 18 ms 5724 KB Unexpected end of file - int32 expected
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 5724 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 5724 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -