제출 #165388

#제출 시각아이디문제언어결과실행 시간메모리
165388LawlietCloud Computing (CEOI18_clo)C++14
0 / 100
13 ms1912 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; typedef long long int lli; const int MAXN = 300; int n, m; lli dp[MAXN][MAXN]; vector< pii > buy; vector< pii > sell; lli solve(int i, int j) { if( i < 0 || j < 0 ) return 0; lli& ans = dp[i][j]; if( ans != -1 ) return ans; ans = max( solve( i - 1 , j ) , solve( i , j - 1 ) ); if( buy[i].first >= sell[j].first ) { lli cost = sell[j].second - buy[i].second; ans = max( ans , solve( i - 1 , j - 1 ) + cost ); } ans = max( ans , 0LL ); return ans; } int main() { scanf("%d %d",&n,&m); memset( dp , -1 , sizeof(dp) ); for(int i = 1 ; i <= n ; i++) { int c, f, v; scanf("%d %d %d",&c,&f,&v); buy.push_back( { f , v } ); } for(int i = 1 ; i <= m ; i++) { int c, f, v; scanf("%d %d %d",&c,&f,&v); sell.push_back( { f , v } ); } sort(buy.begin() , buy.end()); sort(sell.begin() , sell.end()); printf("%lld\n",solve( n - 1 , m - 1 )); }

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

clo.cpp: In function 'int main()':
clo.cpp:39:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
clo.cpp:46: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:54: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...