QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#510854#7841. Boat CommuterPoknikRE 9ms3708kbC++20562b2024-08-09 13:41:272024-08-09 13:41:29

Judging History

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

  • [2024-08-09 13:41:29]
  • 评测
  • 测评结果:RE
  • 用时:9ms
  • 内存:3708kb
  • [2024-08-09 13:41:27]
  • 提交

answer

#include<bits/stdc++.h>
#define int  long long
using namespace std;
int sum[55];
map<int,int>mp;

void solve()
{
	int n,m,k;
	cin>>n>>m>>k;
	for(int i=1;i<=k;i++){
		int p,c;
		cin>>p>>c;
		if(mp[c]==0){
			mp[c]=p;
		}
		else if(mp[c]==p){
			sum[c]+=100;
			mp[c]=0;
		}
		else{
			sum[c]+=abs(mp[c]-p);
			mp[c]=0;
		}
		
	}
	for(int i=1;i<=m;i++){
		if(mp[i]!=0){
			sum[i]+=100;
		}
	}
	for(int i=1;i<=m;i++)cout<<sum[i]<<" ";
}
signed main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	solve();
	
	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 3 5
1 1
1 2
1 2
3 1
2 3

output:

2 100 100 

result:

ok single line: '2 100 100 '

Test #2:

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

input:

50 10 100000
16 6
7 1
18 1
39 3
30 3
27 5
27 1
25 8
8 4
30 5
48 10
20 1
25 9
40 1
1 8
15 6
24 5
49 9
46 1
42 8
35 4
47 4
28 6
16 7
46 9
30 9
32 8
8 7
40 5
29 10
48 6
42 2
25 8
16 5
41 6
23 7
40 10
33 9
50 8
13 9
41 3
27 5
38 6
7 3
46 10
26 4
33 5
31 9
27 7
50 10
37 5
9 6
30 2
7 8
27 4
20 9
25 4
47 9...

output:

94844 94854 93814 91551 95910 91226 92395 94770 92170 93178 

result:

ok single line: '94844 94854 93814 91551 95910 91226 92395 94770 92170 93178 '

Test #3:

score: -100
Runtime Error

input:

50 100000 100000
15 96740
22 10089
40 13683
13 78680
17 23471
40 32221
37 81743
49 39664
10 89736
3 92228
43 44871
22 91538
42 89149
42 31355
37 67861
44 49843
31 16350
35 54987
28 4360
6 20100
21 36548
25 3957
21 55315
47 2666
11 94150
27 79681
35 47527
31 84052
45 98448
48 26415
21 24159
39 84014
...

output:


result: