Submission #20507

#TimeUsernameProblemLanguageResultExecution timeMemory
20507안녕하세요 투어리스트입니다 진짜에요 (#35)복불복 (OJUZ11_luck)C++14
0 / 100
3 ms2032 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pp; void read(int& x){ scanf("%d",&x); } template<typename T,typename... Args> void read(T& a,Args&... b){ read(a); read(b...); } #define all(x) (x).begin(),(x).end() #define pb push_back int n, k; int a[1010]; int b[1010]; const ll M=int(1e9)+7; void in(){ read(n, k); for(int i=1; i<=n; ++i) read(a[i]); sort(a+1, a+n+1, greater<int>()); for(int i=1; i<=n; ++i) read(b[i]); sort(b+1, b+n+1); } void naive(){ int ind[1010]; for(int i=1; i<=n; ++i) ind[i]=i; int ans=0; int c[1010]; do { for(int i=1; i<=n; ++i) c[i]=a[i]+b[ind[i]]; bool flg=1; for(int i=1; i<=k; ++i){ if(count_if(c+1, c+n+1, [&](int x){ return x > c[i]; })+1 > k) flg=0; } ans += flg; } while(next_permutation(ind+1, ind+n+1)); printf("%d\n", ans); } int main() { #ifdef NAMSEO freopen("in", "r", stdin); #endif in(); if(n<=8) naive(); return 0; }

Compilation message (stderr)

luck.cpp: In function 'void read(int&)':
luck.cpp:5:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 void read(int& x){ scanf("%d",&x); }
                                  ^
#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...