結果

問題 No.1169 Row and Column and Diagonal
ユーザー ateate
提出日時 2020-08-15 00:17:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 1,500 bytes
コンパイル時間 1,997 ms
コンパイル使用メモリ 201,536 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-01 00:21:26
合計ジャッジ時間 3,482 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 8 ms
4,380 KB
testcase_09 AC 10 ms
4,376 KB
testcase_10 AC 18 ms
4,380 KB
testcase_11 AC 20 ms
4,380 KB
testcase_12 AC 21 ms
4,380 KB
testcase_13 AC 22 ms
4,380 KB
testcase_14 AC 21 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#if loc||local
#define _GLIBCXX_DEBUG
#endif

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int n;
  cin>>n;
  auto a = vec<int>(n,n);
  rep(i,n){
    int j=i,v=i;
    rep(l,n){
      a[i][j] = v;
      j = ((j-1)+n)%n;
      v = (v+1)%n;
    }
  }
  rep(i,n){
    rep(j,n)cout<<a[i][j]+1<<" \n"[j+1==n];
  }

}
0