Submission #870413

#TimeUsernameProblemLanguageResultExecution timeMemory
870413boris_7Star triangles (IZhO11_triangle)C++17
0 / 100
1 ms348 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...