結果

問題 No.1037 exhausted
ユーザー TonalidadeHidricaTonalidadeHidrica
提出日時 2020-04-24 22:25:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,185 bytes
コンパイル時間 2,486 ms
コンパイル使用メモリ 213,088 KB
実行使用メモリ 438,656 KB
最終ジャッジ日時 2024-04-23 03:35:02
合計ジャッジ時間 8,329 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 1 ms
6,940 KB
testcase_09 WA -
testcase_10 AC 1 ms
6,940 KB
testcase_11 WA -
testcase_12 AC 287 ms
83,584 KB
testcase_13 AC 291 ms
83,072 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 298 ms
86,400 KB
testcase_17 AC 293 ms
86,400 KB
testcase_18 AC 301 ms
88,064 KB
testcase_19 WA -
testcase_20 AC 772 ms
203,392 KB
testcase_21 AC 933 ms
282,624 KB
testcase_22 AC 1,569 ms
438,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

using pll = pair<ll, ll>;
map<ll, vector<pll>> g;
pque<pll> que;
set<ll> st;

int main(){
	int n; ll u, l; scanf("%d%lld%lld", &n, &u, &l);
	REP(i, n){
		ll x, v, w; scanf("%lld%lld%lld", &x, &v, &w);
		REP(j, u){
			g[x + j].EB(x + min(j+v, u), w);
		}
	}
	que.emplace(0, u);
	while(que.size()){
		ll w = que.top().first, x = que.top().second; que.pop();
		if(x >= l){
			printf("%lld\n", w);
			return 0;
		}
		if(st.find(x) != st.end()) continue;
		st.emplace(x);
		for(auto &p : g[x]){
			que.emplace(w + p.second, p.first);
		}
	}
	printf("-1\n");
}
0