Submission #126703

#TimeUsernameProblemLanguageResultExecution timeMemory
126703dndhkTwo Dishes (JOI19_dishes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back #define all(v) ((v).begin(), (v).end()) #define sortv(v) sort(all(v)) #define sz(v) ((int)(v).size()) #define uniqv(v) (v).erase(unique(all(v)), (v).end()) #define umax(a, b) (a)=max((a), (b)) #define umin(a, b) (a)=min((a), (b)) #define FOR(i,a,b) for(int i = (a); i <= (b); i++) #define rep(i,n) FOR(i,1,n) #define rep0(i,n) FOR(i,0,(int)(n)-1) #define FI first #define SE second #define INF 2000000000 #define INFLL 1000000000000000000LL using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAX_N = 2000; int N, M; struct S{ S(int t, int l, int c) : t(t), l(l), c(c) {} int t, l, c; }; vector<S> A, B; int dp[MAX_N+1][MAX_N+1]; ll S1[MAX_N+10], S2[MAX_N+10]; void pro1(){ int ans = 0; for(int i=0; i<=N; i++){ for(int j=0; j<=M; j++){ if(i!=N){ dp[i+1][j] = max(dp[i+1][j], dp[i][j] + (S1[i] + S2[j] <= A[i].l - A[i].t)); }if(j!=M){ dp[i][j+1] = max(dp[i][j+1], dp[i][j] + (S1[i] + S2[j] <= B[j].l - B[j].t)); } ans = max(ans, dp[i][j]); } } cout<<ans; } int main(){ scanf("%d%d", &N, &M); for(int i=0; i<N; i++){ int a, b, c; scanf("%d%d%d", &a, &b, &c); A.pb({a, b, c}); S1[i+1] = S1[i] + (ll)a; } for(int i=0; i<M; i++){ int a, b, c; scanf("%d%d%d", &a, &b, &c); B.pb({a, b, c}); S2[i+1] = S2[i] + (ll)a; } if(N<=2000 && M<=2000){ pro1(); }else{ pro2(); } return 0; }

Compilation message (stderr)

dishes.cpp: In function 'int main()':
dishes.cpp:68:3: error: 'pro2' was not declared in this scope
   pro2();
   ^~~~
dishes.cpp:68:3: note: suggested alternative: 'pro1'
   pro2();
   ^~~~
   pro1
dishes.cpp:52:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &M);
  ~~~~~^~~~~~~~~~~~~~~~
dishes.cpp:55:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", &a, &b, &c);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
dishes.cpp:61:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d", &a, &b, &c);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~