結果

問題 No.1473 おでぶなおばけさん
ユーザー chocono2230chocono2230
提出日時 2021-04-09 23:10:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,391 bytes
コンパイル時間 2,394 ms
コンパイル使用メモリ 210,172 KB
実行使用メモリ 9,408 KB
最終ジャッジ日時 2023-09-07 12:56:00
合計ジャッジ時間 9,672 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 170 ms
9,260 KB
testcase_03 AC 129 ms
8,348 KB
testcase_04 AC 104 ms
6,452 KB
testcase_05 AC 40 ms
4,460 KB
testcase_06 AC 179 ms
8,552 KB
testcase_07 AC 158 ms
9,408 KB
testcase_08 AC 209 ms
9,364 KB
testcase_09 AC 164 ms
9,364 KB
testcase_10 AC 85 ms
5,120 KB
testcase_11 AC 88 ms
6,296 KB
testcase_12 AC 85 ms
5,620 KB
testcase_13 AC 51 ms
4,596 KB
testcase_14 AC 38 ms
4,384 KB
testcase_15 AC 72 ms
5,428 KB
testcase_16 AC 81 ms
5,232 KB
testcase_17 AC 7 ms
4,380 KB
testcase_18 AC 12 ms
4,380 KB
testcase_19 AC 76 ms
5,644 KB
testcase_20 AC 99 ms
7,844 KB
testcase_21 AC 127 ms
6,828 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 187 ms
8,372 KB
testcase_26 AC 193 ms
8,356 KB
testcase_27 AC 60 ms
4,716 KB
testcase_28 AC 181 ms
9,344 KB
testcase_29 AC 132 ms
6,960 KB
testcase_30 AC 160 ms
7,576 KB
testcase_31 AC 131 ms
9,316 KB
testcase_32 AC 139 ms
8,664 KB
testcase_33 AC 102 ms
7,792 KB
testcase_34 AC 55 ms
5,524 KB
testcase_35 AC 59 ms
5,692 KB
testcase_36 AC 109 ms
6,200 KB
testcase_37 AC 123 ms
7,544 KB
testcase_38 AC 24 ms
4,380 KB
testcase_39 AC 83 ms
4,868 KB
testcase_40 AC 83 ms
4,844 KB
testcase_41 AC 74 ms
4,772 KB
testcase_42 AC 73 ms
4,960 KB
testcase_43 AC 90 ms
6,856 KB
testcase_44 AC 91 ms
6,900 KB
testcase_45 AC 90 ms
7,032 KB
testcase_46 AC 110 ms
7,232 KB
testcase_47 AC 134 ms
8,112 KB
testcase_48 AC 127 ms
7,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int fc(const vector<vector<pair<int, int>>> &gr, int mid) {
  int n = gr.size();
  vector<int> chk(n, -1);
  queue<int> q;
  chk.at(0) = 0; q.push(0);
  while(!q.empty()) {
    auto now = q.front(); q.pop();
    for(auto [nx, c] : gr.at(now)) {
      if(c < mid) continue;
      if(chk.at(nx) != -1) continue;
      chk.at(nx) = chk.at(now) + 1;
      q.push(nx);
    }
  }
  return chk.back();
}

int main() {
  int n, m;
  cin >> n >> m;
  vector gr(n, vector<pair<int, int>>());
  rep(i, m) {
    int s, t, d;
    cin >> s >> t >> d;
    s--; t--;
    gr.at(s).push_back({t, d});
    gr.at(t).push_back({s, d});
  }
  int ok = 1, ng = 1001001001;
  int ans = 0;
  while(ng - ok > 1) {
    int mid = (ok+ng)/2;
    int r = fc(gr, mid);
    // cerr << r << " " << mid << endl;
    if(r != -1) {
      ok = mid;
      ans = r;
    } else ng = mid;
  }
  cout << ok << " " << ans << endl;
  return 0;
}
0