This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4e5;
int deg[MAXN];
int sub[MAXN];
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n, m; cin >> n >> m;
n += m;
for (int i = 0; i < n-1; i++) {
int x, y; cin >> x >> y;
deg[x-1]++;
deg[y-1]++;
}
for (int i = 0; i < n; i++) {
sub[deg[i]]++;
}
int num = n;
for (int i = 1; i < n; i++) {
num -= sub[i];
if (num) cout << i << " " << num << "\n";
}
}
# | 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... |