結果

問題 No.2701 A cans -> B cans
ユーザー hirayuu_ychirayuu_yc
提出日時 2024-02-29 18:11:57
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 6,873 bytes
コンパイル時間 7,596 ms
コンパイル使用メモリ 349,452 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-02-29 18:18:39
合計ジャッジ時間 17,551 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,548 KB
testcase_01 AC 1 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 258 ms
6,548 KB
testcase_04 AC 257 ms
6,548 KB
testcase_05 AC 259 ms
6,548 KB
testcase_06 AC 270 ms
6,548 KB
testcase_07 AC 260 ms
6,548 KB
testcase_08 AC 258 ms
6,548 KB
testcase_09 AC 259 ms
6,548 KB
testcase_10 AC 271 ms
6,548 KB
testcase_11 AC 261 ms
6,548 KB
testcase_12 AC 259 ms
6,548 KB
testcase_13 AC 260 ms
6,548 KB
testcase_14 AC 270 ms
6,548 KB
testcase_15 AC 260 ms
6,548 KB
testcase_16 AC 260 ms
6,548 KB
testcase_17 AC 258 ms
6,548 KB
testcase_18 AC 270 ms
6,548 KB
testcase_19 AC 259 ms
6,548 KB
testcase_20 AC 258 ms
6,548 KB
testcase_21 AC 260 ms
6,548 KB
testcase_22 AC 271 ms
6,548 KB
testcase_23 AC 2 ms
6,548 KB
testcase_24 AC 3 ms
6,548 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 AC 3 ms
6,548 KB
testcase_57 AC 3 ms
6,548 KB
testcase_58 AC 3 ms
6,548 KB
testcase_59 AC 3 ms
6,548 KB
testcase_60 AC 4 ms
6,548 KB
testcase_61 AC 5 ms
6,548 KB
testcase_62 AC 3 ms
6,548 KB
testcase_63 AC 3 ms
6,548 KB
testcase_64 AC 3 ms
6,548 KB
testcase_65 AC 3 ms
6,548 KB
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 WA -
testcase_75 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//*/
#include<atcoder/all>
using namespace atcoder;
using mint = modint998244353;
#if 1
//https://tatyam.hatenablog.com/entry/2019/12/15/003634 を大きく参考にし、一部使わせてもらいました。感謝…!
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> using pq=priority_queue<T,vector<T>,greater<T>>;
using pll=pair<ll,ll>;
const ll INFL=1LL<<60;
#define _overload3(_1,_2,_3,name,...) name
#define _overload4(_1,_2,_3,_4,name,...) name
#define _rep1(i,n) for(ll i=0; i<(n); i++)
#define _rep2(i,a,b) for(ll i=(a); i<(b); i++)
#define _rep3(i,a,b,c) for(ll i=(a); i<(b); i+=(c))
#define rep(...) _overload4(__VA_ARGS__,_rep3,_rep2,_rep1)(__VA_ARGS__)
#define _rrep1(i,n) for(ll i=(n); i-->0;)
#define _rrep2(i,a,b) for(ll i=(b); i-->(a);)
#define rrep(...) _overload3(__VA_ARGS__,_rrep2,_rrep1)(__VA_ARGS__)
#define each(i,...) for(auto&& i:__VA_ARGS__)
#define all(i) begin(i),end(i)
#define rall(i) rbegin(i),rend(i)
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return true;}else return false;}
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return true;}else return false;}
template<class T> ll sum(const T &a){return accumulate(all(a),0LL);}
template<class T> auto min(const T &a){return *min_element(all(a));}
template<class T> auto max(const T &a){return *max_element(all(a));}
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(char a[]){ scanf("%s", a); }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(deque<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin >> a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline void print(){ putchar(' '); }
inline void print(const bool &a){ printf("%d", a); }
inline void print(const int &a){ printf("%d", a); }
inline void print(const unsigned &a){ printf("%u", a); }
inline void print(const long &a){ printf("%ld", a); }
inline void print(const long long &a){ printf("%lld", a); }
inline void print(const unsigned long long &a){ printf("%llu", a); }
inline void print(const char &a){ printf("%c", a); }
inline void print(const char a[]){ printf("%s", a); }
inline void print(const float &a){ printf("%.15f", a); }
inline void print(const double &a){ printf("%.15f", a); }
inline void print(const long double &a){ printf("%.15Lf", a); }
inline void print(const string &a){ for(auto&& i : a) print(i); }
template<class T> inline void print(const vector<T> &vec);
template<class T, size_t size> inline void print(const array<T, size> &vec);
template<class T, class L> inline void print(const pair<T, L> &p);
template<class T, size_t size> inline void print(const T (&vec)[size]);
template<class T> inline void print(const vector<T> &vec){ if(vec.empty()) return; print(vec[0]); for(auto i = vec.begin(); ++i != vec.end(); ){ putchar(' '); print(*i); } }
template<class T> inline void print(const deque<T> &vec){ if(vec.empty()) return; print(vec[0]); for(auto i = vec.begin(); ++i != vec.end(); ){ putchar(' '); print(*i); } }
template<class T, size_t size> inline void print(const array<T, size> &vec){ print(vec[0]); for(auto i = vec.begin(); ++i != vec.end(); ){ putchar(' '); print(*i); } }
template<class T, class L> inline void print(const pair<T, L> &p){ print(p.first); putchar(' '); print(p.second); }
template<class T, size_t size> inline void print(const T (&vec)[size]){ print(vec[0]); for(auto i = vec; ++i != end(vec); ){ putchar(' '); print(*i); } }
template<class T> inline void print(const T &a){ cout << a; }
inline int out(){ putchar('\n'); return 0; }
template<class T> inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class Head, class... Tail> inline int out(const Head &head, const Tail&... tail){ print(head); putchar(' '); out(tail...); return 0; }
using ld=long double;
using ull=unsigned long long;
using uint=unsigned int;
using pii=pair<int,int>;
using pdd=pair<ld,ld>;
using tuplis=array<ll,3>;
#define vec(type,name,...) vector<type> name(__VA_ARGS__);
#define vv(type,name,h,...)vector<vector<type>> name(h,vector<type>(__VA_ARGS__));
#define INT(...) int __VA_ARGS__; in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__; in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__; in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__; in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__; in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size); in(name)
#define VV(type, name, h, w) vector<vector<type>> name(h, vector<type>(w)); in(name)
template<class T> ld dsum(const T &a){return accumulate(all(a),0.0L);}
const int INF=INT_MAX>>1;
const ll MINF=1LL<<40;
const ld DINF=numeric_limits<ld>::infinity();
const int MODD=1000000007;
const int MOD=998244353;
const ld EPS=1e-9;
const ld PI=3.1415926535897932;
const ll four[]={0,1,0,-1,0};
const ll eight[]={0,1,1,0,-1,-1,1,-1,0};
ll intpow(ll a,ll b){ll ret=1;while(b){if(b&1)ret*=a;a*=a;b>>=1;}return ret;}
int Yes(bool i=true){return out(i?"Yes":"No");}
int No(bool i=true){return out(i?"No":"Yes");}
#define len(x) ((int)(x).size())
#define fi first
#define se second
#endif
int main(){
    INT(N,M);
    N=100;
    vec(ll,dp,M+1,0);
    rep(i,N){
        LL(A,B,C);
        rrep(j,M+1){
            rep(k,1,M+1){
                if(j+A+(k-1)*(A-B)<=M){
                    chmax(dp[j+A+(k-1)*(A-B)],dp[j]+B*C*k);
                }
                else{
                    break;
                }
            }
        }
    }
    rep(i,1,M+1){
        out(dp[i]);
    }
}
0