結果

問題 No.1992 Tendon Walk
ユーザー zezerozezero
提出日時 2022-07-09 19:12:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,070 bytes
コンパイル時間 955 ms
コンパイル使用メモリ 72,184 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-30 03:18:08
合計ジャッジ時間 1,460 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int ans[11];
int main(){
    int x;
    cin >> x;
    for (int i = 0; i < 11;i++){
        ans[i] = 100000;
    }
    int pos = 0;
    int move = 0;
    for (int i = 0; i < 100;i++){
        pos += 2;
        move += 2;
        if (pos < 11){
            ans[pos] = min(ans[pos],move);
        }
        pos += 2;
        move += 2;
        if (pos < 11){
            ans[pos] = min(ans[pos],move);
        }
        pos--;
        move++;
        if (pos < 11){
            ans[pos] = min(ans[pos],move);
        }
        pos--;
        move++;
        if (pos < 11){
            ans[pos] = min(ans[pos],move);
        }
        pos += 2;
        move += 2;
        if (pos < 11){
            ans[pos] = min(ans[pos],move);
        }
        pos--;
        move++;
        if (pos < 11){
            ans[pos] = min(ans[pos],move);
        }
        pos--;
        move++;
        if (pos < 11){
            ans[pos] = min(ans[pos],move);
        }
    }
    cout << ans[x] << endl;
    return 0;
}

        
0