I - Футбольная форма

mail@pastecode.io avatar
unknown
c_cpp
a year ago
517 B
17
Indexable
Never
#include <bits/stdc++.h>

#define ll long long

using namespace std;

const int N = 1e5 + 7;

int main() {
    int n;
    cin >> n;
    int x[n], y[n];
    
    int home[N] = {}, away[N] = {};
    
    for (int i = 0; i < n; ++i) {
        cin >> x[i] >> y[i];
        home[x[i]]++;
        away[y[i]]++;
    }
    
    for (int i = 0; i < n; ++i) {
        int a = n - 1, b = 0;
     
        a += home[y[i]];
        b += n - 1 - home[y[i]];
        
        cout << a << ' ' << b << endl;
    }
    return 0; 
}