QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#732556#8777. Passport Stampsjiujiu#WA 4ms6320kbC++20603b2024-11-10 15:08:462024-11-10 15:08:46

Judging History

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

  • [2024-11-10 15:08:46]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:6320kb
  • [2024-11-10 15:08:46]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
int t,n,x,y;

signed main() {
    IOS;
    cin>>n>>x;
    __int128 m=x;
    vector<__int128> a(n+2),sum(n+1);
    for(int i=1;i<=n;i++) {
        cin>>x;
        a[i]=x;
        sum[i]=sum[i-1]+a[i];
    }
    int l=0,r=n;
    a[n+1]=1;
    while(l<r) {
        int mid=(l+r)>>1;
        if(m>sum[mid]+(a[mid+1]-1)*(mid+1)) {
            l=mid+1;
        }
        else {
            r=mid;
        }
    }
    cout<<min(l,n)<<endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 15
1
2
3
4
5

output:

3

result:

ok single line: '3'

Test #2:

score: 0
Accepted
time: 4ms
memory: 6164kb

input:

100000 559309580160692839
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

84437

result:

ok single line: '84437'

Test #3:

score: -100
Wrong Answer
time: 4ms
memory: 6320kb

input:

100000 890934113082207108
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

100000

result:

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