QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#269826#2923. Code GuessingDr_rabi3AC ✓0ms3820kbC++203.1kb2023-11-30 02:51:082023-11-30 02:51:08

Judging History

This is the latest submission verdict.

  • [2023-11-30 02:51:08]
  • Judged
  • Verdict: AC
  • Time: 0ms
  • Memory: 3820kb
  • [2023-11-30 02:51:08]
  • Submitted

answer

/***   Coding for Fun ^^ وَمَا تَوْفِيقِي إِلَّا بِاللَّهِ ۚ عَلَيْهِ تَوَكَّلْتُ وَإِلَيْهِ أُنِيبُ    ***/
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ull unsigned ll
#define ld long double
#define ed '\n'
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fixed(x) fixed<<setprecision(x)
#define memo(dp,x) memset(dp,x,sizeof(dp))
#define sumOf(a) (ll)((-1 + sqrt(8LL * a + 1)) / 2)
#define debug cerr
#define Good_Bay return

using namespace std;
using namespace __gnu_pbds;
namespace Math {
    constexpr int mod = 1e9 + 7;
    int add(int a, int b) { return (0LL + a + b) % mod; }
    int sub(int a, int b) { return ((a - b) % mod + mod) % mod; }
    int mul(int a, int b) { return (1LL * a * b) % mod; }
};
using namespace Math;
std::mt19937_64 rng(std::chrono::system_clock::now().time_since_epoch().count());

template < typename T > using ordered_set = tree< T, null_type, less_equal< T >, rb_tree_tag, tree_order_statistics_node_update >;

template < typename T > istream& operator >> (istream& in, vector < T >& v) {
    for (auto& x : v) in >> x;
    return in;
}

template < typename T > ostream& operator << (ostream& out, const vector < T >& v) {
    for (const T& x : v) out << x << ' ';
    return out;
}


void Accept() { // for VS code
    ios_base::sync_with_stdio(false);
    cout.tie(nullptr);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    // freopen("darwin.in", "r", stdin);
    // freopen("visitfj.out", "w", stdout);
#endif
}

constexpr int mod = 1e9 + 7, oo = 0x3f3f3f3f, N = 2e5 + 5;
const double pi = acos(-1), EPS = 1e-7;
constexpr ll OO = 0x3f3f3f3f3f3f3f3f;

constexpr int dy[] = { 0 , 1 , -1 , 0  , 1 , -1 , 1  , -1 };
constexpr int dx[] = { 1 , 0 ,  0 , -1 , 1 , -1 , -1 ,  1 };

void doWork(int T) {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    if (s == "AABB") {
        if (m == 7)cout << 8 << ' ' << 9;
        else cout << -1;
    }
    else if (s == "ABAB") {
        if (n == 6)cout << 7 << ' ' << 9;
        else cout << -1;
    }
    else if (s == "ABBA") {
        if (m - n - 1 == 2)cout << ++n << ' ' << --m;
        else cout << -1;
    }
    else if (s == "BABA") {
        if (m == 4)cout << 1 << ' ' << 3;
        else cout << -1;
    }
    else if (s == "BBAA") { 
        if (n == 3)cout << 1 << ' ' << 2;
        else cout << -1;
    }
    else if (s == "BAAB") {
        if (n == 2 and m == 8)cout << 1 << ' ' << 9;
        else cout << -1;
    }
}

int main() {
    debug << "M3L4 El-Code MYTFHM4\n";
    Accept();
    int _ = 1;
    // cin >> _;
    for (int __ = 1;__ <= _;__++) {
        // cout << "Case " << __ << ": ";
        doWork(__);
        if (__ < _)cout << '\n';
        // cout << '\n';
    }
    Good_Bay 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3524kb

input:

3 4
BBAA

output:

1 2

result:

ok single line: '1 2'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

3 7
BBAA

output:

1 2

result:

ok single line: '1 2'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

3 9
BBAA

output:

1 2

result:

ok single line: '1 2'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

5 6
BBAA

output:

-1

result:

ok single line: '-1'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

6 7
AABB

output:

8 9

result:

ok single line: '8 9'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

3 7
AABB

output:

8 9

result:

ok single line: '8 9'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

1 7
AABB

output:

8 9

result:

ok single line: '8 9'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

4 5
AABB

output:

-1

result:

ok single line: '-1'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

1 4
ABBA

output:

2 3

result:

ok single line: '2 3'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

3 6
ABBA

output:

4 5

result:

ok single line: '4 5'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

4 7
ABBA

output:

5 6

result:

ok single line: '5 6'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

5 9
ABBA

output:

-1

result:

ok single line: '-1'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

1 5
ABBA

output:

-1

result:

ok single line: '-1'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

2 7
ABBA

output:

-1

result:

ok single line: '-1'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

1 9
ABBA

output:

-1

result:

ok single line: '-1'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

2 8
BAAB

output:

1 9

result:

ok single line: '1 9'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

3 8
BAAB

output:

-1

result:

ok single line: '-1'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

2 6
BAAB

output:

-1

result:

ok single line: '-1'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

4 5
BAAB

output:

-1

result:

ok single line: '-1'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

6 8
ABAB

output:

7 9

result:

ok single line: '7 9'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

4 8
ABAB

output:

-1

result:

ok single line: '-1'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

3 7
ABAB

output:

-1

result:

ok single line: '-1'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3768kb

input:

5 7
ABAB

output:

-1

result:

ok single line: '-1'

Test #24:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

1 3
ABAB

output:

-1

result:

ok single line: '-1'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

2 4
BABA

output:

1 3

result:

ok single line: '1 3'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

2 5
BABA

output:

-1

result:

ok single line: '-1'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

3 5
BABA

output:

-1

result:

ok single line: '-1'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

7 9
BABA

output:

-1

result:

ok single line: '-1'

Test #29:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

6 9
ABBA

output:

7 8

result:

ok single line: '7 8'

Test #30:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

2 5
BAAB

output:

-1

result:

ok single line: '-1'