mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 19:08:47 +00:00
parent
fafbbfd4f4
commit
03b2faa1dd
79
AtCoder/ABC178/F/F.cpp
Normal file
79
AtCoder/ABC178/F/F.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 2e5 + 5;
|
||||
|
||||
int n, a[N], b[N];
|
||||
std::vector<int> v1, v2;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> b[i];
|
||||
}
|
||||
|
||||
std::sort(a + 1, a + 1 + n, std::less<>());
|
||||
std::sort(b + 1, b + 1 + n, std::greater<>());
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (a[i] == b[i]) v1.emplace_back(i);
|
||||
}
|
||||
|
||||
if (v1.empty()) {
|
||||
cout << "Yes" << endl;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cout << b[i] << ' ';
|
||||
}
|
||||
|
||||
cout << endl;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (a[i] == a[v1[0]]) v2.emplace_back(i);
|
||||
else if (b[i] == a[v1[0]]) v2.emplace_back(i);
|
||||
}
|
||||
|
||||
std::sort(v2.begin(), v2.end());
|
||||
|
||||
int l = v2[0] - 1;
|
||||
int r = *v2.rbegin() + 1;
|
||||
|
||||
for (int p : v1) {
|
||||
if (l) {
|
||||
std::swap(b[l--], b[p]);
|
||||
} else if (r <= n) {
|
||||
std::swap(b[r++], b[p]);
|
||||
} else {
|
||||
cout << "No" << endl;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
cout << "Yes" << endl;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cout << b[i] << ' ';
|
||||
}
|
||||
|
||||
cout << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
AtCoder/ABC178/F/data/case03.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case03.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case03.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case03.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case04.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case04.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case04.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case04.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case05.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case05.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case05.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case05.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case06.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case06.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case06.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case06.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case07.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case07.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case07.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case07.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case08.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case08.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case08.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case08.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case09.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case09.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case09.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case09.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case10.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case10.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case11.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case11.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case12.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case12.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case13.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case13.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case14.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case14.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case15.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case15.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case16.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case16.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case17.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case17.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case18.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case18.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case19.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case19.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case20.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case20.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case21.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case21.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case22.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case22.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case23.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case23.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case24.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case24.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case25.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case25.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case26.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case26.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case27.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case27.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case28.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case28.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case29.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case29.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case30.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case30.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case30.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case31.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case31.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case31.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case32.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case32.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case32.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case33.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case33.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case33.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case33.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case34.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case34.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case34.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case34.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case35.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case35.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case35.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case35.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case36.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case36.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case36.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case36.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case37.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case37.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case37.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case37.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case38.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case38.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case38.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case38.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case39.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case39.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case39.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case39.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case40.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case40.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case40.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case40.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case41.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case41.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case41.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case41.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case42.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case42.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case42.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case42.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case43.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case43.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case43.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case43.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case44.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case44.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case44.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case44.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case45.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case45.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case45.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case45.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case46.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case46.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case46.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case46.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case47.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case47.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case47.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case47.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case48.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case48.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case48.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case48.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case49.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case49.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/case49.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/case49.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/sample00.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/sample00.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/sample00.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/sample00.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/sample01.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/sample01.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/sample01.out
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/sample01.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
AtCoder/ABC178/F/data/sample02.in
(Stored with Git LFS)
Normal file
BIN
AtCoder/ABC178/F/data/sample02.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user