競プロC++ dijkstra法

背景
投稿者投稿者Johannいいね1お気に入り登録
プレイ回数661難易度(3.1) 180秒 英語
競プロで早く打てるようになりたいC++er向け
自分の手ぐせも込みで早く打ちたいから作りました。
そういった理由から別の方には向かないかもしれません
順位 名前 スコア 称号 打鍵/秒 正誤率 時間(秒) 打鍵数 ミス 問題 日付
1 ku 4777 B 4.8 98.8% 180.0 870 10 46 2024/04/07
2 ku 3916 D++ 3.9 100% 180.0 705 0 35 2024/03/11
3 にゅ 3177 E++ 3.5 91.2% 180.0 633 61 32 2024/03/11

関連タイピング

問題文

ふりがな非表示 ふりがな表示

(#include <iostream>)

#include <iostream>

(#include <vector>)

#include <vector>

(#include <queue>)

#include <queue>

(using namespace std;)

using namespace std;

(using ll = long long;)

using ll = long long;

(struct Edge{)

struct Edge{

(int to;)

int to;

(ll weight;)

ll weight;

(Edge(int t, ll w): to(t), weight(w) {})

Edge(int t, ll w): to(t), weight(w) {}

(int main(){)

int main(){

(int n, m;)

int n, m;

(cin >> n >> m;)

cin >> n >> m;

(for(int i = 0; i < m; ++i){)

for(int i = 0; i < m; ++i){

(int a, b;)

int a, b;

(ll c;)

ll c;

(cin >> a >> b >> c;)

cin >> a >> b >> c;

(--a;)

--a;

(--b;)

--b;

(g[a].push_back(Edge(b, c));)

g[a].push_back(Edge(b, c));

(g[b].push_back(Edge(a, c));)

g[b].push_back(Edge(a, c));

など

(priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq;)

priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq;

(pq.push({0, 0});)

pq.push({0, 0});

(const ll INF = 1ll << 60;)

const ll INF = 1ll << 60;

(vector<ll> dist(n, INF);)

vector<ll> dist(n, INF);

(dist[0] = 0;)

dist[0] = 0;

(while(!pq.empty()){)

while(!pq.empty()){

(auto [d, v] = pq.top();)

auto [d, v] = pq.top();

(pq.pop();)

pq.pop();

(if(dist[v] != d) continue;)

if(dist[v] != d) continue;

(for(auto ne: g[v]){)

for(auto ne: g[v]){

(int nv = ne.to;)

int nv = ne.to;

(if(dist[nv] > dist[v] + ne.weight){)

if(dist[nv] > dist[v] + ne.weight){

(dist[nv] = dist[v] + ne.weight;)

dist[nv] = dist[v] + ne.weight;

(pq.push({dist[nv], nv});)

pq.push({dist[nv], nv});

(ll res = dist.back();)

ll res = dist.back();

(if(res == INF) res = -1;)

if(res == INF) res = -1;

(cout << res << endl;)

cout << res << endl;

(return 0;)

return 0;

問題文を全て表示 一部のみ表示 誤字・脱字等の報告

◆コメントを投稿

※誹謗中傷、公序良俗に反するコメント、個人情報の投稿、歌詞の投稿、出会い目的の投稿、無関係な宣伝行為は禁止です。削除対象となります。

※このゲームにコメントするにはログインが必要です。

※コメントは日本語で投稿してください。