結果

問題 No.1169 Row and Column and Diagonal
ユーザー ricoriser32ricoriser32
提出日時 2020-08-19 10:20:37
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 792 bytes
コンパイル時間 1,998 ms
コンパイル使用メモリ 195,140 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 08:14:27
合計ジャッジ時間 2,827 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<ll(n); i++)
#define REPR(i, n) for(ll i=n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=m; i<ll(n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 2e9;
const ll LINF = (1LL<<60);

//int a[500][500];

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  REP(i,n){ 
    REP(j,n){ 
    int tmp = (2*(i+1) - (j+1) + n) % n;
    if(tmp==0) tmp = n;
    cout << tmp << " ";
    }
    cout << '\n';
  }


  return 0;
}
0