Submission #20576

#TimeUsernameProblemLanguageResultExecution timeMemory
20576CodingAmolang (#35)복불복 (OJUZ11_luck)C++11
0 / 100
0 ms1172 KiB
#include<stdio.h> #include<algorithm> #include<vector> int A[110]; int B[110]; int main() { int n, k; scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) { scanf("%d", &A[i]); } for (int i = 0; i < n; i++) { scanf("%d", &B[i]); } std::vector<int> win; std::vector<int> lose; for (int i = 0; i < n; i++) { int cnt = 0; for (int j = 0; j < n; j++) { if (A[i] < A[j]) { cnt++; } } if (cnt+1 <= k) { win.push_back(A[i]); } else { lose.push_back(A[i]); } } if (n <= 8 && k <= 8) { std::vector<int> order; for (int i = 0; i < n; i++) { order.push_back(i); } long long ans = 0; do { int p = 0; for (int &i : win) { i += B[order[p]]; p++; } for (int& i : lose) { i += B[order[p]]; p++; } bool falg = false; for (int i : win) { for (int j : lose) { if (j > i) { falg = true; } } } if (!falg) { ans++; } } while (std::next_permutation(order.begin(), order.end())); printf("%lld", ans % 1000000007); } }

Compilation message (stderr)

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