QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#103305#6135. BooksYanagi_Origami#WA 0ms3580kbC++20777b2023-05-05 06:38:072023-05-05 06:38:10

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-05 06:38:10]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3580kb
  • [2023-05-05 06:38:07]
  • Submitted

answer

#include <iostream>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long ll;
const int N=1e6+5;
int a[N],n,m;
void solve(){
    scanf("%d%d",&n,&m);
    rep(i,1,n) scanf("%d",a+i);
    if(m>=n){
        puts("Richman");
        return ;
    }
    int c=0; ll ans=0;
    rep(i,1,n) if(a[i]==0) c++;
    if(c>m){
        puts("impossible");
        return ;
    }
    m-=c;
    int p=1,Min=1e9+7;
    while(m>0){
        if(a[p]!=0) ans+=a[p],m--;
        p++;
    }
    rep(i,p,n){
        Min=min(Min,a[i]);
    }
    ans+=Min-1;
    printf("%lld\n",ans);
}
int main(){
    int T; scanf("%d",&T);
    while(T--) solve();
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3580kb

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
96
Richman
impossible

result:

wrong answer 4th lines differ - expected: 'Impossible', found: 'impossible'