#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 7;
int l , r , m;
set<int> v1[N], v2[N];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie() ;
//freopen("in.in", "r", stdin);
cin >> l >> r >> m;
for (int i = 1; i <= l; i++)
{
for (int j = 1; j <= m; j++)
{
v1[i].insert(j);
}
}
for (int i = 1; i <= r; i++)
{
for (int j = 1; j <= m; j++)
{
v2[i].insert(j);
}
}
set<int> ss;
vector<int> ans;
for (int i = 0; i < m; i++)
{
int u, v;
cin >> u >> v;
map<int, int> occ;
for (auto j : v1[u])
occ[j] = 1;
for (auto j : v2[v])
{
if (occ[j])
{
ans.push_back(j);
v1[u].erase(j);
v2[v].erase(j);
ss.insert(j);
break;
}
}
}
cout << (int)ss.size() << "\n";
for (auto u : ans)
cout << u << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
512 KB |
too many colors |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
768 KB |
Output is correct |
2 |
Correct |
4 ms |
1280 KB |
Output is correct |
3 |
Correct |
3 ms |
1280 KB |
Output is correct |
4 |
Correct |
2 ms |
768 KB |
Output is correct |
5 |
Correct |
2 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
93 ms |
50936 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
106 ms |
65260 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1074 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1080 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1103 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1123 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1088 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1080 ms |
262148 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |