# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20419 | tlwpdus (#35) | 복불복 (OJUZ11_luck) | C++98 | 0 ms | 1116 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.
// k==1
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
ll res = 0;
int n, k;
int a[110];
int b[110];
int main() {
int i, j, l;
scanf("%d%d",&n,&k);
for (i=0;i<n;i++) scanf("%d",&a[i]);
for (i=0;i<n;i++) scanf("%d",&b[i]);
sort(a,a+n); sort(b,b+n);
for (i=0;i<n;i++) {
int v = a[n-1]+b[i];
ll tres = 1;
for (j=n-2;j>=0;j--) {
int cnt = 0;
for (l=0;l<n;l++) {
if (l==i) continue;
if (a[j]+b[l]>v) break;
cnt++;
}
if (cnt<=n-2-j) {
tres = 0;
break;
}
tres *= cnt-(n-2-j);
tres %= MOD;
}
res += tres;
res %= MOD;
}
printf("%lld\n",res);
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... |