結果
問題 |
No.3108 Luke or Bishop
|
ユーザー |
|
提出日時 | 2025-04-19 02:40:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 2,739 bytes |
コンパイル時間 | 1,377 ms |
コンパイル使用メモリ | 104,332 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-19 02:40:20 |
合計ジャッジ時間 | 2,450 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <optional> #include <stdexcept> #include <sstream> #include <chrono> #include <cstdlib> //rand()を使うために必要 #include <time.h> #include <set> #include <stack> #include <queue> using namespace std; vector<int> dx = {0, 0, -1, 1}; vector<int> dy = {-1, 1, 0, 0}; int N; vector<string> C; int SIMULATE_TIME = 100; double C_SA = SIMULATE_TIME * 10000; // かける値は適当。 const int MOVE_NUM = 2000000000; const double limit_calc = 2.; int cnt_eval = 0; struct StopWatch { clock_t sum_time = 0; clock_t tmp_start_time; }; void start_stop_watch(StopWatch &stop_watch) { stop_watch.tmp_start_time = clock(); } void stop_stop_watch(StopWatch &stop_watch) { stop_watch.sum_time += clock() - stop_watch.tmp_start_time; } double get_sum_time(StopWatch &stop_watch) { return 1. * stop_watch.sum_time / CLOCKS_PER_SEC; } struct State { vector<bool> used_tile; vector<int> op; int score; int now_i, now_j; }; struct Input { int s_i, s_j; vector<vector<int>> t; vector<vector<int>> p; }; Input input; void init_input() { cin >> input.s_i >> input.s_j; for (int i = 0; i < 50; i++) { vector<int> t_vec; for (int j = 0; j < 50; j++) { int t_; cin >> t_; t_vec.push_back(t_); } input.t.push_back(t_vec); } for (int i = 0; i < 50; i++) { vector<int> p_vec; for (int j = 0; j < 50; j++) { int p_; cin >> p_; p_vec.push_back(p_); } input.p.push_back(p_vec); } } bool use_tile(int i, int j, State &state) { if (i < 0 || i >= 50 || j < 0 || j >= 50) return false; if (state.used_tile[input.t[i][j]]) return false; return state.used_tile[input.t[i][j]] = true; } void init_state(State &state) { state.score = 0; state.now_i = input.s_i; state.now_j = input.s_j; for (int i = 0; i < 50 * 50; i++) state.used_tile.push_back(false); use_tile(input.s_i, input.s_j, state); } bool operator<(const State &state1, const State &state2) { return state1.score < state2.score; }; void beam_search(State &state) { priority_queue<State> state_que; state_que.push(state); } void solve() { long long gx, gy; cin >> gx >> gy; if (gx == 0 && gy == 0) cout << 0 << endl; else if (abs(gx) == abs(gy) || gx == 0 || gy == 0) cout << 1 << endl; else cout << 2 << endl; } void check_sw() { // cout << "評価値算出=" << get_sum_time(eval_calculation_sw) / cnt_eval << endl; } int main() { solve(); // test(); // check_sw(); }