Submission #340854

#TimeUsernameProblemLanguageResultExecution timeMemory
340854Edbert2397Star triangles (IZhO11_triangle)C++14
0 / 100
2 ms364 KiB
# 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 (stderr)

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);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...