Submission #171018

# Submission time Handle Problem Language Result Execution time Memory
171018 2019-12-27T05:23:02 Z beksultan04 Star triangles (IZhO11_triangle) C++14
100 / 100
912 ms 9592 KB
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define OK puts("OK");
#define sz(s) (int)s.size()
#define pii pair<int,int>
#define all(s) s.begin(), s.end()
#define allr(s) s.rbegin(), s.rend()
#define rep(i,n) for (i=0;i<(n);++i)
#define rep1(i,n) for (i=1;i<=(n);++i)
#define ret return
#define nemeshay ios::sync_with_stdio(0),cin.tie(0);
const int N=3e5+12,INF=1e9+7;
map <int,int> a,b;
int x[N],y[N];
main(){
    int i,ans=0,j,n;
    cin>>n;
    vector <pii> v;
    for (i=0;i<n;++i){
        cin>>x[i]>>y[i];
        a[x[i]]++;
        b[y[i]]++;
    }
    for (i=0;i<n;++i){
        ans+=(a[x[i]]-1)*(b[y[i]]-1);
    }
    cout <<ans;
}

Compilation message

triangle.cpp:19:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
triangle.cpp: In function 'int main()':
triangle.cpp:20:17: warning: unused variable 'j' [-Wunused-variable]
     int i,ans=0,j,n;
                 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 4 ms 376 KB Output is correct
12 Correct 19 ms 1068 KB Output is correct
13 Correct 22 ms 1016 KB Output is correct
14 Correct 28 ms 1400 KB Output is correct
15 Correct 305 ms 4216 KB Output is correct
16 Correct 325 ms 4344 KB Output is correct
17 Correct 304 ms 4184 KB Output is correct
18 Correct 298 ms 4216 KB Output is correct
19 Correct 824 ms 5880 KB Output is correct
20 Correct 600 ms 8952 KB Output is correct
21 Correct 912 ms 9464 KB Output is correct
22 Correct 871 ms 9592 KB Output is correct