結果

問題 No.1169 Row and Column and Diagonal
ユーザー NewGardenNewGarden
提出日時 2020-08-14 21:34:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 995 bytes
コンパイル時間 1,260 ms
コンパイル使用メモリ 122,320 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 21:08:38
合計ジャッジ時間 2,378 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=100010;
const ll mod=1e9+7;


int main(){
  int n;
  cin >> n;
  vector<vector<int>> d(n, vector<int>(n));
  rep(j,n){
    for(int i=n; i>0; i--){
      int tmp = i-j;
      if(tmp<=0) tmp += n;
      d[j][n-i] = tmp;
    }
  }

  REP(k,1,n+1){
    rep(j,n){
      if(d[j][k-1] == k){
        for(auto it:d[j]){
          cout << it << " ";
        }
        cout << ln;
        break;
      }
    }
  }
  return 0;
}
0