Submission #52887201


Source Code Expand

Copy
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
std::pair<int, int> earr[100000], oarr[100000];
int main(int argc, char*argv[]){
int N;
int i,j, x, y, o=0, e=0;
int ans=0;
scanf("%d", &N);
for(i=0; i<N; i++){
scanf("%d%d", &x, &y);
if((x+y)%2){
oarr[o++] = {x, y};
}else{
earr[e++] = {x, y};
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>

std::pair<int, int> earr[100000], oarr[100000];

int main(int argc, char*argv[]){
    int N;
    int i,j, x, y, o=0, e=0;

    int ans=0;

    scanf("%d", &N);

    for(i=0; i<N; i++){
        scanf("%d%d", &x, &y);
        if((x+y)%2){
            oarr[o++] = {x, y};
        }else{
            earr[e++] = {x, y};
        }
    }

    for(i=0; i<o-1; i++){
        for(j=i+1; j<o; j++){
            ans+=std::max(abs(oarr[i].first-oarr[j].first), abs(oarr[i].second-oarr[j].second));
        }
    }

    for(i=0; i<e-1; i++){
        for(j=i+1; j<e; j++){
            ans+=std::max(abs(earr[i].first-earr[j].first), abs(earr[i].second-earr[j].second));
        }
    }

    printf("%d", ans);

    return 0;
}

Submission Info

Submission Time
Task E - Jump Distance Sum
User iluem100
Language C++ 20 (gcc 12.2)
Score 0
Code Size 826 Byte
Status RE
Exec Time 2211 ms
Memory 3080 KB

Compile Error

Main.cpp: In function ‘int main(int, char**)’:
Main.cpp:8:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
    8 | int main(int argc, char*argv[]){
      |          ~~~~^~~~
Main.cpp:8:25: warning: unused parameter ‘argv’ [-Wunused-parameter]
    8 | int main(int argc, char*argv[]){
      |                    ~~~~~^~~~~~
Main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |     scanf("%d", &N);
      |     ~~~~~^~~~~~~~~~
Main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |         scanf("%d%d", &x, &y);
      |         ~~~~~^~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 4
TLE × 10
RE × 13
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_00.txt, 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, random_19.txt
Case Name Status Exec Time Memory
example_00.txt AC 0 ms 1580 KB
example_01.txt AC 0 ms 1740 KB
hand_00.txt TLE 2207 ms 3044 KB
hand_01.txt AC 0 ms 1660 KB
hand_02.txt RE 95 ms 2292 KB
hand_03.txt RE 87 ms 2304 KB
hand_04.txt AC 0 ms 1592 KB
random_00.txt TLE 2207 ms 3064 KB
random_01.txt RE 111 ms 3044 KB
random_02.txt TLE 2211 ms 3048 KB
random_03.txt TLE 2207 ms 3068 KB
random_04.txt TLE 2207 ms 3080 KB
random_05.txt TLE 2207 ms 3064 KB
random_06.txt TLE 2211 ms 3080 KB
random_07.txt TLE 2207 ms 3080 KB
random_08.txt TLE 2207 ms 3072 KB
random_09.txt RE 111 ms 3072 KB
random_10.txt RE 110 ms 2984 KB
random_11.txt RE 109 ms 2928 KB
random_12.txt TLE 2210 ms 3072 KB
random_13.txt RE 113 ms 3076 KB
random_14.txt RE 92 ms 2296 KB
random_15.txt RE 92 ms 2292 KB
random_16.txt RE 92 ms 2144 KB
random_17.txt RE 92 ms 2364 KB
random_18.txt RE 93 ms 2148 KB
random_19.txt RE 92 ms 2228 KB


2025-03-18 (Tue)
08:01:24 +00:00