Submission #152594

# Submission time Handle Problem Language Result Execution time Memory
152594 2019-09-08T14:07:47 Z beso123 Star triangles (IZhO11_triangle) C++14
100 / 100
1024 ms 18600 KB
#include <bits/stdc++.h>
#define int  long long
#define pii pair<int,int>
#define x first
#define y second
using namespace std;
int n,ans;
map <int,int> x,y;
vector <pii> v;
main(){
cin>>n;
for(int k=1;k<=n;k++){
    int a,b;
    cin>>a>>b;
    x[a]++;
    y[b]++;
    v.push_back(make_pair(a,b));
}
for(int k=0;k<v.size();k++){
   int a=v[k].x,b=v[k].y;
   int p1=x[a]-1,p2=y[b]-1;

   ans+=(p1*p2);
}
cout<<ans;
return 0;
}

Compilation message

triangle.cpp:10:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
triangle.cpp: In function 'int main()':
triangle.cpp:19:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for(int k=0;k<v.size();k++){
             ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 252 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 256 KB Output is correct
7 Correct 2 ms 504 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 380 KB Output is correct
11 Correct 4 ms 380 KB Output is correct
12 Correct 20 ms 1272 KB Output is correct
13 Correct 23 ms 1272 KB Output is correct
14 Correct 30 ms 1908 KB Output is correct
15 Correct 327 ms 8136 KB Output is correct
16 Correct 365 ms 8308 KB Output is correct
17 Correct 325 ms 7940 KB Output is correct
18 Correct 326 ms 7908 KB Output is correct
19 Correct 943 ms 18548 KB Output is correct
20 Correct 658 ms 11868 KB Output is correct
21 Correct 975 ms 18600 KB Output is correct
22 Correct 1024 ms 18588 KB Output is correct