QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#492891 | #6135. Books | 122 | WA | 204ms | 4188kb | C++14 | 1.3kb | 2024-07-26 16:52:36 | 2024-07-26 16:52:38 |
Judging History
answer
#include <iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <cstring>
#include<ctype.h>
#include<set>
#include<map>
#include<cmath>
#include<climits>
#include<stack>
#include<list>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define maxn 200000+5
#define ll long long
using namespace std;
#define maxn 1000000+5
#define ll long long
using namespace std;
int main() {
int t;
cin >> t;
while (t--)
{
int n, m;
cin >> n >> m;
vector<int>a(n + 1, 0);
int sum = 0; int cnt = 0;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
if (a[i] == 0) cnt++;
}
if (n == m) {
cout << "Richman"<<endl;
continue;
}
if (cnt >= m&&cnt)
{
cout << "Impossible"<<endl;
continue;
}
sort(a.begin() + 1, a.begin() + n + 1);
int cnt1 = m + 1;
sum = 0;
for (int i = 1; i <= n; i++)
{
if (i == m + 1)
{
sum += a[i] - 1; break;
}
else sum += a[i];
}
cout << sum << endl;
continue;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
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: 204ms
memory: 4188kb
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 Impossible Impossible 276447231 38 56 Richman 97 411 Richman 24 50 98 30 15 Richman Richman Richman 36 Richman Richman 450 24 44 349 34 475 28 33 238 Richman Richman Richman 51 274 2 160 76 47 91 71 3 Richman 125 32 15 Richman 21 26 Richman 7 Richman 206 266 Richman Richman 60 286 62 257 Richman 6...
result:
wrong answer 2nd lines differ - expected: '0', found: 'Impossible'