QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#291672 | #7625. Path | jzhong0821 | AC ✓ | 30ms | 4384kb | C++17 | 842b | 2023-12-27 02:39:14 | 2023-12-27 02:39:15 |
Judging History
answer
#include <iostream>
#include <assert.h>
#include <cstring>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
#define fo(x) freopen(#x ".in", "r", stdin), freopen(#x ".out", "w", stdout)
#define f1(i,k) for(int i=1,end_i=(k);i<=end_i;i++)
#define f0(i,k) for(int i=0,end_i=(k);i< end_i;i++)
#define cle(x) memset(x, 0, sizeof(x))
#define lobit(x) ((x) & -(x))
#define ll long long
#define pb push_back
const int inf = 2e18;
const int lim = 200005;
const int mv = 1500;
int n,m;
int sn[lim], sm[lim];
ll res;
int main(){
cin>>n>>m;
f1(i,n){ cin>>sn[i]; }
f1(i,m){ cin>>sm[i]; }
f1(i,n-1){
res+=abs(sn[i]-sn[i+1]);
}
f1(i,m-1){
res+=abs(sm[i]-sm[i+1]);
}
cout<<res<<endl;
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3432kb
input:
4 4 1 3 3 1 8 10 8 5
output:
11
result:
ok single line: '11'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3376kb
input:
4 2 5 7 8 10 10 3
output:
12
result:
ok single line: '12'
Test #3:
score: 0
Accepted
time: 30ms
memory: 4384kb
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:
6671609257
result:
ok single line: '6671609257'
Test #4:
score: 0
Accepted
time: 19ms
memory: 4148kb
input:
100000 100000 49849 61189 44964 89719 54861 59757 54071 37516 69885 42727 69469 60593 62981 34185 36641 36826 47251 10501 71167 44261 42977 35866 72991 35233 39003 96298 75153 25421 43153 6520 11321 87601 92801 65989 74932 30242 13385 36407 76034 97112 44941 93553 41606 7201 71725 45052 75732 72300 ...
output:
6672086237
result:
ok single line: '6672086237'
Test #5:
score: 0
Accepted
time: 22ms
memory: 4120kb
input:
100000 90000 1 62782 1 26382 1 69310 1 6311 1 96861 1 14370 1 58980 1 48109 1 64865 1 5033 1 24391 1 28997 1 48373 1 13006 1 12285 1 16585 1 8426 1 27406 1 8738 1 90929 1 41126 1 71171 1 31553 1 77113 1 82309 1 75665 1 63265 1 74113 1 47691 1 8004 1 41589 1 4582 1 76800 1 67765 1 57435 1 53126 1 883...
output:
9473046647
result:
ok single line: '9473046647'
Test #6:
score: 0
Accepted
time: 22ms
memory: 4048kb
input:
90000 100000 1 29919 1 19450 1 15481 1 12155 1 22315 1 13158 1 25727 1 195 1 23167 1 18981 1 11091 1 17235 1 9448 1 11997 1 17043 1 31138 1 10513 1 23390 1 1881 1 27821 1 11028 1 26154 1 19893 1 6553 1 1936 1 32053 1 91 1 8858 1 28924 1 32233 1 26776 1 18195 1 5946 1 20077 1 12939 1 9983 1 28015 1 2...
output:
3109377821
result:
ok single line: '3109377821'
Test #7:
score: 0
Accepted
time: 24ms
memory: 4112kb
input:
90000 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000...
output:
18999610002
result:
ok single line: '18999610002'
Test #8:
score: 0
Accepted
time: 24ms
memory: 4312kb
input:
100000 90000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000...
output:
18999610002
result:
ok single line: '18999610002'
Test #9:
score: 0
Accepted
time: 14ms
memory: 4080kb
input:
89587 32731 8066 30223 13728 32177 24547 24078 14708 6400 2772 4833 30027 25808 32423 12769 10277 7920 20862 18932 29030 17666 14084 31337 1068 19072 28255 31011 9440 28668 19552 17402 9483 8108 13821 350 20843 29477 7938 21565 1607 18023 24835 10023 24063 31770 32405 12977 11751 22295 9918 17175 17...
output:
1337025965
result:
ok single line: '1337025965'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3492kb
input:
20906 9083 26870 17089 29290 17540 8801 26106 13969 6620 15163 22028 9916 14194 2672 6591 19430 27240 12403 30800 5800 19971 21563 21095 9307 3146 12684 1864 24445 3280 23671 14925 32597 1486 24100 3220 10970 9076 3791 7925 17106 14721 20753 28727 5943 13074 4705 27523 3038 13495 13530 15128 28763 9...
output:
328067052
result:
ok single line: '328067052'
Extra Test:
score: 0
Extra Test Passed