답안 #944508

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
944508 2024-03-12T20:32:58 Z sondos225 별들과 삼각형 (IZhO11_triangle) C++17
0 / 100
2 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define yes "YES"
#define no "NO"
#define bigg INT_MAX
#define debug(x) cout<<(#x)<<" = " <<x<<endl;
#define all(x) x.begin(),x.end()
#define sz size()
#define nn '\n'
#define mms(x,y) memset(x,y,sizeof(x))
#define forr(i,j,n) for (int i=j; i<n; i++)
#define forn(i,j,n) for (int i=j; i>n; i--)
#define fi first
#define se second
#define la "LA"
#define cinn(x,y) for(int i=0; i<y; i++) cin>>x[i];
#define pii pair<int,int>
signed main()
{
    #ifndef LOCAL
    freopen("lifeguards.in","r",stdin);
    freopen("lifeguards.out","w", stdout);
    #endif
    fast
    int n;
    cin>>n;
    pii a[n];
    map<int,int> mx;
    map<int,int> my;
    forr(i,0,n)
    {
        cin>>a[i].fi >>a[i].se;
        mx[a[i].fi]++;
        my[a[i].se]++;
    }
    int ans=0;
    forr(i,0,n)
    {
        ans+=((mx[a[i].fi]-1)*(my[a[i].se]));
       // cin>>a[i].fi >>a[i].se;
       // ++;
       // ++;
    }
    cout<<ans/2;
    return 0;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:24:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     freopen("lifeguards.in","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
triangle.cpp:25:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |     freopen("lifeguards.out","w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -