Submission #170744

# Submission time Handle Problem Language Result Execution time Memory
170744 2019-12-26T09:03:52 Z juggernaut Star triangles (IZhO11_triangle) C++14
100 / 100
778 ms 15728 KB
//Just try and the idea will come!
#include<bits/stdc++.h>
#define int long long int
using namespace std;
map<int,int>x,y;
int n,i,res;
pair<int,int>p[300001];
main(){
    scanf("%lld",&n);
    for(i=1;i<=n;i++){
        scanf("%lld%lld",&p[i].first,&p[i].second);
        x[p[i].first]++;
        y[p[i].second]++;
    }
    for(i=1;i<=n;i++)res+=(x[p[i].first]-1)*(y[p[i].second]-1);
    cout<<res;
}

Compilation message

triangle.cpp:8:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
triangle.cpp: In function 'int main()':
triangle.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&n);
     ~~~~~^~~~~~~~~~~
triangle.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld",&p[i].first,&p[i].second);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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 256 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 360 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 380 KB Output is correct
12 Correct 11 ms 1272 KB Output is correct
13 Correct 10 ms 1272 KB Output is correct
14 Correct 16 ms 1772 KB Output is correct
15 Correct 170 ms 8024 KB Output is correct
16 Correct 180 ms 8316 KB Output is correct
17 Correct 227 ms 7928 KB Output is correct
18 Correct 212 ms 8056 KB Output is correct
19 Correct 778 ms 14960 KB Output is correct
20 Correct 362 ms 12088 KB Output is correct
21 Correct 506 ms 15600 KB Output is correct
22 Correct 543 ms 15728 KB Output is correct