結果

問題 No.1831 Parasol
ユーザー ytft
提出日時 2022-02-16 11:20:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 1,515 ms
コンパイル使用メモリ 166,544 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 07:13:00
合計ジャッジ時間 3,045 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	int N;
	cin>>N;
	cout<<(2*N-1)<<endl;
    for(int i=0;i<2*N-1;++i){
        for(int j=0;j<N;++j){
            if(j==0){
            	cout<<(i?2*N-2:1)<<' ';
            }else if(j==N-1){
            	cout<<(2*N-1)<<' ';
            }else{
            	if(i>j-2&&i<2*j+1&&i!=2*j-2){
            		cout<<(j+1)<<' ';
            	}else{
            		cout<<(2*N-2-j)<<' ';
            	}
            }
        }
        cout<<endl;
    }
}
0