結果

問題 No.1587 012 Matrix
ユーザー kmjpkmjp
提出日時 2021-07-08 23:32:45
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 13 ms / 1,000 ms
コード長 1,068 bytes
コンパイル時間 1,815 ms
使用メモリ 4,480 KB
最終ジャッジ日時 2023-02-01 19:25:01
合計ジャッジ時間 3,539 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
3,576 KB
testcase_01 AC 1 ms
3,560 KB
testcase_02 AC 1 ms
3,596 KB
testcase_03 AC 2 ms
3,412 KB
testcase_04 AC 2 ms
3,420 KB
testcase_05 AC 1 ms
3,488 KB
testcase_06 AC 2 ms
3,568 KB
testcase_07 AC 1 ms
3,496 KB
testcase_08 AC 2 ms
3,616 KB
testcase_09 AC 2 ms
3,556 KB
testcase_10 AC 2 ms
3,668 KB
testcase_11 AC 2 ms
3,652 KB
testcase_12 AC 3 ms
3,856 KB
testcase_13 AC 5 ms
3,976 KB
testcase_14 AC 6 ms
4,128 KB
testcase_15 AC 7 ms
4,268 KB
testcase_16 AC 9 ms
4,312 KB
testcase_17 AC 11 ms
4,336 KB
testcase_18 AC 11 ms
4,396 KB
testcase_19 AC 12 ms
4,424 KB
testcase_20 AC 12 ms
4,440 KB
testcase_21 AC 13 ms
4,480 KB
testcase_22 AC 2 ms
3,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int N;
int A[505][505];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	for(x=1;x<N;x+=2) {
		for(y=x-1;y<N;y++) A[y][x]=2;
	}
	for(y=1;y<N;y+=2) {
		A[y][y-1]=1;
		for(x=y;x<N;x++) A[y][x]=2;
	}
	
	FOR(y,N) {
		FOR(x,N) cout<<A[y][x];
		cout<<endl;
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0