結果

問題 No.2184 A○B問題
ユーザー ineedyourlovep
提出日時 2023-01-13 21:32:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,329 bytes
コンパイル時間 1,653 ms
コンパイル使用メモリ 197,436 KB
最終ジャッジ日時 2025-02-10 02:10:15
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 1000000007;
//const int mod = 998244353;
struct Perm : vector<int> {
#define n (int)(size())
#define p (*this)
Perm(int _n): vector<int>(_n) {
iota(begin(), end(), 0);
}
template<class...Args> Perm(Args...args): vector<int>(args...) {}
Perm(initializer_list<int> a): vector<int>(a.begin(),a.end()) {}
Perm operator+(const Perm& a) const {
Perm r(n);
for (int i = 0; i < n; ++i) r[i] = p[a[i]];
return r;
}
Perm& operator+=(const Perm& a) {
return *this = (*this)+a;
}
Perm operator-() const {
Perm r(n);
for (int i = 0; i < n; ++i) r[p[i]] = i;
return r;
}
Perm operator-(const Perm& a) const {
return *this + -a;
}
Perm& operator-=(const Perm& a) {
return *this += -a;
}
// next permutation
bool operator++() {
return next_permutation(begin(),end());
}
#undef n
#undef p
};
int main()
{
const int n = 5;
vector<int> a(n), b(n);
rep(i, 0, n) {
cin >> a[i];
a[i]--;
}
rep(i, 0, n) {
cin >> b[i];
b[i]--;
}
Perm p(a);
p += b;
rep(i, 0, n) cout << p[i]+1 << " \n"[i == n-1];
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0