結果
| 問題 | No.1500 Super Knight |
| コンテスト | |
| ユーザー |
sirogamichan1
|
| 提出日時 | 2021-04-25 14:10:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,447 bytes |
| 記録 | |
| コンパイル時間 | 1,614 ms |
| コンパイル使用メモリ | 179,664 KB |
| 実行使用メモリ | 19,968 KB |
| 最終ジャッジ日時 | 2024-07-04 09:26:46 |
| 合計ジャッジ時間 | 5,203 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 TLE * 1 |
| other | -- * 33 |
コンパイルメッセージ
main.cpp: In lambda function:
main.cpp:30:51: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
30 | for (auto [h, w] : pre)
| ^
main.cpp:32:67: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
32 | for (auto [dh, dw] : p)
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = array<ll, 2>;
vector<P> p {
{3, 2}, {2, 3},
{-2, 3}, {-3, 2},
{-3, -2}, {-2, -3},
{2, -3}, {3, -2},
{-3, 0}, {3, 0},
{0, 3}, {0, -3},
};
int main(int argc, char **argv)
{
ll N; cin >> N;
auto solve = [](ll N)
{
vector<ll> memo;
set<P> now, pre;
pre.insert({0, 0});
memo.push_back(1);
for (ll i = 0; i < N; ++i)
{
now = {};
for (auto [h, w] : pre)
{
for (auto [dh, dw] : p)
{
ll hh = h + dh;
ll ww = w + dw;
now.insert({hh, ww});
}
}
// デバッグ用
/*
{
std::cout << "########" << i+1 << "######"<< std::endl;
// グリッド表示
std::cout << "grid : " << std::endl;
const ll S = 80;
vector<vector<bool>> dis(S, vector<bool>(S, false));
for (auto [h, w] : now)
{
dis[h+S/2][w+S/2] = true;
}
for (ll h = 0; h < S; ++h)
{
for (ll w = 0; w < S; ++w)
{
char c = '.';
if (dis[h][w])
c = '#';
std::cout << c << " ";
}
std::cout << std::endl;
}
// マスの数
std::cout << "cnt : " << now.size() << std::endl;
}
*/
swap(now, pre);
}
return pre.size();
};
std::cout << solve(N) << std::endl;
}
sirogamichan1