QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96294#2923. Code Guessingmostafa_ayman#AC ✓3ms3472kbC++141.9kb2023-04-13 18:53:202023-04-13 18:53:21

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 18:53:21]
  • Judged
  • Verdict: AC
  • Time: 3ms
  • Memory: 3472kb
  • [2023-04-13 18:53:20]
  • Submitted

answer

#pragma GCC optimize ("O3")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define int ll
typedef tree<
        pair<int, int>,
        null_type,
        less<pair<int, int>>,
        rb_tree_tag,
        tree_order_statistics_node_update>
        ordered_set;//order_of_key()->gives how many elements less than specific element in the set ,, find_by_order() ->find specific element by index the set
#define  ll long long
#define  el '\n'
#define IO       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);

#define endl '\n'
using namespace std;
int const N  =  2e6 +5  ;

void pre() {
  int a1 ,  a2  ;  cin >>a1>>a2   ;
  string s ;cin >>s;
  bool  can  = 0 ;
  if (s=="AABB"){
      can =1  ;
     if (a2==7){
         cout <<8<< " "<<9 <<el ;
     }
     else cout <<-1<<endl;
  }
  else if (s=="ABAB"){
      can =1  ;
    if (a1==6 and a2 == 8){
        cout <<7<<" "<<9 <<endl;
    }
    else cout <<-1<<endl ;
  }
  else if (s=="ABBA"){
      can =1  ;
      if (a2-a1==3){
          cout <<a1 +1  << " "<<a1+2<<el ;
      }
      else cout <<-1<<endl;

  }
  else if (s=="BAAB"){
      can  =1  ;
     if (a1==2  and a2==8){
          cout <<1<<" " <<9 <<el  ;
     }
     else cout <<-1<<endl;
  }
  else if (s=="BABA"){
      can =1  ;
     if (a1==2 and a2 == 4 ){
         cout <<1<<" " <<3<<el ;
     }
     else cout <<-1<<el ;
  }else if (s=="BBAA"){
       can  =1  ;
      if (a1==3){
          cout <<1<<" "<<2<<endl  ;
      }
      else cout <<-1<<el ;
  }
    assert(can) ;
}

/*void test() {
    vector<int> tmp = {1,2,3,5};
     auto i = lower_bound(tmp.begin() + 1, tmp.end(),4);
     cout << *i << el;
}*/
signed main() {
    pre() ;
    IO

}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3384kb

input:

3 4
BBAA

output:

1 2

result:

ok single line: '1 2'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3360kb

input:

3 7
BBAA

output:

1 2

result:

ok single line: '1 2'

Test #3:

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

input:

3 9
BBAA

output:

1 2

result:

ok single line: '1 2'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3380kb

input:

5 6
BBAA

output:

-1

result:

ok single line: '-1'

Test #5:

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

input:

6 7
AABB

output:

8 9

result:

ok single line: '8 9'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3320kb

input:

3 7
AABB

output:

8 9

result:

ok single line: '8 9'

Test #7:

score: 0
Accepted
time: 2ms
memory: 3352kb

input:

1 7
AABB

output:

8 9

result:

ok single line: '8 9'

Test #8:

score: 0
Accepted
time: 2ms
memory: 3352kb

input:

4 5
AABB

output:

-1

result:

ok single line: '-1'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3392kb

input:

1 4
ABBA

output:

2 3

result:

ok single line: '2 3'

Test #10:

score: 0
Accepted
time: 2ms
memory: 3456kb

input:

3 6
ABBA

output:

4 5

result:

ok single line: '4 5'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3388kb

input:

4 7
ABBA

output:

5 6

result:

ok single line: '5 6'

Test #12:

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

input:

5 9
ABBA

output:

-1

result:

ok single line: '-1'

Test #13:

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

input:

1 5
ABBA

output:

-1

result:

ok single line: '-1'

Test #14:

score: 0
Accepted
time: 2ms
memory: 3320kb

input:

2 7
ABBA

output:

-1

result:

ok single line: '-1'

Test #15:

score: 0
Accepted
time: 1ms
memory: 3468kb

input:

1 9
ABBA

output:

-1

result:

ok single line: '-1'

Test #16:

score: 0
Accepted
time: 2ms
memory: 3368kb

input:

2 8
BAAB

output:

1 9

result:

ok single line: '1 9'

Test #17:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

3 8
BAAB

output:

-1

result:

ok single line: '-1'

Test #18:

score: 0
Accepted
time: 3ms
memory: 3468kb

input:

2 6
BAAB

output:

-1

result:

ok single line: '-1'

Test #19:

score: 0
Accepted
time: 2ms
memory: 3340kb

input:

4 5
BAAB

output:

-1

result:

ok single line: '-1'

Test #20:

score: 0
Accepted
time: 2ms
memory: 3444kb

input:

6 8
ABAB

output:

7 9

result:

ok single line: '7 9'

Test #21:

score: 0
Accepted
time: 1ms
memory: 3400kb

input:

4 8
ABAB

output:

-1

result:

ok single line: '-1'

Test #22:

score: 0
Accepted
time: 2ms
memory: 3464kb

input:

3 7
ABAB

output:

-1

result:

ok single line: '-1'

Test #23:

score: 0
Accepted
time: 2ms
memory: 3352kb

input:

5 7
ABAB

output:

-1

result:

ok single line: '-1'

Test #24:

score: 0
Accepted
time: 2ms
memory: 3364kb

input:

1 3
ABAB

output:

-1

result:

ok single line: '-1'

Test #25:

score: 0
Accepted
time: 2ms
memory: 3472kb

input:

2 4
BABA

output:

1 3

result:

ok single line: '1 3'

Test #26:

score: 0
Accepted
time: 2ms
memory: 3460kb

input:

2 5
BABA

output:

-1

result:

ok single line: '-1'

Test #27:

score: 0
Accepted
time: 1ms
memory: 3356kb

input:

3 5
BABA

output:

-1

result:

ok single line: '-1'

Test #28:

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

input:

7 9
BABA

output:

-1

result:

ok single line: '-1'

Test #29:

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

input:

6 9
ABBA

output:

7 8

result:

ok single line: '7 8'

Test #30:

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

input:

2 5
BAAB

output:

-1

result:

ok single line: '-1'