結果

問題 No.839 Keep Distance and Nobody Explodes
ユーザー KawattaTaido
提出日時 2020-05-20 23:05:47
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 2,829 ms
コンパイル使用メモリ 196,196 KB
最終ジャッジ日時 2025-01-10 13:27:14
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;
  int offset = (n/2 + 2)/2 - 1;
  int sh = n/2;
  vector<vector<int>> ans(n,vector<int>(n));
  rep(i,n*n/4){
    int h = i%sh;
    int w = i/sh;
    ans[h][w] = 4*i + 1;
    ans[(h+offset)%sh][w+sh] = 4*i+2;
    ans[sh+h][w] = 4*i+3;
    ans[sh+(h+offset)%sh][sh+w] = 4*i+4;
  }

  rep(i,n){
    rep(j,n){
      cout << ans[i][j] << " \n"[j==n-1];
    }
  }
  
  return 0;
    

}
0