結果

問題 No.1831 Parasol
ユーザー pockynypockyny
提出日時 2022-02-05 00:23:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 682 bytes
コンパイル時間 776 ms
コンパイル使用メモリ 68,548 KB
実行使用メモリ 5,952 KB
最終ジャッジ日時 2023-09-02 06:17:26
合計ジャッジ時間 2,307 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 19 ms
5,848 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 19 ms
5,876 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 19 ms
5,600 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 14 ms
5,396 KB
testcase_11 AC 19 ms
5,952 KB
testcase_12 AC 9 ms
4,948 KB
testcase_13 AC 19 ms
5,664 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 5 ms
4,384 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 5 ms
4,384 KB
testcase_19 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
int ans[1010][1010];
int main(){
    int i,j,n; cin >> n;
    for(i=0;i<2*n - 1;i++) ans[i][n - 1] = 2*n - 1;
    for(j=0;j<n - 1;j++){
        int l = j + 1,r = 2*n - 1 - l;
        int c = l;
        if(j&1){
            for(i=0;i<2*n - 1;i++){
                if(c>0) ans[i][j] = l, c--;
                else ans[i][j] = r;
            }
        }else{
            for(i=2*n - 2;i>=0;i--){
                if(c>0) ans[i][j] = l, c--;
                else ans[i][j] = r;
            }
        }
    }
    cout << 2*n - 1 << endl;
    for(i=0;i<2*n - 1;i++){
        for(j=0;j<n;j++) cout << ans[i][j] << " ";
        cout << endl;
    }
}
0