QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#598281#8777. Passport StampsNana7#WA 0ms3704kbC++14622b2024-09-28 21:09:252024-09-28 21:09:26

Judging History

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

  • [2024-09-28 21:09:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3704kb
  • [2024-09-28 21:09:25]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<vector>
#include<cstring>
#define I inline
#define int long long
using namespace std;

const int M = 100010;
const int N = 55;
int n,p,a[N],sum[N];

I int read() {
	int ret=0,w=1; char ch;
	while((ch=getchar())>'9'||ch<'0'&&ch!='-'); if(ch=='-') w=-1; else ret=ch-'0';
	while((ch=getchar())>='0'&&ch<='9') ret=ret*10+ch-'0';
	return ret*w; 
}
signed main()
{
	cin>>n>>p;
	for(int i=1;i<=n;++i) a[i]=read(),sum[i]=sum[i-1]+a[i];
	for(int i=1;i<=n;++i) {
		if((a[i]-1)*(i-1)+sum[i-1]+a[i]>p) {
			cout<<i-1<<endl;
			exit(0);
		}
	}
	cout<<n<<endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 15
1
2
3
4
5

output:

3

result:

ok single line: '3'

Test #2:

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

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:

0

result:

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