Submission #228230

#TimeUsernameProblemLanguageResultExecution timeMemory
228230VEGAnnTeoretičar (COCI18_teoreticar)C++14
26 / 130
69 ms26488 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; 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...