Submission #19124908


Source Code Expand

#include <bits/stdc++.h>
#define rep(i, N) for(int i = 0; i < (int)N; i++)
#define CREP(i, l, r) for(int i = l; i <= r; i++)
using namespace std;
typedef long long ll;
typedef tuple<int,int,int> T; 
typedef pair<int,int> P;
typedef vector<int> V;
typedef vector<int> Vll;
const int INF = 1000000000;      //10^9, 2*INF
const ll LLINF = (1LL << 60);   // > 10^18 ll  2*LLINF

int main() {
    int n;
    cin >> n;
    V a(n), b(n); rep(i, n) scanf("%d%d", &a[i],&b[i]);

    int ans = 0;
    rep(i,n) CREP(j,i+1,n-1){
        int dx = a[j]-a[i], dy = b[j] - b[i];

        if(dx == dy || dx == -dy) ans++;
        else{
            if(dy/dx == 0) ans++;
        }
    }

    printf("%d\n", ans);
}

Submission Info

Submission Time
Task B - Gentle Pairs
User samari06
Language C++ (GCC 9.2.1)
Score 200
Code Size 726 Byte
Status AC
Exec Time 11 ms
Memory 3800 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:16:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   16 |     V a(n), b(n); rep(i, n) scanf("%d%d", &a[i],&b[i]);
      |                             ~~~~~^~~~~~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 21
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 8 ms 3756 KiB
random_02.txt AC 2 ms 3748 KiB
random_03.txt AC 3 ms 3632 KiB
random_04.txt AC 3 ms 3728 KiB
random_05.txt AC 2 ms 3704 KiB
random_06.txt AC 4 ms 3692 KiB
random_07.txt AC 3 ms 3756 KiB
random_08.txt AC 2 ms 3664 KiB
random_09.txt AC 3 ms 3616 KiB
random_10.txt AC 2 ms 3652 KiB
random_11.txt AC 6 ms 3732 KiB
random_12.txt AC 6 ms 3668 KiB
random_13.txt AC 11 ms 3760 KiB
random_14.txt AC 5 ms 3620 KiB
random_15.txt AC 4 ms 3696 KiB
random_16.txt AC 6 ms 3800 KiB
random_17.txt AC 8 ms 3656 KiB
random_18.txt AC 9 ms 3688 KiB
sample_01.txt AC 2 ms 3704 KiB
sample_02.txt AC 2 ms 3652 KiB
sample_03.txt AC 3 ms 3784 KiB