QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#34297#4190. Grid Deliverysinbad#AC ✓116ms19476kbC++174.5kb2022-06-06 20:15:052022-06-06 20:15:07

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-06 20:15:07]
  • 评测
  • 测评结果:AC
  • 用时:116ms
  • 内存:19476kb
  • [2022-06-06 20:15:05]
  • 提交

answer

#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const multiset<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

template <class T> auto vect(const T& v, int n) { return vector<T>(n, v); }
template <class T, class... D> auto vect(const T& v, int n, D... m) {
  return vector<decltype(vect(v, m...))>(n, vect(v, m...));
}

using int64 = long long;
using int128 = __int128_t;
using ii = pair<int, int>;
#define SZ(x) (int)((x).size())
template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
// mt19937 mrand(random_device{}());
// int rnd(int x) { return mrand() % x; }
mt19937_64 mrand(random_device{}());
int64 rnd(int64 x) { return mrand() % x; }
int lg2(int64 x) { return sizeof(int64) * 8 - 1 - __builtin_clzll(x); }
template <class T> void out(const vector<T>& a) { for (int i = 0; i < SZ(a); ++i) cout << a[i] << " \n"[i + 1 == SZ(a)]; }
template <class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template <class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template <class T> void dedup(vector<T>& v) { sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); }
void add_mod(int& x, int y) { x += y; if (x >= MOD) x -= MOD; }
void sub_mod(int& x, int y) { x += MOD - y; if (x >= MOD) x -= MOD; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

template<typename T=int>
struct fenwick {
  vector<T> c;
  int n;
  fenwick(int n): n(n) {
    c = vect<T>(T(), n + 1);
  }
  void add(int x, T y) {
    if (x <= 0) return;
    for (; x <= n; x += x & -x) {
      ckmax(c[x], y);
    }
  }
  T query(int x) {
    T ret = T();
    for (; x; x -= x & -x) {
      ckmax(ret, c[x]);
    }
    return ret;
  }
};

int main() {
  int n, m;
  cin >> n >> m;

  string s;
  vector<vector<int>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> s;
    for (int j = 0; j < m; ++j) {
      if (s[j] == 'C') a[n - 1 - i].push_back(j + 1);
    }
  }

  fenwick<int> F(m);
  for (int i = 0; i < n; ++i) {
    vector<int> cur(m + 1);
    for (auto& x : a[i]) {
      ckmax(cur[x], F.query(x - 1) + 1);
    }
    for (int j = 1; j <= m; ++j) {
      F.add(j, cur[j]);
    }
  }
  cout << F.query(m) << '\n';
  return 0;
}

详细

Test #1:

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

input:

4 4
__C_
C_C_
_C_C
_CCC

output:

2

result:

ok single line: '2'

Test #2:

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

input:

4 6
CC____
_CCC__
___C_C
C__CCC

output:

2

result:

ok single line: '2'

Test #3:

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

input:

3 5
CC__C
_C_CC
CCCCC

output:

3

result:

ok single line: '3'

Test #4:

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

input:

4 4
__C_
CCCC
___C
_C_C

output:

2

result:

ok single line: '2'

Test #5:

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

input:

1 1
_

output:

0

result:

ok single line: '0'

Test #6:

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

input:

1 1
C

output:

1

result:

ok single line: '1'

Test #7:

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

input:

10 10
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________

output:

0

result:

ok single line: '0'

Test #8:

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

input:

10 10
_________C
_________C
_C__C_____
__________
____C_____
_________C
_______C__
__________
______C___
_______C__

output:

3

result:

ok single line: '3'

Test #9:

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

input:

10 10
C_C__C____
___C__C_CC
_CCC___C__
__C_CCC__C
__C_____CC
_CCCCC_CCC
C_C_CC_CCC
____C_C___
CC____CCCC
C___C___C_

output:

7

result:

ok single line: '7'

Test #10:

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

input:

10 10
CCCCCCCCCC
CCC_CC__CC
CCCCCC_CCC
_CCCCCC_CC
CCCCCCCCCC
C__CCCCCCC
CCCCCCCC_C
C_CCCCCCCC
_CCCCCCCCC
CCCCCCCCCC

output:

10

result:

ok single line: '10'

Test #11:

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

input:

10 10
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCC_
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC

output:

10

result:

ok single line: '10'

Test #12:

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

input:

100 100
____________________________________________________________________________________________________
____________________________________________________________________________________________________
__________________________________________________________________________________________...

output:

0

result:

ok single line: '0'

Test #13:

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

input:

100 100
__C_____________________C__________________C____C____________________________C______________________
______________C__________C__C_C____C___CC___C_C_C__________C_____C____C____C________________CC____C_
____C____________C_____________C_____C_C_________C____________________C_______C___________...

output:

44

result:

ok single line: '44'

Test #14:

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

input:

100 100
C_C_CCCC_C_CCC__C_CC_CC_C____CCC__CCCC__CCC_C__CC_CC_CCC__C___CCC_CCCC_CCC_________CCCCCCC_CC____C_C
CC_C__CCC_CCC_CC_____CCC___C_CC____C_C__CC_C___C_CC___CCCC_C_C________C___C___CC_CC__CCC________C___
___C_C_CC___CCC_______C_C___CCC_C_____C__CC_____CC_____C__CCC_C__CC_C_C_C_CC_C__C__C__C_CC...

output:

81

result:

ok single line: '81'

Test #15:

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

input:

100 100
CCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC__CCCCCCCCC_CCCCCCCCCC_CCC_CCC_CCCCCCCCCCCCCCC_CCC_CCCC_CCCCCC
CCCCCCCCCCCC_CCCCCCCCCCCCCCC_CCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCC__C__CCCCC_C__CCCCCCCC_CCC_CCCCCC_CCCC
CCCCCCCCCCCCCCCC_CCC_CCC_CCCCCCC_CCCCC_CCCCC_CCCCC__CCCCCCCCCCCCCCCCCCCCCCCCC_CCCC_CC_CCCC...

output:

95

result:

ok single line: '95'

Test #16:

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

input:

100 100
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

100

result:

ok single line: '100'

Test #17:

score: 0
Accepted
time: 43ms
memory: 3628kb

input:

2000 2000
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________...

output:

0

result:

ok single line: '0'

Test #18:

score: 0
Accepted
time: 60ms
memory: 5640kb

input:

2000 2000
___________CC________C__________C___C________C______C____________________________C___________C____C______C_C__________CC___C________________________________C____C_______________C___C__________C_C_______C_______C____C_C________C__C______________________C________C________________C________C__...

output:

945

result:

ok single line: '945'

Test #19:

score: 0
Accepted
time: 116ms
memory: 11912kb

input:

2000 2000
C_CC_____C_C_C_CC__C_C_CC_CCCCC___CC_CCC_CC__C____CCCC__CCC_C_CCC__CC__CC___CCC____C____C__CCC___CC_CCC___CCC___CC_C_C__C_C_CC__CC_C__C___C_C_CC__CC_CC___CC_CCCC__CCCC_C________C_C_C_C__C_C__C_____C__C_CCCCCC_CCCCC_CC__CCC_CCC__C______C_C_C_CC__CC___C__CCC__CC__CC___C__C_CC_C_C__CC_CCCC__C...

output:

1641

result:

ok single line: '1641'

Test #20:

score: 0
Accepted
time: 94ms
memory: 19356kb

input:

2000 2000
CC_CCCCCCCCC_CCCCCCCCCC__C_CCCCCCCCCCCCCCC_CCCCCCCCC__C_CCCC_CCCC_CCCCCCC_CCC_CCCCCC_C_C__CCCC___CCCCCCCC_CCCC_CC__CCC_CCC_CC_C_CCCCC_CCCCCCCC__CCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCC_CCCCCCCCC_CCCC__CCCCCCC_CCCCCC__CCCCCCCCCC_CCCCCCCCCC_CCCCCCCCCCCCCCCCCC_CCC_CCCCCCCCCCC_CCCCCCC...

output:

1938

result:

ok single line: '1938'

Test #21:

score: 0
Accepted
time: 89ms
memory: 19476kb

input:

2000 2000
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCC...

output:

1993

result:

ok single line: '1993'

Test #22:

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

input:

2000 1
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_...

output:

0

result:

ok single line: '0'

Test #23:

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

input:

2000 1
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
_
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
_
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
_
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C...

output:

1

result:

ok single line: '1'

Test #24:

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

input:

2000 10
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
______...

output:

0

result:

ok single line: '0'

Test #25:

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

input:

2000 10
__________
_C___C____
__________
__________
______C_C_
_______C__
__________
C_______C_
__________
__________
___C______
C__C______
_______C__
C___C_____
_C__C_____
_________C
__________
_______C__
__________
__________
__________
__C_______
__________
__________
C_________
__________
_____C...

output:

10

result:

ok single line: '10'

Test #26:

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

input:

2000 10
C__C_C_CC_
____CC_C_C
CCCC_C__CC
_CC__CC_CC
_CC__CCC_C
C_C___CC__
C________C
CC_C__C__C
__C_CCCCCC
__CCC_C__C
C_CC__CC_C
CC_CCC__C_
CCCCCC_C__
CCC_______
____CCC__C
______CCCC
CCC_CCC__C
C___CC_C_C
_C_CCCC__C
CC_CCCCC__
C_____C_C_
_C_CC_C_CC
C_C___CC__
CCCC__CC__
CC__CC_C_C
_C___CCC__
___CC_...

output:

10

result:

ok single line: '10'

Test #27:

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

input:

2000 10
CCCCCCCCCC
_CC___CCCC
CCCCCCCCCC
CCCC_C_CCC
_CCCCCCCCC
_CCCCCCCC_
CCCCCCCCCC
CCCCCCC_CC
_CCC_CCCCC
C_C_CCCCCC
CCCC_CCC__
CCCCCCCCC_
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCC_CCCC
_CCCCCCCCC
_CCCCCCCCC
CCCCCCCCCC
CCCCCCC_CC
CCCCCCCCCC
CCCC_CC_CC
CCCCCCCCCC
C_C_CCC_CC
C_CCCCCCCC
CCCCCCCCCC
CCCCCC...

output:

10

result:

ok single line: '10'

Test #28:

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

input:

2000 10
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CC_CCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCC_C
CCCC_CCCCC
CCCCCCCCCC
CCCCCC_CCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCCCCCC
CCCCCC...

output:

10

result:

ok single line: '10'

Test #29:

score: 0
Accepted
time: 4ms
memory: 3712kb

input:

2000 100
____________________________________________________________________________________________________
____________________________________________________________________________________________________
_________________________________________________________________________________________...

output:

0

result:

ok single line: '0'

Test #30:

score: 0
Accepted
time: 5ms
memory: 3752kb

input:

2000 100
____________C____________________________________________C______________________C____C______________
_C______________CCC_____C______C__________________C______C___CCC_______CC_C________________C_C_C____
C_____________C_________C_C_____C_C___________________C_______________________________CC_...

output:

100

result:

ok single line: '100'

Test #31:

score: 0
Accepted
time: 4ms
memory: 4144kb

input:

2000 100
___C_CCC_CCCCC_CC_CC__C__C__CCC_CCCC_CCC__C_C__C__C_CCCCCC_C__C_C_C____CC___CC__C_CC_C_CCCCC__CCC___
_CC_CC_CCCC__C_________C__C__C_CCC_C__CC___CC_C_C_C_CCCC____C_CCC_CCC_C____C____CC_CC__C____C_CCC___
C_C__C__CCCCCC___C_C_CC_C_C_CC_CC_C__CC__C__C___CC_CCCC___CC__CCC__CCC_______CCC___CC__C_...

output:

100

result:

ok single line: '100'

Test #32:

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

input:

2000 100
CCC_CCCCCC_CCC_CCC_CCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCC_C__CCCCCCCCCCCCCCCC_CCCC_CCCCCCCC__CC_C_CCC
CCCCCCCCCCCCCCCCCCC_CCCCCC_CCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCC_CCCCCCC_CCCCCC_CCCCCCCCCCCCCCCC_CCC
CCCCC_CCCCCCCC_C_CCCC_CCCC_CCCCCCC_CCCCCCCCCCC_CCCC_CCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCC...

output:

100

result:

ok single line: '100'

Test #33:

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

input:

2000 100
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

100

result:

ok single line: '100'

Test #34:

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

input:

1 2000
_____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________...

output:

0

result:

ok single line: '0'

Test #35:

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

input:

1 2000
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

1

result:

ok single line: '1'

Test #36:

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

input:

10 2000
____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________...

output:

0

result:

ok single line: '0'

Test #37:

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

input:

10 2000
_CC___________C_________________________________C__________________________________C_____________________________________________________C_C_C_____C__________C_C___C_____________________________C________________________________C_C_________________C___CC___C__C________C_______C_C________C____...

output:

10

result:

ok single line: '10'

Test #38:

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

input:

10 2000
_CCCC____CCC___C_CCC__CCC__CC___CC_CCCCCC_C_C_____CC_CCC_CCCCC_C_C_CCCCC___C___C_CCCCC__C__C_C_C__CC_CCC___C___C___CCC__C_C_C_C_CCCCC______CC____CCCCC__C_C_CCCCCC_C__C_CCC_C_C_C_C_CCC_CC__________CC_C___CC__CC__CCC__C___CC____CCCCC_C__CC__CC_CCCCC_____CC_CC____C__CCC_C__CCCC__CC___C__C_CCCCC...

output:

10

result:

ok single line: '10'

Test #39:

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

input:

10 2000
CCCCCCCCCCCCCCCCCCCCCCCC_CCC_CCCC__CCC_C_CCCCCCCCCCCCCCCC_CCCCCCCC_CCCCCCC_CCCCCCC_CCCCCCCC_CC_CCCCCC_CCCCCCCC__CCCCCCCCCCCCCCCCCC_CCC_CCCCCCCCCCC_CCC___CCCC_CCC_CCCCCCCCC_CCCCCC_CCCCCC_C__CCCCCCCCCCCCC_CC_CCCCCCCCCC__CCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCC...

output:

10

result:

ok single line: '10'

Test #40:

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

input:

10 2000
CCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC__CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

10

result:

ok single line: '10'

Test #41:

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

input:

100 2000
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________...

output:

0

result:

ok single line: '0'

Test #42:

score: 0
Accepted
time: 6ms
memory: 3688kb

input:

100 2000
____________________________C____C__C___C________C_______________________________C________________C__C_______C_________C______C_______________________CCC__C____CC_C___C_________________________CC_________C__________CC_____C_C______CC__________C_C___C_____C_______________________C__________C...

output:

100

result:

ok single line: '100'

Test #43:

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

input:

100 2000
_CCC___CC___CC_C__C___C_C_C__C__CC_CCCC__CCC_C_C___CCCCCC_C__C_C__CC______CCCC_CCCCCCCCCC___C__CC__C_C_C__C_CC___C_C_CCC___C__CC_____C_CC____CC__C__C___C___C_C_CC___C_____C___CCC_C_C___CCC_CCCCCC_CC_CC_C_CCCC_C_CC___C_______C_CC____CC_C___CC_C__C___CCC_C_C__C___CCCCC_C_CC___CCC_CC_C____C_CC...

output:

100

result:

ok single line: '100'

Test #44:

score: 0
Accepted
time: 9ms
memory: 4112kb

input:

100 2000
CCCCC_CCCCC_CCCCCCCCCCCCCCCCC_CCCCCC_CCCCCCCCCCCCC_CCCCCC_C__C____CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CC_C_CCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_C_CCCCCCCCCCCCC_CCCCC__C_CCCCCCCCCCCCCCCCCCCCCC_CCCCCC___CCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCC_...

output:

100

result:

ok single line: '100'

Test #45:

score: 0
Accepted
time: 9ms
memory: 4200kb

input:

100 2000
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

100

result:

ok single line: '100'

Test #46:

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

input:

1784 1890
_CCCCC__C_C_C_CC_CC_CCC_C_C_CCC___C_C___CCCCCC_CCCCCCCC_CCC_CCCCC_C__CCC_CCC_C__C__C_C_C_CC__C__C_CCCCCCCCC__C___C__CCC_CCC_C_C__C__CCCC_CCC_CC_CCCC__CCC_C_CC__CCCCC__C_CCC___C_CC__CCC_C_CCC_C_C_CC_____CC_CC__CC_CC_CC_CC_C__CC__CCCCC_C_CCC_CCC_C_C_CC__CCC_CCCC_CCCCC_CCCCC_CC_CCCCC_CCCC___C...

output:

1651

result:

ok single line: '1651'

Test #47:

score: 0
Accepted
time: 30ms
memory: 8092kb

input:

1147 938
CCC__CCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCC_CCCCCC_CCCCC_CCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCC_CCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCC_CCCCCCCCCCC_C_CCCCCCCCCC_CCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

938

result:

ok single line: '938'

Test #48:

score: 0
Accepted
time: 7ms
memory: 3908kb

input:

73 1588
CCCCCC_CCCCCC_CCCCCCCCCCCCCC_CCCCCCCCCCCC_CC_CC_CCC__C_CC_CCC_CCCCCCCCCCC_CCCCCC_CC_C_CCCCCCCCCCC__CC_CCCC__CCC_CCCCCCCCCCCCC_CCC__CCCCCC_CCCC_CC__CCCCCCCCCC_CCCCCC_C_CC_CC_C_CCCCC_CCCC_CCCC___C_CCC_CCCCCCCCCC_CCCCCCCCCCCCCCCC_CCCCCCCCCC_CCCC_CCCC_CCC_CCCCCCCC_CCCC_CCC_C___C_C_CCC_CCC_CCC_CC...

output:

73

result:

ok single line: '73'

Test #49:

score: 0
Accepted
time: 36ms
memory: 10872kb

input:

1852 642
CCCCCCCCCCCC_CCCC_C_C_CCCCCCCCCCC_C_CCCCCCCCCCCCCC_CCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCC_CCC_C_CCCCCCCCCCCCCCCCCCCCCCCCCCCCC__CCCCCCCCCCCCCCCCCC_CCCCC_CCCCCCCCCCCCCCCCCCCCC_CCCCCC_C_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCC_CCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCC_CCCCCCCCCC_...

output:

642

result:

ok single line: '642'

Test #50:

score: 0
Accepted
time: 13ms
memory: 4440kb

input:

751 813
_C__CC__C_C____C_CCC___C_C___CC____CC__C___C_CC_____C____CC___C______C_____C_____C_________C____________C___C___C_C_C_______C______________C_______C_C____________C_______C__C_C_CCC_____C___CC____C_C___________CCCCC___C______CCCCC_____________C_________________C____C___C____CCC_C_C____C___C__...

output:

500

result:

ok single line: '500'

Test #51:

score: 0
Accepted
time: 10ms
memory: 5352kb

input:

865 638
_C__CC___C____C__C____CCC_C__C_C__C__C_CCCC_C__C___C_CCC______CC___CCC_CC__CC__C__C__C_C__CC_CC___CCC_____C__C___C____C___CC__CC___C__CCCCCCC___C____C__C_CC___C____C_C__C_C_C_CCCC__CC__C__C________C__C____CCC_C__C_____C_C_CC_CC_C_C_C_C____CCCC___CCCCC__CC___C__C_C____CC__CC__C_C_CC__C__C__C_...

output:

573

result:

ok single line: '573'

Test #52:

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

input:

1853 681
___C__C_____C__C__C___CC__C_CC___CC_C__C___C_C_______C___________C_______C__C__CC__CCCC_C________CC___C_C_____CC_CC_C_C_CCCCCCC__C__C___CC______CC_C____C__CC______CC_____C_____C____C_C_CC_CC_C_C________C_C_CCC__C___CCCC_C_C__C_CCC__CC__C___CCC__C__C_C__C_C_C______CC___C__CC_C___CC__CC_CC_C_...

output:

675

result:

ok single line: '675'

Test #53:

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

input:

1734 764
CCCCCCCCCCCCCCCCCC_CCCC_C_CCCC_CCCCCCCCCCCCC__CCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCC__CC_CCCCCCCCCCCC_CCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCC_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC_CCCCCCCCCC_CCCCCCCC...

output:

764

result:

ok single line: '764'

Test #54:

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

input:

256 112
_________C_C____CCCC_C_CC__C__CCC__CC_____C_CC_C____C___________C__CC___C______CC___C__C______CCC___C____C______
C__CCCC__C__CC___________C_C_C_C______C__C__C__CC____C________C________C___C_C___C___CC__C_C_CC_C__C__C___C__CCC
__C_C____CC____C___C____C___CC____C___________C___C__C____C___CC__...

output:

104

result:

ok single line: '104'

Test #55:

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

input:

4 382
____C_C_C__CCCC_C__CC__C____CC__C_CCCC___C_____CC____CC_C_CC___CC__CCC___C___CCC_CC__CCCCCC_CC____CCCC___C_CCC___C_____C________C__CCC__CC_CC_CC_C_CC______CCCCCCC____CC__C__CC_CCCC__C__C__C____C__________CC___CC__CCCC__C___CC__C_______C_CCCCCCC__CC___CC_CC_C_C_CCC___C__C_C____C_CCCCC___CC___C_...

output:

4

result:

ok single line: '4'

Test #56:

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

input:

649 33
_C_____CCCCC____C_C__C___CC__C__C
_C______C_CC__C__C______CCC______
C___________CC_C__C_C__C_CC_CCCCC
__C__C_CC__CCCC__C_C__C____C__C_C
__C__C___CCC____C___CCC_C_______C
_C___C_CCC_C__CC_C__________C__C_
___C______________C___________CCC
___C_CC___C___C__C_CC__C____C__C_
C__C_CC___CCC__C____C...

output:

33

result:

ok single line: '33'

Test #57:

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

input:

25 717
CCCC__CC_C_C__C_CC__C_____CCC_CC_C___C__C__C_CC__________C____CCCCC______CC____C____C____C_____C________C_____________C_____C__C___________C__C____CC_______CC__CC_____C_CCCC_C_C____C__CC_C___CC_C_____C_____C_C_______CC_C_C__C____C__________CCC____CC__________C__C_______________C______CC______...

output:

25

result:

ok single line: '25'

Test #58:

score: 0
Accepted
time: 19ms
memory: 5316kb

input:

947 699
CCC__C_CCCCCC_C___C_C_CCC_CCCC_C_C_CCCCCC_C_CCC_CC__CC_CCCCCCCCCC_C_CCCCCC_CCCCCCCCC_CCC_CC_CCC___CCC___CCCC_C_CC_CC__CCC_CC__C__CC_C_CC__C_C_C___CCCCC_C__CC__CCCC_CCC_CCC_CCCCC_C_C__C_CCCCCCCCC_CCC_CCCCC__CC_____CCCCCCCC__C_C__CCC_C_C_CCC__CCCC_C__C_CC_CCCCCC__C_C_C_CCC_C_CCCC____C_CC_C_C_C...

output:

690

result:

ok single line: '690'

Test #59:

score: 0
Accepted
time: 12ms
memory: 3804kb

input:

240 1087
___C___C_CCC____C____CC___C__C_C_______CC_______________C_CC______C________C__C_C___C____C__C__C__C___CCC__CC__CC_C__C_C____C______C__C___C_C_C_CC____C_______C__CC_C_C___CC_CCCC__C_C_C____CC____C_____C__CCC___C_C_____C_CC______C___C_C__C_CC__________CCC___C___C___C__C___C___CC_____CC_____C_...

output:

240

result:

ok single line: '240'

Test #60:

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

input:

1485 1338
C____CC__CC____C___CC_CC__CCCC____C_C__C_CC__CC__C_C__CCC_CCC_CC_C_CCCC____C________C__C___CCCCCCC__CC__C_C_C_CC_CCCCCC_CC_CCC_C____CCCCCCC__C_C_CC_CC______CC__C_C__C_CC_C_CC_C_C___C_CC__C__CCCC______C_C___CC________C_CCCCCC_CC_____CCCC_CCCCC_C_CCC_CC_CC____C__CCC___C___CCCC__C_C_C___CC__C...

output:

1138

result:

ok single line: '1138'

Test #61:

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

input:

2000 2000
_CCC_C_____C_CC_C__CCCCC_CC__C_CCCC__C_C___C___C__C_CC_CC_C___CCC_CCCC___C_CC_____C_C__CCCC___C___CCC_CCC_C_CCCCCCC_C__CC_CCCCC_______CCC_CC__C_C____CC_C_CCC_CC_CC__CC__C_C___CCC____CCC_C___C__C_CCC_C_CCCCCC__C___C___CC_CCC___CCCC_CC_CCC__C_C__C__CCC_C___C_C___CC_CC___CCCCC_CC_C_C___C_CCCC...

output:

1000

result:

ok single line: '1000'