# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20576 | CodingAmolang (#35) | 복불복 (OJUZ11_luck) | C++11 | 0 ms | 1172 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
#include<algorithm>
#include<vector>
int A[110];
int B[110];
int main() {
int n, k;
scanf("%d%d", &n, &k);
for (int i = 0; i < n; i++) {
scanf("%d", &A[i]);
}
for (int i = 0; i < n; i++) {
scanf("%d", &B[i]);
}
std::vector<int> win;
std::vector<int> lose;
for (int i = 0; i < n; i++) {
int cnt = 0;
for (int j = 0; j < n; j++) {
if (A[i] < A[j]) {
cnt++;
}
}
if (cnt+1 <= k) {
win.push_back(A[i]);
}
else {
lose.push_back(A[i]);
}
}
if (n <= 8 && k <= 8) {
std::vector<int> order;
for (int i = 0; i < n; i++) {
order.push_back(i);
}
long long ans = 0;
do {
int p = 0;
for (int &i : win) {
i += B[order[p]];
p++;
}
for (int& i : lose) {
i += B[order[p]];
p++;
}
bool falg = false;
for (int i : win) {
for (int j : lose) {
if (j > i) {
falg = true;
}
}
}
if (!falg) {
ans++;
}
} while (std::next_permutation(order.begin(), order.end()));
printf("%lld", ans % 1000000007);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |