結果

問題 No.2732 Similar Permutations
ユーザー 矢澤式WINTER矢澤式WINTER
提出日時 2024-04-19 23:07:38
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,275 bytes
コンパイル時間 5,491 ms
コンパイル使用メモリ 336,684 KB
実行使用メモリ 10,140 KB
最終ジャッジ日時 2024-04-19 23:08:07
合計ジャッジ時間 22,965 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,140 KB
testcase_01 AC 1,802 ms
5,376 KB
testcase_02 AC 16 ms
5,376 KB
testcase_03 AC 27 ms
5,376 KB
testcase_04 AC 9 ms
5,376 KB
testcase_05 AC 8 ms
5,376 KB
testcase_06 AC 4 ms
5,376 KB
testcase_07 AC 23 ms
5,376 KB
testcase_08 AC 11 ms
5,376 KB
testcase_09 AC 6 ms
5,376 KB
testcase_10 AC 48 ms
5,632 KB
testcase_11 AC 5 ms
5,376 KB
testcase_12 AC 47 ms
5,760 KB
testcase_13 AC 45 ms
5,760 KB
testcase_14 AC 48 ms
5,632 KB
testcase_15 AC 53 ms
5,760 KB
testcase_16 AC 36 ms
5,376 KB
testcase_17 AC 33 ms
5,376 KB
testcase_18 AC 43 ms
5,632 KB
testcase_19 AC 47 ms
5,760 KB
testcase_20 AC 51 ms
5,504 KB
testcase_21 AC 51 ms
5,760 KB
testcase_22 AC 28 ms
5,376 KB
testcase_23 AC 50 ms
5,888 KB
testcase_24 AC 27 ms
5,376 KB
testcase_25 AC 51 ms
5,760 KB
testcase_26 AC 40 ms
5,504 KB
testcase_27 AC 52 ms
5,760 KB
testcase_28 AC 38 ms
5,376 KB
testcase_29 AC 47 ms
5,760 KB
testcase_30 AC 33 ms
5,376 KB
testcase_31 AC 47 ms
5,760 KB
testcase_32 AC 44 ms
5,632 KB
testcase_33 AC 47 ms
5,888 KB
testcase_34 AC 30 ms
5,376 KB
testcase_35 AC 47 ms
5,888 KB
testcase_36 AC 43 ms
5,632 KB
testcase_37 AC 46 ms
5,888 KB
testcase_38 AC 40 ms
5,376 KB
testcase_39 AC 46 ms
5,760 KB
testcase_40 AC 38 ms
5,504 KB
testcase_41 AC 46 ms
5,760 KB
testcase_42 AC 35 ms
5,376 KB
testcase_43 AC 46 ms
5,888 KB
testcase_44 AC 25 ms
5,376 KB
testcase_45 AC 44 ms
5,760 KB
testcase_46 AC 42 ms
5,504 KB
testcase_47 AC 47 ms
5,888 KB
testcase_48 AC 30 ms
5,376 KB
testcase_49 AC 46 ms
5,760 KB
testcase_50 AC 27 ms
5,376 KB
testcase_51 AC 44 ms
5,888 KB
testcase_52 AC 37 ms
5,504 KB
testcase_53 AC 47 ms
5,888 KB
testcase_54 AC 46 ms
5,760 KB
testcase_55 AC 46 ms
5,760 KB
testcase_56 AC 48 ms
5,888 KB
testcase_57 AC 25 ms
5,376 KB
testcase_58 AC 33 ms
5,376 KB
testcase_59 AC 31 ms
5,376 KB
testcase_60 AC 26 ms
5,376 KB
testcase_61 AC 24 ms
5,376 KB
testcase_62 AC 40 ms
5,376 KB
testcase_63 TLE -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
testcase_78 -- -
testcase_79 -- -
testcase_80 -- -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
testcase_94 -- -
testcase_95 -- -
testcase_96 -- -
testcase_97 -- -
testcase_98 -- -
testcase_99 -- -
testcase_100 -- -
testcase_101 -- -
testcase_102 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//*/
#include <atcoder/all>
using namespace atcoder;
//*/
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define ALL(x) (x).begin(),(x).end()
#define dbgv(x); for(auto now : x) cout << now << " "; cout << endl;
//using P = pair<int,int>;
using ll = long long;
using ull = unsigned long long;
//*/
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; }
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vint;
random_device rnd;
mt19937 rng(rnd());
using mint = modint998244353;

class Timer {
    public:
        Timer() {
            begin();
            elapsed_time_ = 0.0;
        }

        void begin() {
            start_time_ = chrono::system_clock::now();
        }

        double get_time() {
            chrono::system_clock::time_point end_time = chrono::system_clock::now();
            elapsed_time_ = chrono::duration_cast<std::chrono::nanoseconds>(end_time - start_time_).count();
            elapsed_time_ *= 1e-9; // nanoseconds -> seconds
            return elapsed_time_;
        }

        double get_last_time() const {
            return elapsed_time_;
        }

        bool yet(double time_limit) {
            return get_time() < time_limit;
        }

        double progress(double time_limit) {
            return get_time() / time_limit;
        }

    private:
        chrono::system_clock::time_point start_time_;
        double elapsed_time_;
};
constexpr double time_limit = 1.8;

void solve(){
  Timer timer;
  int n; cin >> n;
  vint a(n); rep(i,n) cin >> a[i];
  vint p(n),q(n); rep(i,n) p[i] = i+1,q[i] = i+1;
  while(timer.yet(time_limit)){
    int i = rng()%n;
    int j = rng()%n;
    while(i==j) j = rng()%n;
    if(((a[i]+p[i])^(a[j]+p[j])) == ((a[i]+p[j])^(a[j]+p[i]))){
      //cout << ((a[i]+p[i])^(a[j]+p[j])) << " " << ((a[i]+p[i])^(a[j]+p[j])) << endl;
      swap(q[i],q[j]);
      dbgv(p);
      dbgv(q);
      return;
    }
  }
  cout << -1 << endl;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1; //cin >> t;
  rep(dirc,t) solve();
}
0