結果

問題 No.1169 Row and Column and Diagonal
ユーザー cookiedothcookiedoth
提出日時 2020-08-14 21:40:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 1,956 bytes
コンパイル時間 1,286 ms
コンパイル使用メモリ 127,888 KB
最終ジャッジ日時 2025-01-12 23:26:53
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

/*

Code for problem B by cookiedoth
Generated 14 Aug 2020 at 03.24 PM


▅███████ ]▄▄▄▄▄▄▄ 
█████████▅▄▃ 
Il████████████████] 
◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

~_^
z_z
>_<

*/

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <complex>
#include <cassert>
#include <random>
#include <cstring>
#include <numeric>
#define ll long long
#define ld long double
#define null NULL
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define debug(a) cerr << #a << " = " << a << endl
#define forn(i, n) for (int i = 0; i < n; ++i)
#define sz(a) (int)a.size()

using namespace std;

template<class T> int chkmax(T &a, T b) {
	if (b > a) {
		a = b;
		return 1;
	}
	return 0;
}

template<class T> int chkmin(T &a, T b) {
	if (b < a) {
		a = b;
		return 1;
	}
	return 0;
}

template<class iterator> void output(iterator begin, iterator end, ostream& out = cerr) {
	while (begin != end) {
		out << (*begin) << " ";
		begin++;
	}
	out << endl;
}

template<class T> void output(T x, ostream& out = cerr) {
	output(x.begin(), x.end(), out);
}

void fast_io() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

const int mx = 510;
int n, a[mx][mx];

signed main() {
	fast_io();
	cin >> n;
	vector<int> diag;
	for (int i = 0; i < 2 * n - 1; ++i) {
		if (i % 2 == 0) {
			diag.push_back(i / 2);
		} else {
			if (i >= n) {
				diag.push_back((i - n) / 2);
			} else {
				diag.push_back(i / 2 + n / 2 + 1);
			}
		}
	}
	// output(all(diag));
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			cout << diag[i + j] + 1 << ' ';
		}
		cout << '\n';
	}
}
0