# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20481 | 볼빨간민돌이 (#35) | 복불복 (OJUZ11_luck) | C++98 | 1000 ms | 1120 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 <cstdio>
#include <algorithm>
#include <cstdlib>
using namespace std;
int n, k, a[101], b[101];
void sub1(){
int t[101];
sort(a+1, a+n+1);
reverse(a+1, a+n+1);
sort(b+1, b+n+1);
int cnt=0;
do{
for(int i=1; i<=n; i++)
t[i]=a[i]+b[i];
sort(t+1, t+1+n);
bool flag=true;
for(int i=1; i<=k; i++){
if(t+1+n - upper_bound(t+1, t+1+n, a[i]+b[i]) + 1 > k)
flag=false;
}
if(flag) cnt++;
}while(next_permutation(b+1, b+n+1));
printf("%d", cnt);
exit(0);
}
int main(){
scanf("%d %d", &n, &k);
for(int i=1; i<=n; i++)
scanf("%d", &a[i]);
for(int i=1; i<=n; i++)
scanf("%d", &b[i]);
sub1();
return 0;
}
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... |