結果

問題 No.2093 Shio Ramen
ユーザー mnmmnm
提出日時 2022-10-07 21:57:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,370 bytes
コンパイル時間 825 ms
コンパイル使用メモリ 98,204 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-03 01:45:49
合計ジャッジ時間 2,272 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <bitset>
#include <map>
#include <set>
#include <queue>
#include <iomanip>

#define rep(i,n) for(i=0; i<n; ++i)
#define inc_rep(i,a,n) for(i=a; i<=n; ++i)
#define dec_rep(i,n,a) for(i=n; i>=a; --i)
#define in(a) cin >> a
#define out(a,b) cout << a << b
#define print_vec(v) for(auto it=v.begin();it!=v.end();++it)cout<<*it <<" ";cout<<endl
#define print_vec2d(v) for(int i=0;i<v.size();++i){for(int j=0;j<v[i].size();++j)cout<<v[i][j]<<" ";cout<<endl;}cout<<endl
using namespace std;
using lint = long long;


int main(void){
    int i, j;
    lint k, cnt=0, x, y;
    lint p, q, n, m;
    string s;
    in(n);in(m);
    vector<pair<lint, lint> > v(n);
    rep(i,n){
        lint a, b;
        in(a);in(b);
        v[i]=make_pair(a, b);
    }
    vector<lint> d(m+1, 0);
    rep(i, n){
        // print_vec(d);
        lint si, ai;
        tie(si, ai) = v[i];
        if(si<=m){
            if(d[si]<ai){
                d[si]=ai;
            }
            rep(j,m+1){
                if(j<=si) continue;
                if(d[j]&&j+si<=m){
                    if(d[j+si]<d[j]+ai)
                    d[j+si]=d[j]+ai;
                }
            }
        }
    }
    out(*max_element(d.begin(), d.end()),endl);
    // print_vec(d);
    return 0;
}
0