QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#180897 | #6135. Books | organput# | WA | 47ms | 3548kb | C++14 | 1.9kb | 2023-09-16 14:10:33 | 2023-09-16 14:10:33 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define fo(x,a,b) for(int x=a;x<=b;x++)
#define of(x,a,b) for(int x=a;x>=b;x--)
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
#define PI acos(-1)
#define pb push_back
#define INF 0x3f3f3f3f
#define lowbit(a) ((a)&-(a))
#define lbit(a) (__builtin_ffsll(a))
#define ubit(a) (64-__builtin_clzll(a))
#define fi first
#define se second
bool isprime(ll x){
if(x==1)return false;
for(ll i=2;i<=x/i;i++){
if(x%i==0)return false;
}
return true;
}
ll popcnt(ll x){
ll cnt=0;
while(x){
if(x&1)cnt++;
x>>=1;
}
return cnt;
}
ll qmi(ll a,ll b,ll p){
a%=p;
ll res=1;
while(b){
if(b&1)res=res*a%p;
a=a*a%p;
b>>=1;
}
return res;
}
ll exgcd(ll a,ll b,ll &x,ll &y){
if(!b){
x=1,y=0;
return a;
}
ll d=exgcd(b,a%b,y,x);
y-=a/b*x;
return d;
}
const int N=2e5+10;
const int mod=1e9+7;
ll fact[N],in_fact[N];
ll C(ll n,ll m) {
if (n < m || m < 0)return 0;
return fact[n] * qmi(fact[m] * fact[n - m] % mod, mod - 2, mod) % mod;
}
//ll C(ll n,ll m){
// if (n < m || m < 0)return 0;
// return fact[n]%mod*in_fact[m]%mod*in_fact[n-m]%mod;
//}
void sol(){
ll n,m;cin>>n>>m;
ll cnt=0,z=0;
ll minn=1e9;
fo(i,1,n){
ll x;cin>>x;
if(x==0) z++;
minn=min(minn,x);
if(i<=m+1){
cnt+=x;
}
}
//cout<<n<<' '<<m<<endl;
if(m<z){
cout<<"Impossible"<<endl;
}
else if(n==m){
cout<<"Richman"<<endl;
}
else if(m==0){
cout<<minn-1<<endl;
}
else{
cout<<cnt-1<<endl;
}
return;
}
int main(){
close();
int t=1;
cin>>t;
while(t--){
sol();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3548kb
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:
ok 4 lines
Test #2:
score: -100
Wrong Answer
time: 47ms
memory: 3440kb
input:
10012 1 0 2 3 2 0 1 0 2 1 0 0 100000 99999 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000...
output:
1 0 Impossible 99999999999999 192 80 Richman 97 490 Richman 24 163 98 30 15 Richman Richman Richman 111 Richman Richman 450 168 44 350 34 513 28 202 321 Richman Richman Richman 212 344 2 160 76 101 91 130 3 Richman 200 32 15 Richman 21 26 Richman 88 Richman 302 356 Richman Richman 60 313 62 343 Rich...
result:
wrong answer 9th lines differ - expected: '460', found: '490'