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