QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#554496 | #8777. Passport Stamps | luqyou | WA | 4ms | 5148kb | C++14 | 741b | 2024-09-09 11:32:31 | 2024-09-09 11:32:31 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define i128 __int128
using namespace std;
#define fi first
#define sc second
#define pii pair<int,int>
#define pb push_back
const int maxn=1e5+10;
int n,num;
i128 p,a[maxn];
void solve(){
cin>>n>>num,p=num;
for(int i=1;i<=n;i++) cin>>num,a[i]=num;
i128 sum=0;
for(int i=1;i<=n;i++){
if(sum+(a[i-1]*(i128)i)>=p) return cout<<i-1<<endl,void();
sum+=a[i];
}
cout<<n<<endl;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int t=1;
// cin>>t;
while(t--) solve();
return 0;
}
/*
Samples
input:
output:
THINGS TODO:
检查freopen,尤其是后缀名
检查空间
检查调试语句是否全部注释
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
5 15 1 2 3 4 5
output:
3
result:
ok single line: '3'
Test #2:
score: -100
Wrong Answer
time: 4ms
memory: 5148kb
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:
84438
result:
wrong answer 1st lines differ - expected: '84437', found: '84438'