이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |