QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#447288#7625. PathRong7WA 4ms4028kbC++141.6kb2024-06-18 08:51:052024-06-18 08:51:05

Judging History

你现在查看的是最新测评结果

  • [2024-06-18 08:51:05]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:4028kb
  • [2024-06-18 08:51:05]
  • 提交

answer

// Not afraid to dark.

#include <bits/stdc++.h>
using namespace std;

clock_t start_time, end_time;
#define GET_START start_time = clock ();
#define GET_END end_time = clock (); fprintf (stderr, "TIME COSSEMED : %0.3lf\n", 1.0 * (end_time - start_time) / CLOCKS_PER_SEC);
#define inline __inline__ __attribute__ ((always_inline))

namespace io {
    int read_pos, read_dt; char read_char;
    inline int read (int &p = read_pos){
        p = 0, read_dt = 1; read_char = getchar ();
        while (! isdigit (read_char)){
            if (read_char == '-')
                read_dt = - 1;
            read_char = getchar ();
        }
        while (isdigit (read_char)){
            p = (p << 1) + (p << 3) + read_char - 48;
            read_char = getchar ();
        }
        return p = p * read_dt;
    }
    int write_sta[65], write_top;
    inline void write (int x){
        if (x < 0)
            putchar ('-'), x = - x;
        write_top = 0;
        do
            write_sta[write_top ++] = x % 10, x /= 10;
        while (x);
        while (write_top)
            putchar (write_sta[-- write_top] + 48);
    }
}

signed main (){
    GET_START

    int n, m;
    long long ans = 0;
    io::read (n), io::read (m);
    for (int i = 1, ls, u = 0;i <= n;++ i){
        ls = u;
        io::read (u);
        if (ls)
            ans += abs (ls - u);
    }
    for (int i = 1, ls, u = 0;i <= m;++ i){
        ls = u;
        io::read (u);
        if (ls)
            ans += abs (ls - u);
    }
    io::write (ans), puts ("");

    GET_END
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3956kb

input:

4 4
1 3 3 1
8 10 8 5

output:

11

result:

ok single line: '11'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

4 2
5 7 8 10
10 3

output:

12

result:

ok single line: '12'

Test #3:

score: -100
Wrong Answer
time: 4ms
memory: 4028kb

input:

100000 100000
18394 24233 357 52481 18043 49271 55052 81632 30068 16351 74661 71867 28721 46743 54031 18957 25470 94751 25746 62355 22561 5373 99009 49079 48551 48807 41085 90981 82649 23014 74376 54517 95181 9445 10083 85937 95809 31477 38527 68803 91671 55251 17894 43472 69255 20256 21718 38213 12...

output:

-1918325335

result:

wrong answer 1st lines differ - expected: '6671609257', found: '-1918325335'