Submission #134148

# Submission time Handle Problem Language Result Execution time Memory
134148 2019-07-22T07:04:53 Z huisung Star triangles (IZhO11_triangle) C++14
100 / 100
711 ms 13320 KB
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=int(a);i<=int(b);i++)
#define ROF(i,a,b) for(int i=int(b);i>=int(a);i--)
#define pb push_back
#define pq priority_queue
#define ps push
using namespace std;
struct point{int x,y;};
int n;
point in[300010];
long long anw;
map<int,long long> sero,garo;
int main(){
    cin>>n;
    FOR(i,1,n){
        scanf("%d %d",&in[i].x,&in[i].y);
        if(sero.find(in[i].y)==sero.end()) sero[in[i].y]=1;
        else sero[in[i].y]++;
        if(garo.find(in[i].x)==garo.end()) garo[in[i].x]=1;
        else garo[in[i].x]++;
    }
    FOR(i,1,n) anw+=((garo[in[i].x]-1)*(sero[in[i].y]-1));
    cout<<anw;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d",&in[i].x,&in[i].y);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 11 ms 1144 KB Output is correct
13 Correct 11 ms 1272 KB Output is correct
14 Correct 18 ms 1656 KB Output is correct
15 Correct 199 ms 7276 KB Output is correct
16 Correct 219 ms 7548 KB Output is correct
17 Correct 215 ms 7292 KB Output is correct
18 Correct 192 ms 7160 KB Output is correct
19 Correct 669 ms 12752 KB Output is correct
20 Correct 396 ms 10232 KB Output is correct
21 Correct 711 ms 13320 KB Output is correct
22 Correct 610 ms 13304 KB Output is correct