Submission #228231

#TimeUsernameProblemLanguageResultExecution timeMemory
228231VEGAnnTeoretičar (COCI18_teoreticar)C++14
13 / 130
17 ms896 KiB
#include <bits/stdc++.h> #define pii pair<int,int> #define ft first #define sd second #define MP make_pair #define sz(x) ((int)x.size()) using namespace std; typedef long long ll; const int N = 5010; int col[N], l, r, mrk[2][N][N], m, ans = 0; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> l >> r >> m; assert(l <= 100 && r <= 100); for (int i = 0; i < m; i++){ int x, y; cin >> x >> y; x--; y--; for (int c = 0; ; c++) if (!mrk[0][x][c] && !mrk[1][y][c]){ col[i] = c; ans = max(ans, c); mrk[0][x][c] = mrk[1][y][c] = 1; break; } } cout << ans + 1 << '\n'; for (int i = 0; i < m; i++) cout << col[i] + 1 << '\n'; return 0; }
#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...