QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#210031#4360. MelonsXiaoyang0 191ms10444kbC++141.3kb2023-10-10 22:18:092023-10-10 22:18:10

Judging History

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

  • [2023-10-10 22:18:10]
  • 评测
  • 测评结果:0
  • 用时:191ms
  • 内存:10444kb
  • [2023-10-10 22:18:09]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 1ll<<60
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
#define endl "\n"
void inc(ll &a,ll b) {a=(a+b)%mod;}
void dec(ll &a,ll b) {a=(a-b+mod)%mod;}
int lowbit(ll x) {return x&(-x);}

const ll maxn=222222;
ll dp1[maxn],dp2[maxn];
//at index i how many boxes are there (from the back)
//at index i what is the leftover amount at the last box
ll sum[maxn];
ll a[maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	//freopen("i.txt","r",stdin);
	ll n,l;cin>>n>>l;
	rep(i,1,n+1){
		cin>>a[i];
	}
	rep(i,1,n+1){
		sum[i]=sum[i-1]+a[i];
	}
	sum[n+1]=inf;
	rep(i,1,n+1)cout<<sum[i]<<" ";
	cout<<endl;
	for(int i=n;i>0;i--){
		auto first=upper_bound(sum+1,sum+n+1,sum[i-1]+l)-sum;
		debug(first);
		dp1[i]=dp1[first]+1;
		if(dp1[i]>1){
			dp2[i]=dp2[first];
		}else{
			dp2[i]=sum[first-1]-sum[i-1];
		}
	}
	rep(i,1,n+1){
		cout<<dp1[i]<<" "<<dp2[i]<<endl;
	}
	return 0;
}

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

input:

1 1000000000
1000000000

output:

1000000000 
1 1000000000

result:

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

Subtask #2:

score: 0
Wrong Answer

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 3676kb

input:

6 100
49
52
49
51
49
50

output:

49 101 150 201 250 300 
4 99
3 99
2 99
2 50
1 99
1 50

result:

wrong answer 1st lines differ - expected: '4 99', found: '49 101 150 201 250 300 '

Subtask #3:

score: 0
Wrong Answer

Test #18:

score: 0
Wrong Answer
time: 191ms
memory: 10444kb

input:

200000 487364444
10654
17572
18762
15766
10400
18457
17396
17411
11350
17474
15240
11004
11735
13727
11276
14278
12776
18151
15179
10254
12959
13898
20150
18056
11788
14697
16944
18729
11250
10755
12314
11762
14916
12143
15735
17509
14792
12292
15100
12092
15003
15712
20302
12968
18562
19199
13751
1...

output:

10654 28226 46988 62754 73154 91611 109007 126418 137768 155242 170482 181486 193221 206948 218224 232502 245278 263429 278608 288862 301821 315719 335869 353925 365713 380410 397354 416083 427333 438088 450402 462164 477080 489223 504958 522467 537259 549551 564651 576743 591746 607458 627760 64072...

result:

wrong answer 1st lines differ - expected: '7 122715435', found: '10654 28226 46988 62754 73154 ...46821742 3046840638 3046859207 '

Subtask #4:

score: 0
Wrong Answer

Test #24:

score: 0
Wrong Answer
time: 175ms
memory: 10216kb

input:

199991 985109562
640903676
423863576
684098696
954704775
568853942
629634947
964242698
560478408
102023353
607218645
949573452
513804300
392731599
59413618
88162421
468486592
571938430
575500251
595722170
976965132
134183550
375294704
667027699
146989020
225677555
626114030
972050696
617268087
22697...

output:

640903676 1064767252 1748865948 2703570723 3272424665 3902059612 4866302310 5426780718 5528804071 6136022716 7085596168 7599400468 7992132067 8051545685 8139708106 8608194698 9180133128 9755633379 10351355549 11328320681 11462504231 11837798935 12504826634 12651815654 12877493209 13503607239 1447565...

result:

wrong answer 1st lines differ - expected: '133346 171739222', found: '640903676 1064767252 174886594... 98553352257076 98553523996298 '

Subtask #5:

score: 0
Skipped

Dependency #1:

0%