QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#359279#7625. PathxianjingWA 32ms4424kbC++14439b2024-03-20 15:46:562024-03-20 15:46:57

Judging History

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

  • [2024-03-20 15:46:57]
  • 评测
  • 测评结果:WA
  • 用时:32ms
  • 内存:4424kb
  • [2024-03-20 15:46:56]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
//#define int long long
void solve(){
	int n,m;cin>>m>>n;
	int a[m],b[n];
	int sum=0;
	for(int i=0;i<m;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>b[i];
	}
	for(int i=1;i<m;i++){
		sum+=abs(a[i]-a[i-1]);
	}
	for(int i=1;i<n;i++){
		sum+=abs(b[i]-b[i-1]);
	}
	cout<<sum;
	return;
}
signed main(){
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3532kb

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: 4424kb

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'