Submission #20419

#TimeUsernameProblemLanguageResultExecution timeMemory
20419tlwpdus (#35)복불복 (OJUZ11_luck)C++98
13 / 100
0 ms1116 KiB
// 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)

luck.cpp: In function 'int main()':
luck.cpp:21:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&k);
                     ^
luck.cpp:22:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (i=0;i<n;i++) scanf("%d",&a[i]);
                                     ^
luck.cpp:23:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (i=0;i<n;i++) scanf("%d",&b[i]);
                                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...