Submission #20439

#TimeUsernameProblemLanguageResultExecution timeMemory
20439admin복불복 (OJUZ11_luck)C++14
0 / 100
223 ms2024 KiB
#include <bits/stdc++.h> using namespace std; int n, k; int main() { scanf("%d", &n); if(n > 10) return 0; vector<int> a(n), b(n), p(n); for(int i = 0; i < n; i++) scanf("%d", &a[i]); for(int i = 0; i < n; i++) scanf("%d", &b[i]); sort(a.begin(), a.end(), greater<int>()); sort(b.begin(), b.end(), greater<int>()); for(int i= 0; i < n; i++) p[i] = i; int ans = 0; do { vector<int> sc(n); for(int i = 0; i < n; i++) sc[i] = a[i] + b[p[i]]; bool good = true; for(int i = 0; i < k; i++) { int r = 0; for(int j = 0; j < n; j++) { if(sc[j] > sc[i]) r++; } if(r > k) good = false; } for(int i = 0; i < k; i++) { for(int j = k; j < n; j++) { if(sc[j] > sc[i]) good = false; } } if(good) ans += 1; }while(next_permutation(p.begin(), p.end())); printf("%d\n", ans); return 0; }

Compilation message (stderr)

luck.cpp: In function 'int main()':
luck.cpp:6:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &n);
                  ^
luck.cpp:10:48: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for(int i = 0; i < n; i++) scanf("%d", &a[i]);
                                                ^
luck.cpp:11:48: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for(int 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...