Submission #1099873

#TimeUsernameProblemLanguageResultExecution timeMemory
1099873gygBrought Down the Grading Server? (CEOI23_balance)C++17
10 / 100
36 ms3412 KiB
#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; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...