結果
問題 | No.241 出席番号(1) |
ユーザー |
![]() |
提出日時 | 2024-12-09 18:20:36 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 639 bytes |
コンパイル時間 | 2,670 ms |
コンパイル使用メモリ | 249,916 KB |
実行使用メモリ | 13,640 KB |
最終ジャッジ日時 | 2024-12-09 18:20:48 |
合計ジャッジ時間 | 11,051 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 1 WA * 27 TLE * 1 |
ソースコード
#include <bits/stdc++.h> #include <random> #include <chrono> using namespace std; constexpr int RT = 1e7; mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); int main() { int N; cin >> N; vector<int> A(N); for(auto& i : A) cin >> i; vector<int> ans(N); iota(ans.begin(), ans.end(), 0); auto check = [&]() -> bool { for(int i = 0; i < N; ++i) { if(ans[i] == A[i]) return false; } return true; }; for(int rt = 0; rt < RT; ++rt) { if(check()) break; shuffle(ans.begin(), ans.end(), mt); } if(check()) for(auto& i : A) cout << i << '\n'; else cout << "-1\n"; }