답안 #531748

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
531748 2022-03-01T11:26:27 Z MedalistSlayer 별들과 삼각형 (IZhO11_triangle) C++14
0 / 100
6 ms 332 KB
/*
    Does he have IGM on CF?
    -neko_nyaa
*/
#include <bits/stdc++.h>
using namespace std;
//constant
const int mod=1e9+7;
const long long mod2=998244353LL;
const long long inf=(long long)1e18;
 
//define
#define PB push_back
#define MP make_pair
#define pi acos(-1)
#define int long long
 
//typedef
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef set<int> SI;
typedef priority_queue<int> pqi;


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    freopen("triangles.in", "r", stdin);
    freopen("triangles.out", "w", stdout);
    int n;
    cin >> n;
    int x[n],y[n];
    map<int,int> x1,y1;
    for(int i=0;i<n;i++)
    {
        cin >> x[i] >> y[i];
        x1[x[i]]++;
        y1[y[i]]++;
    }
    int ans=0;
    for(int i=0;i<n;i++)
    {
        ans+=(x1[x[i]]-1)*(y1[y[i]]-1);
    }
    cout << ans << '\n';

    return 0;
}

Compilation message

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