QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#80005 | #2923. Code Guessing | perspective | AC ✓ | 2ms | 3784kb | C++23 | 2.8kb | 2023-02-21 16:48:44 | 2023-02-21 16:49:01 |
Judging History
answer
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define INP "input"
#define OUT "output"
/* some template */
template <typename T>
std::ostream& operator<<(std::ostream& out, const std::vector<T>& a) {
out << (int)a.size() << '\n';
for (const auto& v : a) out << v << ' ';
out << endl;
return out;
}
template <typename T>
std::ostream& operator<<(std::ostream& out, const std::vector<vector<T> >& a) {
out << (int)a.size() << '\n';
for (const auto& v : a) {
for (const auto& value : v) out << value << ' ';
out << endl;
}
return out;
}
template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& v) {
for (auto& x : v) is >> x;
return is;
}
/* end template */
const long long INF_LL = 1e18;
const int INF = 1e9 + 100;
const long double EPS = 1e-6;
const int BLOCK = 550;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};
void open_file() {
#ifdef THEMIS
freopen(INP ".txt", "r", stdin);
freopen(OUT ".txt", "w", stdout);
#endif // THEMIS
}
const int maxN = 1e6 + 100;
const int MOD = 1e9 + 7;
void sol() {
int p, q;
cin >> p >> q;
string s;
cin >> s;
if (s == "AABB") {
if (q == 7) {
cout << 8 << " " << 9 << '\n';
} else {
cout << -1 << '\n';
}
}
if (s == "ABAB") {
if (p == 6 && q == 8) {
cout << 7 << " " << 9 << '\n';
} else {
cout << -1 << '\n';
}
}
if (s == "ABBA") {
if (q - p == 3) {
cout << p + 1 << " " << p + 2 << '\n';
} else {
cout << -1 << '\n';
}
}
if (s == "BAAB") {
if (p == 2 && q == 8) {
cout << 1 << " " << 9 << '\n';
} else {
cout << -1 << '\n';
}
}
if (s == "BABA") {
if (p == 2 && q == 4) {
cout << 1 << " " << 3 << '\n';
} else {
cout << -1 << '\n';
}
}
if (s == "BBAA") {
if (p == 3) {
cout << 1 << " " << 2 << '\n';
} else {
cout << -1 << '\n';
}
}
}
void solve() {
clock_t start, end;
start = clock();
int T = 1;
// cin >> T;
int TestCase = 0;
while (T--) {
TestCase += 1;
cerr << "Processing test = " << TestCase << '\n';
// cout << "Case #" << TestCase << ": ";
sol();
// if (T) cout << '\n';
}
end = clock();
cerr << "Time = " << (double)(end - start) / (double)CLOCKS_PER_SEC << '\n';
}
int main(int argc, char* argv[]) {
// srand(time(nullptr));
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
cout.tie(nullptr);
open_file();
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3624kb
input:
3 4 BBAA
output:
1 2
result:
ok single line: '1 2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
3 7 BBAA
output:
1 2
result:
ok single line: '1 2'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
3 9 BBAA
output:
1 2
result:
ok single line: '1 2'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3684kb
input:
5 6 BBAA
output:
-1
result:
ok single line: '-1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
6 7 AABB
output:
8 9
result:
ok single line: '8 9'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3680kb
input:
3 7 AABB
output:
8 9
result:
ok single line: '8 9'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3688kb
input:
1 7 AABB
output:
8 9
result:
ok single line: '8 9'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3712kb
input:
4 5 AABB
output:
-1
result:
ok single line: '-1'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3688kb
input:
1 4 ABBA
output:
2 3
result:
ok single line: '2 3'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3776kb
input:
3 6 ABBA
output:
4 5
result:
ok single line: '4 5'
Test #11:
score: 0
Accepted
time: 2ms
memory: 3684kb
input:
4 7 ABBA
output:
5 6
result:
ok single line: '5 6'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3692kb
input:
5 9 ABBA
output:
-1
result:
ok single line: '-1'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
1 5 ABBA
output:
-1
result:
ok single line: '-1'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3668kb
input:
2 7 ABBA
output:
-1
result:
ok single line: '-1'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
1 9 ABBA
output:
-1
result:
ok single line: '-1'
Test #16:
score: 0
Accepted
time: 2ms
memory: 3764kb
input:
2 8 BAAB
output:
1 9
result:
ok single line: '1 9'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
3 8 BAAB
output:
-1
result:
ok single line: '-1'
Test #18:
score: 0
Accepted
time: 2ms
memory: 3628kb
input:
2 6 BAAB
output:
-1
result:
ok single line: '-1'
Test #19:
score: 0
Accepted
time: 2ms
memory: 3760kb
input:
4 5 BAAB
output:
-1
result:
ok single line: '-1'
Test #20:
score: 0
Accepted
time: 2ms
memory: 3784kb
input:
6 8 ABAB
output:
7 9
result:
ok single line: '7 9'
Test #21:
score: 0
Accepted
time: 2ms
memory: 3684kb
input:
4 8 ABAB
output:
-1
result:
ok single line: '-1'
Test #22:
score: 0
Accepted
time: 2ms
memory: 3684kb
input:
3 7 ABAB
output:
-1
result:
ok single line: '-1'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
5 7 ABAB
output:
-1
result:
ok single line: '-1'
Test #24:
score: 0
Accepted
time: 2ms
memory: 3684kb
input:
1 3 ABAB
output:
-1
result:
ok single line: '-1'
Test #25:
score: 0
Accepted
time: 2ms
memory: 3632kb
input:
2 4 BABA
output:
1 3
result:
ok single line: '1 3'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
2 5 BABA
output:
-1
result:
ok single line: '-1'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
3 5 BABA
output:
-1
result:
ok single line: '-1'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
7 9 BABA
output:
-1
result:
ok single line: '-1'
Test #29:
score: 0
Accepted
time: 2ms
memory: 3708kb
input:
6 9 ABBA
output:
7 8
result:
ok single line: '7 8'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 5 BAAB
output:
-1
result:
ok single line: '-1'