Submission #38149

#TimeUsernameProblemLanguageResultExecution timeMemory
3814914kgStar triangles (IZhO11_triangle)C++11
100 / 100
679 ms6552 KiB
#include <stdio.h> #include <map> using namespace std; int n; pair<int, int> in[300001]; map<int, int> X, Y; int main() { long long cnt = 0, t1, t2; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d %d", &in[i].first, &in[i].second); X[in[i].first]++, Y[in[i].second]++; } for (int i = 1; i <= n; i++) { t1 = X[in[i].first] - 1, t2 = Y[in[i].second] - 1; cnt += t1*t2; } printf("%d", cnt); }

Compilation message (stderr)

triangle.cpp: In function 'int main()':
triangle.cpp:21:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
  printf("%d", cnt);
                  ^
triangle.cpp:12:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
triangle.cpp:14:46: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &in[i].first, &in[i].second);
                                              ^
#Verdict Execution timeMemoryGrader output
Fetching results...