답안 #340856

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
340856 2020-12-28T12:45:56 Z Edbert2397 별들과 삼각형 (IZhO11_triangle) C++14
0 / 100
4 ms 364 KB
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
#define pii pair<int,int>
const int N = 3e5 + 5;
const int INF = 1e9;
const ll mod = 1e9+7;
int x[N],y[N];
map<int,int>row,col;
int n;
int main(){
    ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    cout.tie(NULL);
    freopen("triangles.in","r",stdin);
    freopen("triangles.out","w",stdout);
    cin>>n;
    for(int i = 1;i<=n;i++){
        cin>>x[i]>>y[i];
        row[x[i]]++;
        col[y[i]]++;
    }
    ll ans = 0;
    for(int i = 1;i<=n;i++){
        ans += (1LL * (row[x[i]]-1) * (col[y[i]]-1));
    }
    cout<<ans<<endl;
}

Compilation message

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