結果
問題 |
No.1169 Row and Column and Diagonal
|
ユーザー |
![]() |
提出日時 | 2020-08-14 22:21:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 827 bytes |
コンパイル時間 | 1,934 ms |
コンパイル使用メモリ | 168,276 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 15:42:46 |
合計ジャッジ時間 | 4,450 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | WA * 13 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);++i) #define rrep(i,n) for(int i=1;i<(n);++i) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define maxs(a, b) a = max(a, b) #define mins(a, b) a = min(a, b) using namespace std; template<class T> inline istream& operator >> (istream & c, vector<T> & A) {rep(i, A.size()) c >> A[i];return c;} typedef long long ll; typedef pair<int, int> P; const ll linf = (1ll << 61); const int inf = 1001001001; const int mod = 1000000007; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a(n); iota(a.begin(), a.end(), 1); rep(i, n) { do { if (a[i] == i + 1) break; } while (next_permutation(all(a))); rep(i, n) cout << a[i] << (i == n - 1 ? "\n" : " "); next_permutation(all(a)); } return 0; }