Submission #671103

# Submission time Handle Problem Language Result Execution time Memory
671103 2022-12-12T03:11:13 Z gavgav Star triangles (IZhO11_triangle) C++17
100 / 100
272 ms 12160 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

struct point{
    int x, y;
};
int main(){
    int pointsNumber; scanf("%d", &pointsNumber);

    point points[pointsNumber];
    map <int, int> pointsInRow, pointsInColumn;
    for (int i = 0; i < pointsNumber; ++i){
        scanf("%d%d", &(points[i].x), &(points[i].y));
        ++pointsInRow[points[i].y];
        ++pointsInColumn[points[i].x];
    }

    ll trianglesNumber = 0;
    for (int i = 0; i < pointsNumber; ++i){
        trianglesNumber += (pointsInColumn[points[i].x] - 1) * (pointsInRow[points[i].y] - 1);
    }

    printf("%lld", trianglesNumber);
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:9:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     int pointsNumber; scanf("%d", &pointsNumber);
      |                       ~~~~~^~~~~~~~~~~~~~~~~~~~~
triangle.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%d%d", &(points[i].x), &(points[i].y));
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 7 ms 980 KB Output is correct
13 Correct 6 ms 956 KB Output is correct
14 Correct 9 ms 1336 KB Output is correct
15 Correct 93 ms 6116 KB Output is correct
16 Correct 100 ms 6424 KB Output is correct
17 Correct 94 ms 6032 KB Output is correct
18 Correct 93 ms 6048 KB Output is correct
19 Correct 253 ms 11512 KB Output is correct
20 Correct 181 ms 9164 KB Output is correct
21 Correct 270 ms 12160 KB Output is correct
22 Correct 272 ms 12108 KB Output is correct