Submission #20476

#TimeUsernameProblemLanguageResultExecution timeMemory
20476책상다리황새두렁넘기 (#35)복불복 (OJUZ11_luck)C++11
9 / 100
1000 ms2020 KiB
#include<bits/stdc++.h> using namespace std; int n, k, a[105], b[105], per[105], ans; 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]); } sort(a+1, a+1+n); reverse(a+1, a+1+n); for(int i=1;i<=n;i++) per[i] = i; do { int flag = 1; for(int i=1;i<=k;i++) { for(int j=k+1;j<=n;j++) { if(a[i]+b[per[i]] < a[j]+b[per[j]]) { flag = 0; break; } } if(!flag) break; } ans += flag; } while(next_permutation(per+1, per+1+n)); printf("%d\n",ans); }

Compilation message (stderr)

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