結果

問題 No.1169 Row and Column and Diagonal
ユーザー ohaini1123ohaini1123
提出日時 2020-08-15 01:05:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 682 bytes
コンパイル時間 1,622 ms
コンパイル使用メモリ 167,648 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-10 16:59:17
合計ジャッジ時間 2,751 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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