結果

問題 No.1169 Row and Column and Diagonal
ユーザー ohaini1123ohaini1123
提出日時 2020-08-15 01:05:20
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 682 bytes
コンパイル時間 1,598 ms
コンパイル使用メモリ 163,480 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 23:25:54
合計ジャッジ時間 2,760 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 4 ms
5,376 KB
testcase_07 AC 7 ms
5,376 KB
testcase_08 AC 9 ms
5,376 KB
testcase_09 AC 14 ms
5,376 KB
testcase_10 AC 23 ms
5,376 KB
testcase_11 AC 25 ms
5,376 KB
testcase_12 AC 26 ms
5,376 KB
testcase_13 AC 26 ms
5,376 KB
testcase_14 AC 27 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

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 (b<a) { a=b; return 1; } return 0; }

using ll = long long;
using P = pair<ll,ll>;
using graph = vector<vector<int>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
  int N;
  cin>>N;
  vector<int> v(N);
  rep(i,N){
    rep(j,N){
      int ans = (i+j)%N;
      if(ans%2==0) cout<<ans/2+1<<" ";
      else cout<<(ans+N)/2+1<<" ";
    }
    cout<<endl;
  }
}
0