提出 #34403038


ソースコード 拡げる

//SAGAR SINGH
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll                   long long 
#define ld                   long double 
#define abs(a,b)             (ll) abs(a-b)
#define rep(i,a,b)           for(ll i=a;i<b;i++) 
#define repr(i,a,b)          for(ll i=a;i>=b;i--)
#define vll                  vector<long long>
#define vvll                 vector<vector<long long> >
#define vpl                  vector<pair<ll,ll> >
#define pll                  pair<ll,ll> 
#define sll                  set<long long>
#define msll                 multiset<long long>
#define mll                  map<ll,ll>
#define all(x)               x.begin(),x.end()
#define rall(x)              x.rbegin(),x.rend()
#define in(v)                for(auto &x:v) cin>>x;
#define out(v)               for(auto &x:v) {cout<<x<<" ";} cout<<'\n';
#define str                  string
#define pb                   push_back
#define ins                  insert
#define lb                   lower_bound
#define ub                   upper_bound
#define ff                   first
#define ss                   second
#define setbits(a)           ( __builtin_popcountll(a))

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif


const ll mod = 1e9+7;
const ll N = 2e5+1;
const ll INF = 1e18;

vvll dp(N,vll (5,-1));
vvll profit(N,vll (5));

ll helper(ll pit,ll time){
    if(time==N or pit==5) return 0;
    if(dp[time][pit]!=-1) return dp[time][pit];
 
    return dp[time][pit] = profit[time][pit]+max(helper(pit,time+1),helper(pit+1,time+1));
}

void solve(){

ll n;cin>>n;
vvll v(n,vll (3));

rep(i,0,n) cin>>v[i][0]>>v[i][1]>>v[i][2];
rep(i,0,n) profit[v[i][0]][v[i][1]]+=v[i][2];

cout<<helper(0,0)<<'\n';

}

int main(){
    ios_base::sync_with_stdio;
    cin.tie(NULL);cout.tie(0);
    ll t=1;
    while(t--) 
        solve();

    return 0;
}

提出情報

提出日時
問題 D - Snuke Panic (1D)
ユーザ Sagar_
言語 C++ (GCC 9.2.1)
得点 0
コード長 2512 Byte
結果 WA
実行時間 125 ms
メモリ 46184 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:76:15: warning: statement is a reference, not call, to function ‘std::ios_base::sync_with_stdio’ [-Waddress]
   76 |     ios_base::sync_with_stdio;
      |     ~~~~~~~~~~^~~~~~~~~~~~~~~
./Main.cpp:76:15: warning: statement has no effect [-Wunused-value]

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 400
結果
AC × 2
WA × 1
AC × 5
WA × 25
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All hand_01.txt, hand_02.txt, min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
hand_01.txt AC 68 ms 40640 KiB
hand_02.txt AC 65 ms 40552 KiB
min.txt AC 65 ms 40620 KiB
random_01.txt WA 125 ms 46148 KiB
random_02.txt WA 121 ms 46108 KiB
random_03.txt WA 122 ms 46136 KiB
random_04.txt WA 122 ms 46108 KiB
random_05.txt WA 122 ms 45600 KiB
random_06.txt WA 117 ms 45580 KiB
random_07.txt WA 96 ms 43160 KiB
random_08.txt WA 92 ms 43276 KiB
random_09.txt WA 71 ms 41116 KiB
random_10.txt WA 71 ms 41048 KiB
random_11.txt WA 66 ms 40600 KiB
random_12.txt WA 65 ms 40520 KiB
random_13.txt WA 121 ms 46184 KiB
random_14.txt WA 123 ms 46128 KiB
random_15.txt WA 120 ms 46164 KiB
random_16.txt WA 122 ms 46148 KiB
random_17.txt WA 116 ms 45604 KiB
random_18.txt WA 115 ms 45536 KiB
random_19.txt WA 92 ms 43280 KiB
random_20.txt WA 95 ms 43232 KiB
random_21.txt WA 72 ms 41164 KiB
random_22.txt WA 72 ms 41116 KiB
random_23.txt WA 65 ms 40520 KiB
random_24.txt WA 67 ms 40640 KiB
sample_01.txt AC 64 ms 40512 KiB
sample_02.txt AC 63 ms 40644 KiB
sample_03.txt WA 67 ms 40636 KiB