제출 #256959

#제출 시각아이디문제언어결과실행 시간메모리
256959mohamedsobhi777Teoretičar (COCI18_teoreticar)C++14
13 / 130
1123 ms262148 KiB
#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 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...