結果

問題 No.3104 黒に近い、黒
ユーザー なりきち'なりきち'
提出日時 2023-04-01 00:36:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,450 bytes
コンパイル時間 2,008 ms
コンパイル使用メモリ 179,908 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 10:39:39
合計ジャッジ時間 2,865 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'std::vector<long long int> dijkstra(T, T)':
main.cpp:38:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   38 |         auto [c, at] = q.top();
      |              ^
main.cpp:41:19: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   41 |         for(auto& [to, t] : G[at]){
      |                   ^

ソースコード

diff #

#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep_S(i,r,n) for(int i = r; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
#define RSort(a) sort(a.rbegin(), a.rend())
#define Output(a) cout << a << endl
 
typedef long long int ll;

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vst;

const ll INF = 0x1fffffffffffffff;
const ll MOD = 1000000007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n, m;
vector<vector<array<long long, 2>>> G;
vector<ll> memo;

template <typename T>
vector<long long> dijkstra(T x, T e = -1){
    vector<long long> cost(n, INF);
 
    using P = pair<long long, long long>;
    priority_queue<P, vector<P>, greater<>> q;
    q.emplace(0, x);
    
    while(q.size()){
        auto [c, at] = q.top();
        q.pop();
        if(c > cost[at]) continue;
        for(auto& [to, t] : G[at]){
            if(t == e) continue;
            if(cost[to] > c + 1){
                if(e == -1) memo[t] = 1;
                cost[to] = c + 1;
                q.emplace(cost[to], to);
            }
        }
    }
    return cost;
}

int main(){
    vll t = {0, 0, 1, 1, 2, 3, 5, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11};
    ll n;
    cin >> n;
    cout << t[n-1];
}
0