結果
問題 | No.1037 exhausted |
ユーザー |
|
提出日時 | 2020-04-24 22:25:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,185 bytes |
コンパイル時間 | 2,733 ms |
コンパイル使用メモリ | 211,040 KB |
最終ジャッジ日時 | 2025-01-10 00:04:30 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:31:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 31 | int n; ll u, l; scanf("%d%lld%lld", &n, &u, &l); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:33:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 33 | ll x, v, w; scanf("%lld%lld%lld", &x, &v, &w); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#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"); }