0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

#1320. 【20230228省选模拟赛T3】Rev

https://sjzezoj.com/submission/72867
This commit is contained in:
Baoshuo Ren 2023-02-28 11:21:35 +08:00
parent f61f305eb3
commit a9cd8b6002
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
47 changed files with 198 additions and 0 deletions

60
S2OJ/1320/1320.cpp Normal file
View 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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

BIN
S2OJ/1320/data/rev9.in (Stored with Git LFS) Normal file

Binary file not shown.