mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
parent
f61f305eb3
commit
a9cd8b6002
60
S2OJ/1320/1320.cpp
Normal file
60
S2OJ/1320/1320.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
std::string s, t;
|
||||
std::vector<std::pair<int, int>> ans;
|
||||
|
||||
bool check() {
|
||||
if (std::count(s.begin(), s.end(), '1') != std::count(t.begin(), t.end(), '1')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < s.size(); i++) {
|
||||
if (s[i] == t[i]) continue;
|
||||
|
||||
int cnt = 0;
|
||||
bool flag = false;
|
||||
|
||||
for (int j = i; j < s.size(); j++) {
|
||||
if (s[j] == '1') cnt++;
|
||||
|
||||
if (s[j] == t[i] && cnt % 2 == 0) {
|
||||
flag = true;
|
||||
ans.emplace_back(i + 1, j + 1);
|
||||
std::reverse(s.begin() + i, s.begin() + j + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> s >> t;
|
||||
|
||||
if (check()) {
|
||||
cout << "YES" << endl
|
||||
<< ans.size() << endl;
|
||||
|
||||
for (auto e : ans) {
|
||||
cout << e.first << ' ' << e.second << endl;
|
||||
}
|
||||
} else {
|
||||
cout << "NO" << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1320/data/chk.cpp
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/chk.cpp
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/ex_rev1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/ex_rev1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/ex_rev1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/ex_rev1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/ex_rev2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/ex_rev2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/ex_rev2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/ex_rev2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev10.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev11.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev11.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev12.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev12.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev13.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev13.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev14.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev14.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev15.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev15.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev16.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev16.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev17.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev17.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev18.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev18.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev19.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev19.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev20.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev20.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev4.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev5.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev6.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev6.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev7.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev7.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev8.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev8.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev9.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev9.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1320/data/rev9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1320/data/rev9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user