제출 #1124235

#제출 시각아이디문제언어결과실행 시간메모리
1124235hainam2k9Kitchen (BOI19_kitchen)C++20
100 / 100
17 ms584 KiB
#include <bits/stdc++.h> #define tt cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0) #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout) #define ll long long #define ull unsigned long long #define i128 __int128 #define db long double #define sz(a) ((int)(a).size()) #define pb emplace_back #define pf emplace_front #define pob pop_back #define pof pop_front #define lb lower_bound #define ub upper_bound #define fi first #define se second #define ins emplace #define mp make_pair using namespace std; const int MOD = 1e9+7, MAXN = 1e5+5; const string NAME = ""; int n,m,k,x,dp[MAXN],sum=0; int main() { tt; if(fopen((NAME + ".INP").c_str(), "r")) fo; cin >> n >> m >> k; for(int i = 1; i<=n; ++i){ cin >> x, sum+=x; if(x<k){ cout << "Impossible"; return 0; } } memset(dp,-0x3f,sizeof(dp)); dp[0]=0; for(int i = 1; i<=m; ++i){ cin >> x; for(int j = 300*300; j>=x; --j) dp[j]=max(dp[j],dp[j-x]+min(x,n)); } for(int i = sum; i<=300*300; ++i) if(dp[i]>=n*k){ cout << i-sum; return 0; } cout << "Impossible"; }

컴파일 시 표준 에러 (stderr) 메시지

kitchen.cpp: In function 'int main()':
kitchen.cpp:3:19: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
      |            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kitchen.cpp:26:45: note: in expansion of macro 'fo'
   26 |     if(fopen((NAME + ".INP").c_str(), "r")) fo;
      |                                             ^~
kitchen.cpp:3:63: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
      |                                                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kitchen.cpp:26:45: note: in expansion of macro 'fo'
   26 |     if(fopen((NAME + ".INP").c_str(), "r")) fo;
      |                                             ^~
#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...