QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#291669 | #7625. Path | jzhong0821 | WA | 32ms | 4380kb | C++17 | 845b | 2023-12-27 02:34:51 | 2023-12-27 02:34:52 |
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];
int 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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3680kb
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: 3480kb
input:
4 2 5 7 8 10 10 3
output:
12
result:
ok single line: '12'
Test #3:
score: -100
Wrong Answer
time: 32ms
memory: 4380kb
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'