mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 18:28:47 +00:00
parent
cd4ff02b4d
commit
fc307c3348
77
S2OJ/1489/1489.cpp
Normal file
77
S2OJ/1489/1489.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
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
S2OJ/1489/data/chk.cpp
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/chk.cpp
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data11.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data12.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data13.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data14.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data15.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data16.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data17.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data18.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data19.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data20.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data21.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data21.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data22.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data22.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data23.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data23.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data24.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data24.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data25.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data25.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data26.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data26.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data27.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data27.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data28.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data28.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data29.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data29.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data30.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data30.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data30.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data31.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data31.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data31.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data32.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data32.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data32.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data33.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data33.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data33.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data33.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data34.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data34.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data34.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data34.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data35.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data35.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data35.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data35.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data36.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data36.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data36.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data36.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data37.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data37.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data37.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data37.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data38.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data38.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data38.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data38.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data39.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data39.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data39.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data39.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data40.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data40.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data40.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data40.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data41.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data41.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data41.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data41.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data42.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data42.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data42.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data42.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data43.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data43.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data43.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data43.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data44.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data44.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data44.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data44.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data45.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data45.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data45.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data45.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data46.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data46.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data46.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data46.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data47.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data47.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data47.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data47.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/data9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/data9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/ex_data1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/ex_data1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/ex_data1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/ex_data1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/ex_data2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/ex_data2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1489/data/ex_data2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1489/data/ex_data2.out
(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