結果
| 問題 | No.573 a^2[i] = a[i] |
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2016-12-26 15:17:28 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 378 bytes |
| 記録 | |
| コンパイル時間 | 659 ms |
| コンパイル使用メモリ | 70,132 KB |
| 実行使用メモリ | 9,728 KB |
| 最終ジャッジ日時 | 2026-05-25 15:14:58 |
| 合計ジャッジ時間 | 6,272 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 TLE * 1 -- * 37 |
ソースコード
//愚直
#include <iostream>
using namespace std;
int n;
int a[100000];
int dfs(int id) {
int i;
if (id == n) {
for (i = 0; i < n; i++) if (a[a[i]] != a[i]) return 0;
return 1;
}
int ret = 0;
for (i = 0; i < n; i++) {
a[id] = i;
ret += dfs(id + 1);
ret %= 1000000007;
}
return ret;
}
int main() {
int i;
cin >> n;
cout << dfs(0) << endl;
return 0;
}
startcpp