Submission #20482

#TimeUsernameProblemLanguageResultExecution timeMemory
20482볼빨간민돌이 (#35)복불복 (OJUZ11_luck)C++11
0 / 100
0 ms1120 KiB
#include <cstdio> #include <algorithm> #include <cstdlib> using namespace std; int n, k, a[101], b[101]; const int mod = 1e9+7; 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]; bool flag=true; for(int i=1; i<=k; i++){ int bigCnt=0; for(int j=1; j<=n; j++) if(t[i] < t[j]) bigCnt++; if(bigCnt+1 > k) flag=false; } if(flag) cnt++; if(cnt>=mod) cnt-=mod; }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]); if(n<=8) sub1(); return 0; }

Compilation message (stderr)

luck.cpp: In function 'int main()':
luck.cpp:34:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &k);
                        ^
luck.cpp:36:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]);
                     ^
luck.cpp:38:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   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...