|
|
back to boardWhy this solution is wrong? #include <iostream> #include <vector> using namespace std; int M, N; int A[30001]; int B[30001]; vector < pair <int, int> > edges; int main() { cin >> M >> N; int K; cin >> K; for (int i = 0; i < K; i++) { int a, b; cin >> a >> b; edges.push_back(make_pair(a, b)); A[a]++; B[b]++; } int count = 0; for (int i = 0; i < edges.size(); i++) { if (A[edges[i].first] > 1 && B[edges[i].second] > 1) { count++; A[edges[i].first]--; B[edges[i].second]--; } } cout << K - count << endl; return 0; } |
|
|