제출 #246802

#제출 시각아이디문제언어결과실행 시간메모리
246802sealnot123Two Dishes (JOI19_dishes)C++14
10 / 100
1847 ms43840 KiB
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(),(a).end()
#define SZ(a) (int)(a).size()
#define FOR(i, a, b) for(int i=(a); i<=(b); ++i)
#define iFOR(i, a, b) for(int i=(a); i>=(b); --i)
#define make_unique(a) sort(all((a))), (a).resize(unique(all((a)))-(a).begin())

using namespace std;

typedef pair<int,int> PII;
typedef long long LL;
typedef double DD;
typedef long double LD;
typedef pair<LL,LL> PLL;
typedef pair<DD,DD> PDD;
typedef vector<int> VI;
typedef vector<LL> VL;

const int N = 2020;
int dp[N][N];
LL A[N], B[N];
LL S[N], T[N];
LL P[N], Q[N];

int main(){
    int m,n;
    scanf("%d %d",&n,&m);
    FOR(i, 1, n) scanf("%lld %lld %lld",&A[i],&S[i],&P[i]), A[i] += A[i-1];
    FOR(i, 1, m) scanf("%lld %lld %lld",&B[i],&T[i],&Q[i]), B[i] += B[i-1];
    
    FOR(i, 0, n){
        FOR(j, 0, m){
            if(i > 0) dp[i][j] = max(dp[i][j], dp[i-1][j]+(A[i]+B[j]<=S[i]));
            if(j > 0) dp[i][j] = max(dp[i][j], dp[i][j-1]+(A[i]+B[j]<=T[j]));
        }
    }
    printf("%lld",dp[n][m]);
	return 0;
}
/*
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

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

dishes.cpp: In function 'int main()':
dishes.cpp:41:27: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int' [-Wformat=]
     printf("%lld",dp[n][m]);
                   ~~~~~~~~^
dishes.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~~
dishes.cpp:32:59: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     FOR(i, 1, n) scanf("%lld %lld %lld",&A[i],&S[i],&P[i]), A[i] += A[i-1];
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
dishes.cpp:33:59: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     FOR(i, 1, m) scanf("%lld %lld %lld",&B[i],&T[i],&Q[i]), B[i] += B[i-1];
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...