結果

問題 No.1399 すごろくで世界旅行 (構築)
ユーザー yosswi414yosswi414
提出日時 2019-12-25 02:14:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 808 bytes
コンパイル時間 1,710 ms
コンパイル使用メモリ 174,392 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 17:11:46
合計ジャッジ時間 23,984 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 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 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 59 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long
using pi=pair<int,int>;
signed main(){
    int v, d;
    cin >> v >> d;
    vector<vector<bool>> G(v, vector<bool>(v, false));
    if(d==1)G=vector<vector<bool>>(v,vector<bool>(v,true));
    else{
        if(v==2){
            G[0][0] = G[0][1] = G[1][0] = true;
        }
        else{
            for (int i = 1; i + 1 < v; i += 2){
                G[i][0] = G[0][i] = true;
                G[i + 1][0] = G[0][i + 1] = true;
                G[i][i + 1] = G[i + 1][i] = true;
            }
            if(v%2==0){
                G[v - 1][0] = G[0][v - 1] = true;
                G[v - 1][v - 2] = G[v - 2][v - 1] = true;
            }
        }
    }
    for(auto g:G){
        for(auto i:g)
            cout << i;
        cout << endl;
    }
}
0