Submission #671664

#TimeUsernameProblemLanguageResultExecution timeMemory
671664ReLiceStar triangles (IZhO11_triangle)C++14
100 / 100
305 ms12668 KiB
#include<bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long #define ld long double #define pb push_back #define sz size() #define fr first #define sc second //#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);} void start(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } const ll mod=998244353; const ll inf=1e18; const ll N=1e5+10; void solve(){ ll n,i,mx=-1,mn=inf,x,y; cin>>n; vector <pair<ll,ll>> v; map<ll,ll> mpx,mpy; for(i=0;i<n;i++){ cin>>x>>y; mpx[x]++; mpy[y]++; v.pb({x,y}); } ll ans=0; for(auto i : v){ ans+=((mpx[i.fr]-1)*(mpy[i.sc]-1)); } cout<<ans<<endl; } signed main(){ // fre("divide"); start(); ll t=1; //cin>>t; while(t--) solve(); }

Compilation message (stderr)

triangle.cpp: In function 'void solve()':
triangle.cpp:21:12: warning: unused variable 'mx' [-Wunused-variable]
   21 |     ll n,i,mx=-1,mn=inf,x,y;
      |            ^~
triangle.cpp:21:18: warning: unused variable 'mn' [-Wunused-variable]
   21 |     ll n,i,mx=-1,mn=inf,x,y;
      |                  ^~
triangle.cpp: In function 'void fre(std::string)':
triangle.cpp:11:27: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
      |                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
triangle.cpp:11:64: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
      |                                                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...