제출 #165396

#제출 시각아이디문제언어결과실행 시간메모리
165396LawlietCloud Computing (CEOI18_clo)C++14
18 / 100
520 ms2040 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; typedef long long int lli; const int MAXS = 50*2000 + 10; const lli INF = 1000000000000000000LL; int n, m; lli dp[MAXS][2]; int main() { scanf("%d",&n); for(int i = 1 ; i < MAXS ; i++) { dp[i][0] = INF; dp[i][1] = -INF; } for(int i = 1 ; i <= n ; i++) { int c, f, v; scanf("%d %d %d",&c,&f,&v); for(int j = MAXS - 1 ; j >= c ; j--) dp[ j ][0] = min( dp[ j - c ][0] + v , dp[ j ][0] ); } scanf("%d",&m); for(int i = 1 ; i <= m ; i++) { int c, f, v; scanf("%d %d %d",&c,&f,&v); for(int j = MAXS - 1 ; j >= c ; j--) dp[ j ][1] = max( dp[ j - c ][1] + v , dp[ j ][1] ); } lli ans = 0; lli mn = INF; for(int i = MAXS - 1 ; i >= 0 ; i--) { mn = min( mn , dp[i][0] ); ans = max( ans , dp[i][1] - mn ); } printf("%lld\n",ans); }

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

clo.cpp: In function 'int main()':
clo.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
clo.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d",&c,&f,&v);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~
clo.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&m);
  ~~~~~^~~~~~~~~
clo.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d",&c,&f,&v);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...