QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#251925#7625. Pathucup-team1074AC ✓9ms4444kbC++17751b2023-11-15 13:03:432023-11-15 13:03:44

Judging History

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

  • [2023-11-15 13:03:44]
  • 评测
  • 测评结果:AC
  • 用时:9ms
  • 内存:4444kb
  • [2023-11-15 13:03:43]
  • 提交

answer

#include<iostream>
#include<math.h>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<queue>
#include<string.h>
#include<stack>
#define ll long long
using namespace std;
int a[100010];
int b[100010];

void solve() 
{
	int n,m;
	cin>>n>>m;
	int a[n+10],b[m+10];
	for(int i=1;i<=n;i++)	cin>>a[i];
	for(int i=1;i<=m;i++)	cin>>b[i];
	long long sum=0;
	for(int i=2;i<=n;i++)
	{
		sum+=abs(a[i]-a[i-1]);
	}
	for(int i=2;i<=m;i++)
	{
		sum+=abs(b[i]-b[i-1]);
	}
	cout<<sum;
	return;
}  


int main()
{
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(10);
    int t;
    t=1;
    while(t>0)
    {
        t--;
        solve();
    }
    return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

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

input:

4 2
5 7 8 10
10 3

output:

12

result:

ok single line: '12'

Test #3:

score: 0
Accepted
time: 9ms
memory: 4420kb

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: 9ms
memory: 4352kb

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: 7ms
memory: 4372kb

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: 7ms
memory: 4440kb

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: 7ms
memory: 4444kb

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: 7ms
memory: 4380kb

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: 6ms
memory: 4084kb

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

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