Submission #870413

# Submission time Handle Problem Language Result Execution time Memory
870413 2023-11-07T21:21:44 Z boris_7 Star triangles (IZhO11_triangle) C++17
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

void solve(){
    freopen ("triangles.in","r",stdin);
    freopen ("triangles.out","w",stdout);

    int n;
    cin>>n;
    map<ll,ll>x,y;
    for(int i = 0;i<n;i++){
        int a,b;
        cin>>a>>b;
        x[a]++;
        y[b]++;
    }
    ll ans = 0;
    for(pair<ll,ll> i :x){
        for(pair<ll,ll>j:y){
            ans+=(i.second-1)*(j.second-1);
        }
    }
    cout<<ans<<endl;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    // int t;cin>>t;while(t--)
        solve();
}/*
Yes
Yes
No
Yes
Yes
No
*/

Compilation message

triangle.cpp: In function 'void solve()':
triangle.cpp:7:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen ("triangles.in","r",stdin);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
triangle.cpp:8:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     freopen ("triangles.out","w",stdout);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -