結果
問題 | No.1169 Row and Column and Diagonal |
ユーザー | mot |
提出日時 | 2020-08-14 22:18:03 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 877 bytes |
コンパイル時間 | 734 ms |
コンパイル使用メモリ | 84,528 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-04-18 22:08:14 |
合計ジャッジ時間 | 1,844 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | AC | 1 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,940 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,944 KB |
testcase_06 | AC | 3 ms
6,944 KB |
testcase_07 | AC | 6 ms
6,940 KB |
testcase_08 | AC | 9 ms
6,944 KB |
testcase_09 | AC | 12 ms
6,944 KB |
testcase_10 | AC | 21 ms
6,940 KB |
testcase_11 | AC | 23 ms
6,944 KB |
testcase_12 | AC | 24 ms
6,940 KB |
testcase_13 | AC | 24 ms
6,944 KB |
testcase_14 | AC | 23 ms
6,944 KB |
ソースコード
#include<iostream> #include<iomanip> #include<cmath> #include<string> #include<cstring> #include<vector> #include<list> #include<algorithm> #include<map> #include<set> #include<queue> #include<stack> using namespace std; typedef long long ll; #define fi first #define se second #define mp make_pair #define rep(i, n) for(int i=0;i<n;++i) #define rrep(i, n) for(int i=n;i>=0;--i) const int inf=1e9+7; const ll mod=1e9+7; const ll mod1=998244353; const ll big=1e18; const double PI=2*asin(1); int main() { int N; cin>>N; int ans[N][N]; for(int i=0;i<N;++i) { for(int j=0;j<N;++j) { if((i+j)%2==0) { ans[i][j] = (i+j+2)/2; } else { if(i+j>=N) ans[i][j] = (i+j-N+2)/2; else ans[i][j] = (i+j+N+2)/2; } } } for(int i=0;i<N;++i) { for(int j=0;j<N;++j) { cout<<ans[i][j]<<" "; } cout<<endl; } }