結果
| 問題 | No.3013 ハチマキ買い星人 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-30 04:53:08 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 921 bytes |
| 記録 | |
| コンパイル時間 | 2,948 ms |
| コンパイル使用メモリ | 202,108 KB |
| 実行使用メモリ | 22,644 KB |
| 最終ジャッジ日時 | 2026-08-30 04:53:30 |
| 合計ジャッジ時間 | 12,503 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 26 WA * 19 |
ソースコード
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main(void){
ll n, m, p, y; cin >> n >> m >> p >> y;
vector<vector<P>> to(n);
for(int i=0; i<m; i++){
int u, v; ll w; cin >> u >> v >> w; u--, v--;
to[u].emplace_back(v, w); swap(u, v);
to[u].emplace_back(v, w);
}
vector<ll> d(p), e(p);
for(int i=0; i<p; i++) cin >> d[i] >> e[i];
priority_queue<P, vector<P>, greater<P>> pri;
pri.emplace(0, 0);
vector<ll> dist(n, 1e18);
dist[0]=0;
while(pri.size()){
auto [d, id]=pri.top(); pri.pop();
if(dist[id]!=d) continue;
for(auto [v, w]:to[id]){
ll nd=d+w;
if(dist[v]>nd){
dist[v]=nd;
pri.emplace(nd, v);
}
}
}
ll ans=0;
for(int i=0; i<p; i++){
ll rem=max(0ll, y-dist[i]);
ans=max(ans, rem/e[i]);
}
cout << ans << endl;
return 0;
}