QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#673627#9484. Colored Complete Graphhos_lyricAC ✓146ms4772kbC++142.3kb2024-10-25 03:01:092024-10-25 03:01:09

Judging History

你现在查看的是最新测评结果

  • [2024-10-25 03:01:09]
  • 评测
  • 测评结果:AC
  • 用时:146ms
  • 内存:4772kb
  • [2024-10-25 03:01:09]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")




int ask(int u, int v) {
  printf("? %d %d\n", u, v);
  fflush(stdout);
  char c;
  scanf(" %c", &c);
  return string("BR").find(c);
}

int main() {
  int N;
  scanf("%d", &N);
  
  // representatives
  vector<int> uss[2];
  vector<pair<int, int>> ess[2];
  for (int h = 0; h < 2; ++h) {
    uss[h] = {1};
  }
  for (int u = 2; u <= N; ++u) {
    for (int h = 0; h < 2; ++h) if (uss[h].size() == 1) {
      uss[h].push_back(u);
      for (; uss[h ^ 1].size(); ) {
        const int v = uss[h ^ 1].back();
        const int res = ask(u, v);
        ess[res].emplace_back(u, v);
        if (h == res) {
          uss[h] = {u};
          break;
        } else {
          uss[h ^ 1].pop_back();
        }
      }
      uss[h ^ 1].push_back(u);
      goto done;
    }
    assert(false);
   done:{}
// cerr<<"done u = "<<u<<": uss = ";pv(uss,uss+2);
  }
  
  for (int h = 0; h < 2; ++h) if (uss[h].size() == 1) {
    puts("!");
    for (const auto &e : ess[h]) {
      printf("%d %d\n", e.first, e.second);
    }
    fflush(stdout);
    return 0;
  }
  assert(false);
  return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3792kb

input:

3
B
B

output:

? 2 1
? 3 2
!
2 1
3 2

result:

ok AC

Test #2:

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

input:

983
B
R
R
B
B
B
B
B
R
B
R
R
R
R
R
R
R
B
B
R
R
B
R
B
R
R
B
B
R
B
R
R
R
R
B
R
B
B
B
R
R
R
B
B
R
R
B
R
B
R
B
B
B
R
B
R
R
B
R
B
B
R
R
R
B
B
B
B
R
B
R
R
B
R
B
B
R
B
R
B
R
B
R
R
R
B
B
B
R
R
B
B
B
R
R
B
R
B
B
B
R
B
B
R
R
B
B
R
R
R
R
B
R
R
B
B
B
R
B
B
B
B
R
B
R
R
B
R
R
R
B
R
R
B
R
R
B
R
R
B
R
B
R
B
B
R
B
R
...

output:

? 2 1
? 3 2
? 3 1
? 4 3
? 4 2
? 5 4
? 6 5
? 7 6
? 8 7
? 8 6
? 9 8
? 9 6
? 9 5
? 9 4
? 9 3
? 10 9
? 11 10
? 12 11
? 12 10
? 12 9
? 13 12
? 14 13
? 14 12
? 15 14
? 15 12
? 16 15
? 17 16
? 17 15
? 17 12
? 18 17
? 18 12
? 19 18
? 20 19
? 21 20
? 22 21
? 22 20
? 23 22
? 23 20
? 23 19
? 23 18
? 24 23
? 25...

result:

ok AC

Test #3:

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

input:

75
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #4:

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

input:

430
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #5:

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

input:

238
B
R
R
B
B
B
B
B
R
B
R
R
R
R
R
R
R
B
B
R
R
B
R
B
R
R
B
B
R
B
R
R
R
R
B
R
B
B
B
R
R
R
B
B
R
R
B
R
B
R
B
B
B
R
B
R
R
B
R
B
B
R
R
R
B
B
B
B
R
B
R
R
B
R
B
B
R
B
R
B
R
B
R
R
R
B
B
B
R
R
B
B
B
R
R
B
R
B
B
B
R
B
B
R
R
B
B
R
R
R
R
B
R
R
B
B
B
R
B
B
B
B
R
B
R
R
B
R
R
R
B
R
R
B
R
R
B
R
R
B
R
B
R
B
B
R
B
R
...

output:

? 2 1
? 3 2
? 3 1
? 4 3
? 4 2
? 5 4
? 6 5
? 7 6
? 8 7
? 8 6
? 9 8
? 9 6
? 9 5
? 9 4
? 9 3
? 10 9
? 11 10
? 12 11
? 12 10
? 12 9
? 13 12
? 14 13
? 14 12
? 15 14
? 15 12
? 16 15
? 17 16
? 17 15
? 17 12
? 18 17
? 18 12
? 19 18
? 20 19
? 21 20
? 22 21
? 22 20
? 23 22
? 23 20
? 23 19
? 23 18
? 24 23
? 25...

result:

ok AC

Test #6:

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

input:

42
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 30 28
? 30 27
? 30 26
? 30 25
? 30 24
? 30 23
? 30 22
? 30 21
? 30 20
? 30 19
? 30 ...

result:

ok AC

Test #7:

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

input:

759
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #8:

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

input:

389
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #9:

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

input:

47
R
R
R
R
R
R
R
B
B
B
B
B
B
B
B
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 9 7
? 9 6
? 9 5
? 9 4
? 9 3
? 9 2
? 9 1
? 10 9
? 11 10
? 11 9
? 12 11
? 12 9
? 13 12
? 13 9
? 14 13
? 14 9
? 15 14
? 15 9
? 16 15
? 16 9
? 17 16
? 17 9
? 18 17
? 18 9
? 19 18
? 19 9
? 20 19
? 20 9
? 21 20
? 21 9
? 22 21
? 22 9
? 23 22
? 23 9
? 24 23
...

result:

ok AC

Test #10:

score: 0
Accepted
time: 16ms
memory: 3856kb

input:

14657
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #11:

score: 0
Accepted
time: 21ms
memory: 4192kb

input:

15755
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #12:

score: 0
Accepted
time: 37ms
memory: 3900kb

input:

14236
B
R
R
B
B
B
B
B
R
B
R
R
R
R
R
R
R
B
B
R
R
B
R
B
R
R
B
B
R
B
R
R
R
R
B
R
B
B
B
R
R
R
B
B
R
R
B
R
B
R
B
B
B
R
B
R
R
B
R
B
B
R
R
R
B
B
B
B
R
B
R
R
B
R
B
B
R
B
R
B
R
B
R
R
R
B
B
B
R
R
B
B
B
R
R
B
R
B
B
B
R
B
B
R
R
B
B
R
R
R
R
B
R
R
B
B
B
R
B
B
B
B
R
B
R
R
B
R
R
R
B
R
R
B
R
R
B
R
R
B
R
B
R
B
B
R
B
...

output:

? 2 1
? 3 2
? 3 1
? 4 3
? 4 2
? 5 4
? 6 5
? 7 6
? 8 7
? 8 6
? 9 8
? 9 6
? 9 5
? 9 4
? 9 3
? 10 9
? 11 10
? 12 11
? 12 10
? 12 9
? 13 12
? 14 13
? 14 12
? 15 14
? 15 12
? 16 15
? 17 16
? 17 15
? 17 12
? 18 17
? 18 12
? 19 18
? 20 19
? 21 20
? 22 21
? 22 20
? 23 22
? 23 20
? 23 19
? 23 18
? 24 23
? 25...

result:

ok AC

Test #13:

score: 0
Accepted
time: 34ms
memory: 4256kb

input:

19615
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #14:

score: 0
Accepted
time: 42ms
memory: 4056kb

input:

30668
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #15:

score: 0
Accepted
time: 97ms
memory: 4448kb

input:

39166
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #16:

score: 0
Accepted
time: 32ms
memory: 4068kb

input:

35168
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #17:

score: 0
Accepted
time: 37ms
memory: 4072kb

input:

45420
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #18:

score: 0
Accepted
time: 62ms
memory: 4156kb

input:

45526
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #19:

score: 0
Accepted
time: 75ms
memory: 3912kb

input:

48225
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #20:

score: 0
Accepted
time: 72ms
memory: 3892kb

input:

40451
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #21:

score: 0
Accepted
time: 56ms
memory: 3852kb

input:

47265
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #22:

score: 0
Accepted
time: 54ms
memory: 3972kb

input:

40881
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #23:

score: 0
Accepted
time: 121ms
memory: 4296kb

input:

44327
B
R
R
B
B
B
B
B
R
B
R
R
R
R
R
R
R
B
B
R
R
B
R
B
R
R
B
B
R
B
R
R
R
R
B
R
B
B
B
R
R
R
B
B
R
R
B
R
B
R
B
B
B
R
B
R
R
B
R
B
B
R
R
R
B
B
B
B
R
B
R
R
B
R
B
B
R
B
R
B
R
B
R
R
R
B
B
B
R
R
B
B
B
R
R
B
R
B
B
B
R
B
B
R
R
B
B
R
R
R
R
B
R
R
B
B
B
R
B
B
B
B
R
B
R
R
B
R
R
R
B
R
R
B
R
R
B
R
R
B
R
B
R
B
B
R
B
...

output:

? 2 1
? 3 2
? 3 1
? 4 3
? 4 2
? 5 4
? 6 5
? 7 6
? 8 7
? 8 6
? 9 8
? 9 6
? 9 5
? 9 4
? 9 3
? 10 9
? 11 10
? 12 11
? 12 10
? 12 9
? 13 12
? 14 13
? 14 12
? 15 14
? 15 12
? 16 15
? 17 16
? 17 15
? 17 12
? 18 17
? 18 12
? 19 18
? 20 19
? 21 20
? 22 21
? 22 20
? 23 22
? 23 20
? 23 19
? 23 18
? 24 23
? 25...

result:

ok AC

Test #24:

score: 0
Accepted
time: 58ms
memory: 3948kb

input:

48093
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #25:

score: 0
Accepted
time: 46ms
memory: 3972kb

input:

49999
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #26:

score: 0
Accepted
time: 78ms
memory: 4500kb

input:

50000
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #27:

score: 0
Accepted
time: 98ms
memory: 4624kb

input:

50000
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #28:

score: 0
Accepted
time: 133ms
memory: 4460kb

input:

49999
B
R
R
B
B
B
B
B
R
B
R
R
R
R
R
R
R
B
B
R
R
B
R
B
R
R
B
B
R
B
R
R
R
R
B
R
B
B
B
R
R
R
B
B
R
R
B
R
B
R
B
B
B
R
B
R
R
B
R
B
B
R
R
R
B
B
B
B
R
B
R
R
B
R
B
B
R
B
R
B
R
B
R
R
R
B
B
B
R
R
B
B
B
R
R
B
R
B
B
B
R
B
B
R
R
B
B
R
R
R
R
B
R
R
B
B
B
R
B
B
B
B
R
B
R
R
B
R
R
R
B
R
R
B
R
R
B
R
R
B
R
B
R
B
B
R
B
...

output:

? 2 1
? 3 2
? 3 1
? 4 3
? 4 2
? 5 4
? 6 5
? 7 6
? 8 7
? 8 6
? 9 8
? 9 6
? 9 5
? 9 4
? 9 3
? 10 9
? 11 10
? 12 11
? 12 10
? 12 9
? 13 12
? 14 13
? 14 12
? 15 14
? 15 12
? 16 15
? 17 16
? 17 15
? 17 12
? 18 17
? 18 12
? 19 18
? 20 19
? 21 20
? 22 21
? 22 20
? 23 22
? 23 20
? 23 19
? 23 18
? 24 23
? 25...

result:

ok AC

Test #29:

score: 0
Accepted
time: 117ms
memory: 4772kb

input:

50000
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #30:

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

input:

4
B
R
R
B
B

output:

? 2 1
? 3 2
? 3 1
? 4 3
? 4 2
!
2 1
4 3
4 2

result:

ok AC

Test #31:

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

input:

5
B
R
R
B
B
B

output:

? 2 1
? 3 2
? 3 1
? 4 3
? 4 2
? 5 4
!
2 1
4 3
4 2
5 4

result:

ok AC

Test #32:

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

input:

6
R
R
R
R
B
B
B
B
B

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 6 4
? 6 3
? 6 2
? 6 1
!
6 5
6 4
6 3
6 2
6 1

result:

ok AC

Test #33:

score: 0
Accepted
time: 146ms
memory: 4368kb

input:

50000
B
R
R
B
B
B
B
B
R
B
R
R
R
R
R
R
R
B
B
R
R
B
R
B
R
R
B
B
R
B
R
R
R
R
B
R
B
B
B
R
R
R
B
B
R
R
B
R
B
R
B
B
B
R
B
R
R
B
R
B
B
R
R
R
B
B
B
B
R
B
R
R
B
R
B
B
R
B
R
B
R
B
R
R
R
B
B
B
R
R
B
B
B
R
R
B
R
B
B
B
R
B
B
R
R
B
B
R
R
R
R
B
R
R
B
B
B
R
B
B
B
B
R
B
R
R
B
R
R
R
B
R
R
B
R
R
B
R
R
B
R
B
R
B
B
R
B
...

output:

? 2 1
? 3 2
? 3 1
? 4 3
? 4 2
? 5 4
? 6 5
? 7 6
? 8 7
? 8 6
? 9 8
? 9 6
? 9 5
? 9 4
? 9 3
? 10 9
? 11 10
? 12 11
? 12 10
? 12 9
? 13 12
? 14 13
? 14 12
? 15 14
? 15 12
? 16 15
? 17 16
? 17 15
? 17 12
? 18 17
? 18 12
? 19 18
? 20 19
? 21 20
? 22 21
? 22 20
? 23 22
? 23 20
? 23 19
? 23 18
? 24 23
? 25...

result:

ok AC

Test #34:

score: 0
Accepted
time: 120ms
memory: 4436kb

input:

50000
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #35:

score: 0
Accepted
time: 111ms
memory: 3988kb

input:

50000
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Test #36:

score: 0
Accepted
time: 48ms
memory: 3912kb

input:

50000
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
R
...

output:

? 2 1
? 3 2
? 4 3
? 5 4
? 6 5
? 7 6
? 8 7
? 9 8
? 10 9
? 11 10
? 12 11
? 13 12
? 14 13
? 15 14
? 16 15
? 17 16
? 18 17
? 19 18
? 20 19
? 21 20
? 22 21
? 23 22
? 24 23
? 25 24
? 26 25
? 27 26
? 28 27
? 29 28
? 30 29
? 31 30
? 32 31
? 33 32
? 34 33
? 35 34
? 36 35
? 37 36
? 38 37
? 39 38
? 40 39
? 41 ...

result:

ok AC

Extra Test:

score: 0
Extra Test Passed