QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#636957 | #2923. Code Guessing | enze114514# | AC ✓ | 0ms | 3860kb | C++14 | 1.8kb | 2024-10-13 04:25:05 | 2024-10-13 04:25:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb push_back
const ld pi = 3.14159265358979323846;
const int mod = 998244353;
const ll INF = 1e18;
template<typename T>
T chmax(T a, T b) {
return a > b ? a : b;
}
template<typename T>
T chmin(T a, T b) {
return a > b ? b : a;
}
const int N = (int)1e5 + 1, M = N * 2;
void solve(){
int n, m;
cin >> n >> m;
string s;
cin >> s;
if(s == "ABBA"){
if(m - n == 3) {
cout << n + 1 << " " << m - 1 << endl;
}
else{
cout << -1 << endl;
}
}
else if(s == "BBAA"){
if(n == 3){
cout << 1 << " " << 2 << endl;
}
else{
cout << -1 << endl;
}
}
else if(s == "AABB"){
if(m == 7){
cout << 8 << " " << 9 << endl;
}
else{
cout << -1 << endl;
}
}
else if(s == "ABAB"){
if(n == 6){
cout << 7 << " " << 9 << endl;
}
else{
cout << -1 << endl;
}
}
else if(s == "BABA"){
if(m == 4){
cout << 1 << " " << 3 << endl;
}
else{
cout << -1 << endl;
}
}
else if(s == "BAAB"){
if(n == 2 && m == 8){
cout << 1 << " " << 9 << endl;
}
else{
cout << -1 << endl;
}
}
else{
cout << -1 << endl;
}
}
int main() {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
// cin >> t;
while(t--){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3564kb
input:
3 4 BBAA
output:
1 2
result:
ok single line: '1 2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
3 7 BBAA
output:
1 2
result:
ok single line: '1 2'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
3 9 BBAA
output:
1 2
result:
ok single line: '1 2'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
5 6 BBAA
output:
-1
result:
ok single line: '-1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
6 7 AABB
output:
8 9
result:
ok single line: '8 9'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
3 7 AABB
output:
8 9
result:
ok single line: '8 9'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
1 7 AABB
output:
8 9
result:
ok single line: '8 9'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
4 5 AABB
output:
-1
result:
ok single line: '-1'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
1 4 ABBA
output:
2 3
result:
ok single line: '2 3'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
3 6 ABBA
output:
4 5
result:
ok single line: '4 5'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
4 7 ABBA
output:
5 6
result:
ok single line: '5 6'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
5 9 ABBA
output:
-1
result:
ok single line: '-1'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
1 5 ABBA
output:
-1
result:
ok single line: '-1'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
2 7 ABBA
output:
-1
result:
ok single line: '-1'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
1 9 ABBA
output:
-1
result:
ok single line: '-1'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
2 8 BAAB
output:
1 9
result:
ok single line: '1 9'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
3 8 BAAB
output:
-1
result:
ok single line: '-1'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
2 6 BAAB
output:
-1
result:
ok single line: '-1'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
4 5 BAAB
output:
-1
result:
ok single line: '-1'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
6 8 ABAB
output:
7 9
result:
ok single line: '7 9'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
4 8 ABAB
output:
-1
result:
ok single line: '-1'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
3 7 ABAB
output:
-1
result:
ok single line: '-1'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
5 7 ABAB
output:
-1
result:
ok single line: '-1'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
1 3 ABAB
output:
-1
result:
ok single line: '-1'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
2 4 BABA
output:
1 3
result:
ok single line: '1 3'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
2 5 BABA
output:
-1
result:
ok single line: '-1'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
3 5 BABA
output:
-1
result:
ok single line: '-1'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
7 9 BABA
output:
-1
result:
ok single line: '-1'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
6 9 ABBA
output:
7 8
result:
ok single line: '7 8'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
2 5 BAAB
output:
-1
result:
ok single line: '-1'