QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#598293 | #8777. Passport Stamps | Nana7# | WA | 0ms | 3624kb | C++14 | 690b | 2024-09-28 21:12:01 | 2024-09-28 21:12:02 |
Judging History
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);
}
詳細信息
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'