QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#197113 | #6135. Books | HarryJ | WA | 1ms | 3600kb | C++23 | 866b | 2023-10-02 11:39:10 | 2023-10-02 11:39:10 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
const LL mod=998244353;
const int INF=0x3f3f3f3f;
const int N=1e5+10;
LL a[N];
int n,m;
void solve()
{
cin>>n>>m;
LL zero=0,miv=INF;
for(int i=1;i<=n;i++)
{
cin>>a[i];
miv=min(miv,a[i]);
if(!a[i]) zero++;
}
if(n==m) cout<<"Richman"<<endl;
else if(!m) cout<<miv-1<<endl;
else if(zero>m) cout<<"Impossible"<<endl;
else
{
m-=zero;
LL ans=0;
for(int i=1;i<=n&&m;i++)
if(a[i]) ans+=a[i],m--;
cout<<ans<<endl;
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int tt; cin>>tt;
while(tt--) solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3600kb
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:
3 96 Richman Impossible
result:
wrong answer 1st lines differ - expected: '6', found: '3'