結果
| 問題 |
No.8104 黒に近い、黒
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-01 00:36:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,450 bytes |
| コンパイル時間 | 1,900 ms |
| コンパイル使用メモリ | 179,392 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-23 03:03:30 |
| 合計ジャッジ時間 | 2,595 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
コンパイルメッセージ
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]){
| ^
ソースコード
#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];
}