QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#796930#8777. Passport Stampsdoyo#WA 4ms5596kbC++20720b2024-12-02 11:24:332024-12-02 11:24:33

Judging History

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

  • [2024-12-02 11:24:33]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:5596kb
  • [2024-12-02 11:24:33]
  • 提交

answer

#include<bits/stdc++.h>

using ll=long long;
using lint=__int128;

void work()
{
    int n;
    ll p;
    std::cin>>n>>p;
    std::vector<ll> c(n+1);
    std::vector<lint> pre(n+1);
    for(int i=1;i<=n;i++)
    {
        std::cin>>c[i];
        pre[i]=pre[i-1]+c[i];
    }

    if(c[1]>p) {std::cout<<0<<'\n';return;}
    for(int i=2;i<=n;i++)
    {
        assert(pre[i-1]>=0);
        if(p==pre[i-1]||pre[i-1]+(c[i]-1)*i>=p)
        {
            std::cout<<i-1<<'\n';
            return;
        }
    }
    std::cout<<n<<'\n';
}

int main()
{
    std::cin.tie(0);
    std::cin.sync_with_stdio(0);
    int t=1;
    //std::cin>>t;
    while(t--)
        work();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 15
1
2
3
4
5

output:

3

result:

ok single line: '3'

Test #2:

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

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: 0
Accepted
time: 2ms
memory: 5596kb

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:

53636

result:

ok single line: '53636'

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 5588kb

input:

100000 132839930703581978
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:

59361

result:

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