Submission #62047635


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793238462643383279502884L
#define LL long long
#define DD double
#define ULL unsigned long long
#define STR string
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
#define MLL map<LL, LL>
#define MSL map<STR, LL>
#define MLB map<LL, bool>
template <class T>
using PQA = priority_queue<T, V<T>, greater<T>>;
template <class T>
using PQD = priority_queue<T, V<T>, less<T>>;
#define IT iterator
#define F first
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>

using namespace std;
#define PI 3.141592653589793238462643383279502884L
#define LL long long
#define DD double
#define ULL unsigned long long
#define STR string
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
#define MLL map<LL, LL>
#define MSL map<STR, LL>
#define MLB map<LL, bool>
template <class T>
using PQA = priority_queue<T, V<T>, greater<T>>;
template <class T>
using PQD = priority_queue<T, V<T>, less<T>>;
#define IT iterator
#define F first
#define S second
#define PB push_back
#define PLL pair<LL, LL>
#define MP make_pair
#define rep(i, e) for (LL i = 0; i < e; i++)
#define repa(i, s, e) for (LL i = s; i < e; i++)
#define repd(i, s, e) for (LL i = s; i >= e; i--)
#define repauto(x, s) for (auto x : s)
#define rd(...) \
  __VA_ARGS__;  \
  read(__VA_ARGS__)
#define rdv(value, ...) \
  value(__VA_ARGS__);   \
  cin >> value
template <class T>
auto &operator>>(istream &is, vector<T> &xs)
{
  for (auto &x : xs)
    is >> x;
  return is;
}
template <class T>
auto &operator<<(ostream &os, vector<T> &xs)
{
  int sz = xs.size();
  rep(i, sz) os << xs[i] << " \n"[i + 1 == sz];
  return os;
}
template <class T, class Y>
auto &operator<<(ostream &os, pair<T, Y> &xs)
{
  os << "{" << xs.first << ", " << xs.second << "}";
  return os;
}
template <class T, class Y>
auto &operator>>(istream &is, vector<pair<T, Y>> &xs)
{
  for (auto &[x1, x2] : xs)
    is >> x1 >> x2;
  return is;
}
template <class... Args>
auto &read(Args &...args) { return (cin >> ... >> args); }
#define vsorta(v) sort(v.begin(), v.end())
#define vsortd(v) sort(v.begin(), v.end(), greater<>())
#define sort_arr(v, n) sort(v, v + n)
#define rev(v) reverse(v.begin(), v.end())
#define pr(x) cout << x
#define prs(x) cout << x << ' '
#define prn(x) cout << x << '\n'
#define prd() cout << fixed << setprecision(50);
#define Yes cout << "Yes\n"
#define YES cout << "YES\n"
#define No cout << "No\n"
#define NO cout << "NO\n"
#define PN cout << '\n'
#define PS cout << ' '
#define INF (1LL << 60)
#define MOD1 1000000007
#define MOD2 998244353
#define max_N 100100

void solve()
{
  LL rd(h, w);
  V<STR> rdv(a, h);
  LL t = INF, b = -INF, l = INF, r = -INF;
  rep(i, h)
  {
    rep(j, w)
    {
      if (a[i][j] == '#')
      {
        t = min(t, i);
        b = max(b, i);
        l = min(l, j);
        r = max(r, j);
      }
    }
  }
  rep(i, h)
  {
    rep(j, w)
    {
      if (a[i][j] == '.')
      {
        if (t <= i && i <= b && l <= j && j <= r)
        {
          No;
          return;
        }
      }
    }
  }
  Yes;
}

int main()
{
  LL T = 1;
  // LL rd(T);
  while (T--)
    solve();
  return 0;
}

Submission Info

Submission Time
Task C - Paint to make a rectangle
User togi11
Language C++ 20 (gcc 12.2)
Score 300
Code Size 2787 Byte
Status AC
Exec Time 17 ms
Memory 5576 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 41
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3460 KB
example_01.txt AC 1 ms 3496 KB
example_02.txt AC 1 ms 3492 KB
hand_00.txt AC 14 ms 5248 KB
hand_01.txt AC 14 ms 5572 KB
hand_02.txt AC 13 ms 5444 KB
hand_03.txt AC 13 ms 5576 KB
hand_04.txt AC 13 ms 5420 KB
hand_05.txt AC 1 ms 3536 KB
hand_06.txt AC 1 ms 3564 KB
hand_07.txt AC 1 ms 3528 KB
hand_08.txt AC 1 ms 3404 KB
hand_09.txt AC 14 ms 5420 KB
hand_10.txt AC 13 ms 5392 KB
hand_11.txt AC 13 ms 5388 KB
hand_12.txt AC 14 ms 5460 KB
random_00.txt AC 16 ms 4632 KB
random_01.txt AC 15 ms 5192 KB
random_02.txt AC 15 ms 4344 KB
random_03.txt AC 15 ms 4480 KB
random_04.txt AC 17 ms 5352 KB
random_05.txt AC 12 ms 4512 KB
random_06.txt AC 13 ms 5436 KB
random_07.txt AC 12 ms 5292 KB
random_08.txt AC 12 ms 4432 KB
random_09.txt AC 11 ms 4472 KB
random_10.txt AC 11 ms 4400 KB
random_11.txt AC 14 ms 5392 KB
random_12.txt AC 12 ms 5452 KB
random_13.txt AC 13 ms 5496 KB
random_14.txt AC 12 ms 4528 KB
random_15.txt AC 14 ms 5288 KB
random_16.txt AC 12 ms 4404 KB
random_17.txt AC 14 ms 5424 KB
random_18.txt AC 11 ms 4404 KB
random_19.txt AC 13 ms 4468 KB
random_20.txt AC 11 ms 4420 KB
random_21.txt AC 12 ms 4388 KB
random_22.txt AC 12 ms 4624 KB
random_23.txt AC 12 ms 4400 KB
random_24.txt AC 12 ms 4484 KB


2025-03-05 (Wed)
20:46:25 +00:00