QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#94924 | #6135. Books | George_Plover# | WA | 2ms | 3724kb | C++14 | 596b | 2023-04-08 12:23:44 | 2023-04-08 12:23:46 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=(a);i<=(b);i++)
typedef long long ll;
const int N=100005;
int a[N],n,m;
void Main()
{
scanf("%d%d",&n,&m);
int cnt=0;
For(i,1,n)scanf("%d",a+i),cnt+=a[i]==0;
m-=cnt;
if(m+cnt==n){printf("Richman\n"); return;}
if(m<0){printf("Impossible\n"); return;}
ll s=0; cnt=0;
For(i,1,n)
if(a[i]>0)
{
cnt++;
if(cnt<=m+1)s+=a[i];
}
printf("%lld\n",s-1);
}
int main()
{
int t;
scanf("%d",&t);
while(t--)Main();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3724kb
input:
4 4 2 1 2 4 8 4 0 100 99 98 97 2 2 10000 10000 5 3 0 0 0 0 1
output:
6 99 Richman Impossible
result:
wrong answer 2nd lines differ - expected: '96', found: '99'