Submission #340856

# Submission time Handle Problem Language Result Execution time Memory
340856 2020-12-28T12:45:56 Z Edbert2397 Star triangles (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);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -