QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#308205#8016. 不休陀螺for_to20 19ms9424kbC++14566b2024-01-19 18:35:572024-01-19 18:35:57

Judging History

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

  • [2024-01-19 18:35:57]
  • 评测
  • 测评结果:20
  • 用时:19ms
  • 内存:9424kb
  • [2024-01-19 18:35:57]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define N 500005

using namespace std;

int n,E;
int a[N],b[N];

signed main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin>>n>>E;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++) cin>>b[i];
	
	int res=0;
	for(int i=1;i<=n;i++){
		int sum=0;
		int x=0,y=0;
		for(int j=i;j<=n;j++){
			if(a[j]>b[j]) x+=a[j]-b[j],y=max(b[j],y);
			else y=max(a[j],y);
			sum+=(b[j]-a[j]);
			
			if(sum>=0 && E>=x+y) ++res;
		}
	}
	cout<<res;
	
	return 0;
}

//5 10
//8 1 6 4 10
//7 6 1 8 5

詳細信息

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 19ms
memory: 5640kb

input:

5000 939255322
47952340 92329911 61615795 40122788 47258178 29326499 9822850 42767362 86610596 60318756 52429688 87502511 50194916 96377063 74322128 19511341 28794957 53813791 79075058 35555414 5249682 45174421 101856091 25257909 94697470 45853817 82945426 108415825 41731145 87133877 75167193 598696...

output:

1846283

result:

ok single line: '1846283'

Test #2:

score: 0
Accepted
time: 12ms
memory: 5752kb

input:

4329 694688892
165277824 152780705 114369871 103975989 100188012 147665514 101173335 39350309 37624153 95413467 157561608 10779445 35486823 19200231 55106545 50853515 35799174 92799915 152580135 158388210 132197954 75468895 66543749 104662491 59493152 108170563 22295314 152619070 77921052 105881528 ...

output:

889705

result:

ok single line: '889705'

Test #3:

score: 0
Accepted
time: 15ms
memory: 5696kb

input:

4932 10000000
879202 367773 895593 794951 253764 695611 164309 502290 638542 960084 766095 457948 783698 475707 157847 491793 196608 378324 211974 924944 42162 797172 334660 900879 522660 328814 402169 938267 498991 347773 922727 827106 16528 994043 12381 756925 642283 186848 423956 927655 344750 14...

output:

10724274

result:

ok single line: '10724274'

Test #4:

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

input:

4545 10000000
343712 838600 973396 360269 315252 660011 857231 837695 934030 232383 174532 293701 238344 367417 96713 556096 316705 468048 511763 208940 360904 853055 809137 119764 388946 415546 420603 893876 816501 899208 82913 705704 70043 223366 792251 899049 782406 849921 967761 54994 105919 384...

output:

5542899

result:

ok single line: '5542899'

Subtask #2:

score: 0
Runtime Error

Test #5:

score: 0
Runtime Error

input:

774484 763692678
47702350 34856775 28447988 4178162 45063720 8232662 36845607 27038945 44858289 5952529 39159657 21628528 60199611 5544054 59216841 39287087 43449994 20034684 56440004 11583811 44465341 32347476 49196492 22731571 9481143 11726859 35167370 23103544 23109378 38822668 29778048 58004104 ...

output:


result:


Subtask #3:

score: 0
Wrong Answer

Test #10:

score: 0
Wrong Answer
time: 7ms
memory: 9424kb

input:

1000000 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

0

result:

wrong answer 1st lines differ - expected: '99999500000', found: '0'

Subtask #4:

score: 0
Time Limit Exceeded

Test #14:

score: 0
Time Limit Exceeded

input:

174457 888
0 0 0 0 1 0 0 1 1 1 0 1 0 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 0 1 0 0 1 1 0 0 1 1 1 0 1 0 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 1 0 0 0 1 0 1 1 1 0 1 0 0 0 1 0 1 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 1...

output:


result:


Subtask #5:

score: 0
Time Limit Exceeded

Test #18:

score: 0
Time Limit Exceeded

input:

343922 773619774
0 8292680 5684115 0 0 170056 5385926 0 0 1588575 0 0 10947891 170867 35145 0 0 103085 7231562 0 0 0 0 11128944 0 4872226 0 2879880 7565181 0 8631665 0 5162564 9511835 514165 0 9628987 14357934 174784 0 12400154 0 0 8198218 0 8496060 0 0 0 0 10376826 3523227 0 14548249 0 6840016 0 0 ...

output:


result:


Subtask #6:

score: 0
Time Limit Exceeded

Test #24:

score: 0
Time Limit Exceeded

input:

468676 582048177
6889433 7293342 20676061 15545414 4911497 12352219 8921719 1705801 19695926 25259227 2645394 17518171 19753552 9449377 982708 22479531 1267985 15594372 20685422 9627290 2017543 6459134 18614020 16206301 14962487 12932255 7101003 29140540 6479702 20607124 2540287 15565156 20274141 11...

output:


result: