QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#554496#8777. Passport StampsluqyouWA 4ms5148kbC++14741b2024-09-09 11:32:312024-09-09 11:32:31

Judging History

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

  • [2024-09-09 11:32:31]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:5148kb
  • [2024-09-09 11:32:31]
  • 提交

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,尤其是后缀名
检查空间
检查调试语句是否全部注释
*/

详细

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'