Submission #60046669


Source Code Expand

#pragma region header
// C
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
// C++
#include <algorithm>
#include <array>
#include <bit>
#include <bitset>
#include <chrono>
#include <compare>
#include <complex>
#include <concepts>
#include <deque>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numbers>
#include <numeric>
#include <queue>
#include <random>
#include <ranges>
#include <regex>
#include <set>
#include <span>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
// atcoder
#include <atcoder/all>

#define int ll
#define all(a) begin(a), end(a)
#define rall(a) rbegin(a), rend(a)
#define rep1(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define rrep1(i, n) for (auto i = (n) - 1; i >= 0; i--)
#define rep2(i, a, b) for (auto i = (a); i < (b); i++)
#define rrep2(i, a, b) for (auto i = (b) - 1; i >= a; i--)
#define GET_NAME(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_NAME(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define rrep(...) \
  GET_NAME(__VA_ARGS__, rrep2, rrep1)(__VA_ARGS__)
using namespace std;
using namespace literals;

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
using vd = vector<ld>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using vp = vector<pii>;
using vvp = vector<vp>;
using i3 = tuple<int, int, int>;
using vi3 = vector<i3>;
using vvi3 = vector<vi3>;
using i4 = tuple<int, int, int, int>;
using vi4 = vector<i4>;
using vvi4 = vector<vi4>;
using mii = map<int, int>;
template <class T, class U>
using umap = unordered_map<T, U>;
using umii = umap<int, int>;
using seti = set<int>;
template <class T>
using uset = unordered_set<T>;
using useti = uset<int>;
template <class T>
using less_queue = priority_queue<T>;
template <class T>
using greater_queue = priority_queue<T, vector<T>, greater<T>>;
using int128 = __int128_t;

template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &x) {
  T a;
  U b;
  is >> a >> b;
  x = {a, b};
  return is;
}
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &x) {
  return os << x.first << ' ' << x.second;
}
template <class T, class... U>
tuple<T, U...> read_tuple(istream &is) {
  T a;
  is >> a;
  if constexpr (sizeof...(U) == 0)
    return {a};
  else
    return tuple_cat(tuple{a}, read_tuple<U...>(is));
}
template <class... T>
istream &operator>>(istream &is, tuple<T...> &x) {
  x = read_tuple<T...>(is);
  return is;
}
template <size_t I = 0, class... T>
constexpr void write_tuple(ostream &os, const tuple<T...> &x) {
  if constexpr (I < sizeof...(T)) {
    if constexpr (I == 0)
      os << get<0>(x);
    else
      os << ' ' << get<I>(x);
    write_tuple<I + 1>(os, x);
  }
}
template <class... T>
ostream &operator<<(ostream &os, const tuple<T...> &x) {
  write_tuple(os, x);
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &x : v) is >> x;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  const int n = v.size();
  if (n) os << v[0];
  for (int i = 1; i < n; i++) os << ' ' << v[i];
  return os;
}
ostream &operator<<(ostream &os, int128 x) {
  if (!x) return os << '0';
  if (x < 0) {
    os << '-';
    x = -x;
  }
  string s;
  for (; x; x /= 10) s += x % 10 + '0';
  reverse(all(s));
  return os << s;
}

constexpr long long INF = 1e18;
constexpr ld EPS = 1e-10;
const ld PI = acosl(-1);
bool eq(ld a, ld b) {
  return abs(a - b) < EPS;
}

template <typename T>
void SORT(T &a) {
  stable_sort(all(a));
}
template <typename T>
T sorted(T a) {
  SORT(a);
  return a;
}
template <typename T>
void RSORT(T &a) {
  stable_sort(rall(a));
}
template <typename T>
T rsorted(T a) {
  RSORT(a);
  return a;
}
template <typename T, typename U>
void ERASE(T &a, U i) {
  a.erase(remove(all(a), i), end(a));
}
template <typename T>
void rev(T &a) {
  reverse(all(a));
}
template <typename T>
T reversed(T a) {
  rev(a);
  return a;
}
template <typename T>
void uniq(T &a) {
  a.erase(unique(all(a)), end(a));
}
template <typename T>
auto min_of(const vector<T> &a) {
  return *min_element(all(a));
}
template <typename T>
auto max_of(const vector<T> &a) {
  return *max_element(all(a));
}
template <typename T>
T sum_of(const vector<T> &a) {
  return accumulate(all(a), T{});
}
template <typename T>
int count_of(const T &a, T i) {
  return count(all(a), i);
}
template <typename T>
bool has(const vector<T> &a, T i) {
  return find(all(a), i) != end(a);
}
bool has(const string &a, char i) {
  return find(all(a), i) != end(a);
}
template <typename T>
bool has(const set<T> &a, T i) {
  return a.find(i) != a.end();
}
template <typename T, typename U>
bool has(const map<T, U> &a, T i) {
  return a.find(i) != a.end();
}
template <typename T, typename U>
bool has(const umap<T, U> &a, T i) {
  return a.find(i) != a.end();
}

void CIN() {};
template <class T, class... U>
void CIN(T &&x, U &&...y) {
  cin >> x;
  CIN(forward<U>(y)...);
}
void _COUT() {
  cout << endl;
}
template <class T, class... U>
void _COUT(T &&x, U &&...y) {
  cout << ' ' << x;
  _COUT(forward<U>(y)...);
}
void COUT() {
  _COUT();
};
template <class T, class... U>
void COUT(T &&x, U &&...y) {
  cout << x;
  _COUT(forward<U>(y)...);
}
void CSP() {};
template <class T, class... U>
void CSP(T &&x, U &&...y) {
  cout << x << ' ';
  CSP(forward<U>(y)...);
}

template <typename T>
bool amin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}
template <typename T>
bool amax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}

template <typename T>
vector<T> powers(T base, int N) {
  vector<T> ret(N + 1);
  ret[0] = 1;
  rep(i, N) ret[i + 1] = ret[i] * base;
  return ret;
}
template <typename T>
vector<T> factorials(int N) {
  vector<T> ret(N + 1);
  ret[0] = 1;
  rep(i, N) ret[i + 1] = ret[i] * T{i + 1};
  return ret;
}

int ceil_div(int x, int y) {
  int d = x / y;
  return d * y == x ? d : d + ((x > 0) ^ (y < 0));
}
int floor_div(int x, int y) {
  int d = x / y;
  return d * y == x ? d : d - ((x < 0) ^ (y < 0));
}
int out_div(int x, int y) {
  int d = x / y;
  return d * y == x ? d : ((x > 0) == (y > 0)) ? d + 1 : d - 1;
}

#pragma endregion header

void solve() {
  int N;
  string S;
  CIN(N, S);
  int ans = 0;
  rep(i, N) {
    if (S[i] != '/') {
      continue;
    }
    int cnt = 1;
    for (int j = 1; 0 <= i - j && i + j < N; j++) {
      if (S[i - j] != '1' || S[i + j] != '2') {
        break;
      }
      cnt += 2;
    }
    amax(ans, cnt);
  }
  COUT(ans);
}

#pragma region main
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(15);

  solve();
}
#pragma endregion main

Submission Info

Submission Time
Task C - 11/22 Substring
User dnek
Language C++ 23 (gcc 12.2)
Score 300
Code Size 7140 Byte
Status AC
Exec Time 3 ms
Memory 3688 KiB

Compile Error

Main.cpp:1: warning: ignoring ‘#pragma region header’ [-Wunknown-pragmas]
    1 | #pragma region header
      | 
Main.cpp:309: warning: ignoring ‘#pragma endregion header’ [-Wunknown-pragmas]
  309 | #pragma endregion header
      | 
Main.cpp:332: warning: ignoring ‘#pragma region main’ [-Wunknown-pragmas]
  332 | #pragma region main
      | 
Main.cpp:341: warning: ignoring ‘#pragma endregion main’ [-Wunknown-pragmas]
  341 | #pragma endregion main
      | 

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 25
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 02_corner_00.txt, 02_corner_01.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3476 KiB
00_sample_01.txt AC 1 ms 3420 KiB
00_sample_02.txt AC 1 ms 3492 KiB
01_random_00.txt AC 2 ms 3688 KiB
01_random_01.txt AC 2 ms 3596 KiB
01_random_02.txt AC 2 ms 3684 KiB
01_random_03.txt AC 3 ms 3584 KiB
01_random_04.txt AC 2 ms 3556 KiB
01_random_05.txt AC 2 ms 3584 KiB
01_random_06.txt AC 2 ms 3628 KiB
01_random_07.txt AC 2 ms 3600 KiB
01_random_08.txt AC 2 ms 3444 KiB
01_random_09.txt AC 2 ms 3632 KiB
01_random_10.txt AC 2 ms 3600 KiB
01_random_11.txt AC 2 ms 3556 KiB
01_random_12.txt AC 2 ms 3648 KiB
01_random_13.txt AC 2 ms 3644 KiB
01_random_14.txt AC 2 ms 3580 KiB
01_random_15.txt AC 2 ms 3624 KiB
01_random_16.txt AC 2 ms 3600 KiB
01_random_17.txt AC 2 ms 3616 KiB
01_random_18.txt AC 2 ms 3684 KiB
01_random_19.txt AC 2 ms 3636 KiB
02_corner_00.txt AC 2 ms 3576 KiB
02_corner_01.txt AC 1 ms 3360 KiB