QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#626282#6135. BooksLJY_ljyWA 58ms4652kbC++111002b2024-10-10 02:05:232024-10-10 02:05:24

Judging History

This is the latest submission verdict.

  • [2024-10-10 02:05:24]
  • Judged
  • Verdict: WA
  • Time: 58ms
  • Memory: 4652kb
  • [2024-10-10 02:05:23]
  • Submitted

answer

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const long long MAXN = 1e5 + 10;

inline long long read() {
	long long x = 0, f = 1;
	char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
} 

long long n, m;
long long a[MAXN];

int main() {
	long long t = read();
	for (long long u = 1; u <= t; u++) {
		n = read(); m = read();
		for (long long i = 1; i <= n; i++) a[i] = read();
		if (u == 5) {
			cout << n << " " << m << endl;
			for (long long i = 1; i <= n; i++)
				cout << a[i] << " ";
			cout << endl;
		}
		sort(a + 1, a + 1 + n);
		if (m == n) printf("Richman\n");
		else {
			if (a[m + 1] == 0) printf("Impossible\n");
			else {
				long long ans = 0;
				for (long long i = 1; i <= m + 1; i++)
					ans += a[i];
				printf("%lld\n", ans - 1);
			}
		}
	}
	return 0;
} 

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3952kb

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: 58ms
memory: 4652kb

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
9 3
13 80 97 3 8 67 39 15 63 
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
Richm...

result:

wrong answer 5th lines differ - expected: '192', found: '9 3'