Submission #171017

# Submission time Handle Problem Language Result Execution time Memory
171017 2019-12-27T05:22:34 Z beksultan04 Star triangles (IZhO11_triangle) C++14
0 / 100
474 ms 13432 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=2e5+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 468 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 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 1016 KB Output is correct
13 Correct 22 ms 1144 KB Output is correct
14 Correct 27 ms 1404 KB Output is correct
15 Correct 294 ms 6296 KB Output is correct
16 Correct 310 ms 6520 KB Output is correct
17 Correct 284 ms 6264 KB Output is correct
18 Correct 291 ms 6372 KB Output is correct
19 Runtime error 474 ms 13432 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Halted 0 ms 0 KB -