QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#598293#8777. Passport StampsNana7#WA 0ms3624kbC++14690b2024-09-28 21:12:012024-09-28 21:12:02

Judging History

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

  • [2024-09-28 21:12:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3624kb
  • [2024-09-28 21:12:01]
  • 提交

answer

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

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

void write(int x) {
	if(x>=10) write(x/10);
	putchar('0'+x%10);
}
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()
{
	n=read(); p=read();
	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) {
			write(i-1);
			exit(0);
		}
	}
	write(n);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 15
1
2
3
4
5

output:

3

result:

ok single line: '3'

Test #2:

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

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'