QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#439386#8590. Problem Setterbeka0 172ms6756kbC++14581b2024-06-11 20:58:422024-06-11 20:58:43

Judging History

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

  • [2024-06-11 20:58:43]
  • 评测
  • 测评结果:0
  • 用时:172ms
  • 内存:6756kb
  • [2024-06-11 20:58:42]
  • 提交

answer



#include <bits/stdc++.h>
using namespace std;
const int N=3e5+5;
int n,m,b[N],ans,ans1,mid,l,r,hap,sad;
string s;
pair <int,int> a[N];
int main() {
	cin>>m>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].first>>a[i].second;
	}
	sort(a+1,a+1+n);
	for(int i=1;i<=n;i++){
		b[i]=max(b[i-1],a[i].second);
	}
	for(int i=1;i<=m;i++){
		int q,d;
		cin>>q>>sad;
		l=0;
		r=n;
		while(l<=r){
			int mid =(l+r)/2;
			if(a[mid].first>=q){
				r=mid-1;
			}else{
				l=mid+1;
				ans=mid;
			}
		}
		hap = b[ans];
		if(hap>sad) ans1+=(hap-sad);
	}
	cout<<ans1;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5664kb

input:

1000 1
570339 324084
75781 292531
427864 843267
928484 613828
883296 385343
733451 782070
756314 89477
786410 133722
455015 841750
146307 536680
992681 107898
657731 633895
764691 258779
142935 640379
445046 717170
227758 578083
526095 660806
859673 757597
898726 4088
719881 887973
850810 674331
752...

output:

23174336

result:

wrong answer 1st lines differ - expected: '575102', found: '23174336'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #24:

score: 0
Wrong Answer
time: 172ms
memory: 6756kb

input:

200000 200000
443848 257048
353855 430518
112240 460358
489050 850745
18217 643349
796031 335731
553602 81823
556808 39341
963397 797473
713023 273372
888193 500234
801660 980841
416233 163140
649254 659678
434013 461662
805451 259446
107168 839690
438518 100393
584335 435627
735040 11809
906814 672...

output:

-1877845300

result:

wrong answer 1st lines differ - expected: '199985649927', found: '-1877845300'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%