답안 #635991

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
635991 2022-08-27T13:55:49 Z ahmed_shafik 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
379 ms 15596 KB
#include <bits/stdc++.h>
#define ahmed_is_fast             \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define ll long long
#define ld long double
#define cc(n) cout << n << "\n"
#define ccc(n) cout << n << ' '
#define endl "\n"
#define all(v) v.begin(), v.end()
#define mx(a, b) a = max(a, b)
#define mn(a, b) a = min(a, b)
#define mem(a, b) memset(a, b, sizeof(a))
#define f(a) a.first
#define s(a) a.second
#define lcm(a, b) (a * b) / __gcd(a, b)
#define sp(x) setprecision(x)
using namespace std;
const ll mx=21;
void ahmed()
{
    ll n;
    cin>>n;
    ll x[n+9],y[n+9];
    map<ll,ll>mx,my;
    for(ll i=0; i<n; i++)
    {
        cin>>x[i]>>y[i];
        mx[x[i]]++;
        my[y[i]]++;    
    }
    ll ans=0;
    for(ll i=0; i<n; i++)
    {
        ans += (ll) (mx[x[i]] - 1) * (my[y[i]] - 1);
    }
    cout<<ans<<endl;
}
bool AHMED = false;
int main()
{
    ahmed_is_fast;
    ll t = 1;
    if (AHMED)
    {
        cin >> t;
    }
    while (t--)
    {
        ahmed();
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 1 ms 324 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 6 ms 1236 KB Output is correct
13 Correct 6 ms 1304 KB Output is correct
14 Correct 10 ms 1740 KB Output is correct
15 Correct 97 ms 7816 KB Output is correct
16 Correct 107 ms 8280 KB Output is correct
17 Correct 100 ms 7996 KB Output is correct
18 Correct 126 ms 7908 KB Output is correct
19 Correct 289 ms 14728 KB Output is correct
20 Correct 204 ms 11852 KB Output is correct
21 Correct 379 ms 15556 KB Output is correct
22 Correct 301 ms 15596 KB Output is correct