QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#19802#1804. Academic Distanceconqueror_of_zky#AC ✓3ms3716kbC++14422b2022-02-11 15:22:542022-05-06 07:09:50

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-06 07:09:50]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3716kb
  • [2022-02-11 15:22:54]
  • 提交

answer

#include <bits/stdc++.h>
//#define int long long
#define ll long long
#define db double
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>

using namespace std;
int n; 
int x[105],y[105]; 
int main() {
	cin>>n;
	ll ans=0; 
	for (int i=1;i<=n;i++) {
		cin>>x[i]>>y[i];
		if (i>=2) {
			ans+=abs(x[i]-x[i-1])+abs(y[i]-y[i-1]); 
		}
	}
	cout<<ans<<'\n'; 
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3644kb

input:

3
1 2
2 3
4 6

output:

7

result:

ok answer is '7'

Test #2:

score: 0
Accepted
time: 3ms
memory: 3644kb

input:

1
0 0

output:

0

result:

ok answer is '0'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3716kb

input:

4
-2 3
1 4
5 2
4 -2

output:

15

result:

ok answer is '15'

Test #4:

score: 0
Accepted
time: 3ms
memory: 3556kb

input:

22
-60 -41
-100 8
-8 -52
-62 -61
-76 -52
-52 14
-11 -2
-54 46
8 26
-17 -35
34 87
5 42
-44 66
-32 71
-31 9
-51 90
-62 86
-52 7
88 25
-14 -7
37 -55
98 64

output:

1909

result:

ok answer is '1909'

Test #5:

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

input:

55
34 -85
8 -18
34 64
93 -37
16 80
-70 -28
63 31
100 6
1 -95
11 -64
81 -99
-54 -82
-52 70
-70 -37
72 -75
-70 -62
-56 -59
90 83
32 -63
32 -21
25 -11
25 93
75 52
4 -87
91 -78
17 61
100 -50
-75 93
61 38
-62 39
97 -48
-35 2
12 -66
86 45
-19 7
67 -59
-3 42
19 -82
16 87
98 -82
2 -6
98 51
93 -31
-68 -58
36...

output:

7835

result:

ok answer is '7835'

Test #6:

score: 0
Accepted
time: 3ms
memory: 3448kb

input:

92
89 -47
62 41
-91 -75
92 -11
92 -40
11 12
-96 -72
38 97
30 -22
-57 61
77 40
-43 -39
-1 -33
54 -57
-12 79
56 -77
55 64
-81 45
-17 53
48 91
-85 -80
93 85
-3 -99
-60 86
73 91
-99 77
-89 -77
36 -17
-45 73
5 -52
36 -65
39 22
-9 24
13 -100
71 -6
95 -12
66 98
77 99
17 -84
-17 -12
46 -97
39 91
48 -94
-79 ...

output:

13731

result:

ok answer is '13731'

Test #7:

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

input:

37
-22 29
60 0
-83 -62
-44 100
82 -58
-94 -29
79 89
46 -91
-57 -49
84 -20
-50 40
-56 96
-95 75
-86 15
30 -41
29 -35
-65 35
33 61
55 96
73 59
2 -20
38 84
-40 7
-2 -36
-44 -84
92 58
-15 -72
54 -59
-53 50
-21 -7
7 80
-23 -73
-95 -6
15 -22
10 92
-58 34
14 -52

output:

5273

result:

ok answer is '5273'

Test #8:

score: 0
Accepted
time: 3ms
memory: 3648kb

input:

68
-98 27
-83 -87
-89 54
-33 62
91 -67
32 -96
75 96
72 -69
49 -18
-85 94
96 -62
-1 -95
10 15
32 91
12 28
-95 -45
9 -97
-50 80
46 -42
-40 0
20 20
-36 -80
-38 -30
-37 86
-71 -83
-48 27
-34 -47
-2 -43
18 -9
86 -26
3 17
52 -88
-91 -2
-33 -20
79 15
-8 -68
-27 -6
1 83
-90 84
58 43
-100 25
-47 -10
-16 -72
...

output:

9602

result:

ok answer is '9602'

Test #9:

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

input:

72
-56 38
48 50
63 7
-58 -99
59 62
-88 -68
-87 18
-64 -100
84 28
-54 -19
24 67
-82 94
-90 6
-8 55
-79 -77
97 29
47 -64
-4 -2
33 37
-19 -84
-84 -11
-28 -62
87 -82
28 -73
25 29
-65 77
73 61
100 -6
36 88
-82 -90
59 36
-63 -12
-75 95
87 94
48 -79
-97 80
86 60
2 -3
-29 -85
-42 -50
-39 -50
12 -27
88 59
-3...

output:

10402

result:

ok answer is '10402'

Test #10:

score: 0
Accepted
time: 3ms
memory: 3664kb

input:

49
-44 -59
48 37
-21 63
34 -56
12 12
55 -21
98 -43
-87 22
95 26
83 -15
26 -87
68 -64
-39 -68
0 39
43 -81
-23 80
-98 -25
53 -40
-11 -20
47 61
-8 -6
37 -73
1 -95
54 26
-35 -59
-61 13
-21 -37
-3 -24
-86 -10
6 92
-22 -17
-56 84
37 -17
-47 88
45 -19
-34 68
21 77
-52 -20
-27 31
10 51
62 27
20 -10
30 -87
-...

output:

6493

result:

ok answer is '6493'

Test #11:

score: 0
Accepted
time: 3ms
memory: 3712kb

input:

82
27 -47
-48 -25
1 80
-40 -33
-31 74
-77 -22
-32 -48
51 -43
-97 -39
76 -64
-18 47
10 44
-81 -84
-74 58
71 9
-12 -18
-41 -17
96 81
53 -51
22 73
-83 12
47 31
-84 -100
39 -5
69 99
82 75
98 47
-4 -57
-81 74
71 97
66 -23
-78 -75
32 -16
20 -24
-70 -5
-69 52
-14 -14
-80 46
-45 -41
14 15
-59 86
24 -25
35 -...

output:

11517

result:

ok answer is '11517'

Test #12:

score: 0
Accepted
time: 3ms
memory: 3588kb

input:

40
49 -49
33 10
-19 -69
86 -39
-81 23
16 -41
-87 -68
-38 69
31 50
20 -64
59 -96
48 -18
61 -24
-50 55
-56 -62
77 -88
23 -4
-60 57
-51 63
56 79
-9 51
83 98
-20 8
2 20
-92 91
97 -29
-56 -85
15 -4
-45 56
38 -22
30 28
-47 80
-25 -8
97 -85
31 57
43 -66
-8 59
-89 7
28 -9
42 42

output:

5252

result:

ok answer is '5252'

Test #13:

score: 0
Accepted
time: 2ms
memory: 3588kb

input:

93
25 -66
78 29
82 60
40 43
-93 51
47 -46
-52 22
95 16
16 10
-56 76
68 -78
-53 -33
3 -78
-4 97
97 -47
38 -84
-17 -67
-22 -39
-85 -73
1 -52
91 -72
-100 -38
-11 -76
-54 12
-55 30
47 86
-44 4
-51 -4
27 -99
41 0
-42 -22
25 81
-10 -88
23 17
83 -73
-46 50
9 15
88 -30
-12 -66
41 99
13 25
18 27
34 64
-9 -54...

output:

12461

result:

ok answer is '12461'

Test #14:

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

input:

55
52 69
49 -31
-80 15
30 35
-32 -69
-88 -2
-24 39
71 -70
15 -25
-57 -18
-69 74
23 -66
-61 -18
73 -10
-68 12
-46 -24
65 -89
-78 13
75 -69
-91 72
91 42
81 -39
16 -60
62 25
-7 95
-65 -47
-43 58
-59 37
14 1
-96 -30
-17 -22
79 -53
28 -84
-71 15
-68 -80
48 -90
-98 -49
6 14
17 -98
87 -93
-93 -24
-27 -19
-...

output:

7796

result:

ok answer is '7796'

Test #15:

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

input:

45
-6 33
85 87
-91 -40
46 18
35 6
-49 -62
-23 52
-34 63
-90 -43
-52 -17
-71 -93
1 39
-23 76
37 -11
52 -42
29 74
-1 59
-42 64
-8 28
-21 36
50 -14
-23 72
55 -70
59 -99
-96 -37
65 -94
96 63
43 14
55 -31
8 60
52 -12
-40 -26
78 98
37 39
70 -55
-5 -81
-27 -58
91 -92
55 68
8 -91
77 -38
27 65
81 -2
-65 -98
...

output:

5600

result:

ok answer is '5600'

Test #16:

score: 0
Accepted
time: 2ms
memory: 3664kb

input:

12
-50 40
49 -78
11 2
-97 -74
-50 68
32 -42
-15 -62
-80 -22
87 74
30 58
52 -5
29 89

output:

1610

result:

ok answer is '1610'

Test #17:

score: 0
Accepted
time: 2ms
memory: 3660kb

input:

31
20 23
40 -34
89 70
60 -72
-66 1
11 -51
-29 69
-9 89
86 -10
93 30
-12 43
77 -24
-69 54
61 -71
48 -53
97 -12
16 -44
31 14
81 76
-53 76
72 -22
40 -29
-49 -69
-48 -37
-12 57
-27 8
97 0
-64 48
17 -61
16 -23
22 -59

output:

3706

result:

ok answer is '3706'

Test #18:

score: 0
Accepted
time: 3ms
memory: 3532kb

input:

60
69 5
25 66
38 -18
-68 53
-46 57
-10 52
99 -32
-64 -3
-80 5
59 93
-23 -33
32 25
40 -31
-80 80
-25 1
-70 -28
66 -48
40 97
45 96
80 -53
-22 -93
30 -22
18 -88
48 -35
-58 52
-96 42
-12 -57
61 51
-77 -66
-75 12
-23 9
95 61
-77 28
87 -79
-67 17
50 50
-91 -82
-61 -75
-28 69
29 90
-98 -46
50 -83
-58 13
-1...

output:

8426

result:

ok answer is '8426'