QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#598281#8777. Passport StampsNana7#WA 0ms3704kbC++14622b2024-09-28 21:09:252024-09-28 21:09:26

Judging History

This is the latest submission verdict.

  • [2024-09-28 21:09:26]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3704kb
  • [2024-09-28 21:09:25]
  • Submitted

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;
}

详细

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'