Submission #62085545


Source Code Expand

Copy
/* -------------------------------------- HEADER FILES ---------------------------------------- */
#include <bits/stdc++.h>
using namespace std;
/* ------------------------------------ MACROS & CONSTANTS ------------------------------------ */
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define debug(...) ;
#endif
#define int long long int
constexpr int MOD = 1E9 + 7;
constexpr int INF = 1E18;
/* ------------------------------------ OTHER FUNCTIONS ------------------------------------ */
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/* -------------------------------------- HEADER FILES ---------------------------------------- */

  #include <bits/stdc++.h>
  using namespace std;

/* ------------------------------------ MACROS & CONSTANTS ------------------------------------ */

  #ifndef ONLINE_JUDGE
      #include "debug.h"
  #else
      #define debug(...) ;
  #endif

  #define int long long int

  constexpr int MOD = 1E9 + 7;
  constexpr int INF = 1E18;

/* ------------------------------------ OTHER FUNCTIONS ------------------------------------ */


/* ------------------------------------ LAMBDA TEMPLATE ------------------------------------- */

  auto solve = [] -> void
  {
      int n, m; cin >> n >> m;

      vector<string> a(n);
      for (auto& i : a) cin >> i;

      int val1 = -1, val2 = -1, val3 = -1, val4 = -1;

      for (int i = 0; i < n; i++)
          for (int j = 0; j < m; j++)
          {
              if (a[i][j] == '#' && val3 == -1) val3 = i;
              if (a[i][j] == '#') val4 = i;
          }

      for (int j = 0; j < m; j++)
          for (int i = 0; i < n; i++)
          {
              if (a[i][j] == '#' && val1 == -1) val1 = j;
              if (a[i][j] == '#') val2 = j;
          }


      for (int i = val3; i <= val4; i++)
          for (int j = val1; j <= val2; j++)
          {
             if (a[i][j] == '.' && cout << "No\n") return;
          }       

      cout << "Yes\n";
  };

/* ------------------------------------ MAIN FUNCTION --------------------------------------- */

  signed main() 
  {
      ios_base::sync_with_stdio(false);
      cin.tie(nullptr); cout.tie(nullptr);

      int __ = 1;
      while (__--) solve();
  }

Submission Info

Submission Time
Task C - Paint to make a rectangle
User aditya_0670
Language C++ 23 (gcc 12.2)
Score 300
Code Size 1730 Byte
Status AC
Exec Time 11 ms
Memory 4608 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 3404 KB
example_01.txt AC 1 ms 3432 KB
example_02.txt AC 1 ms 3404 KB
hand_00.txt AC 4 ms 4608 KB
hand_01.txt AC 5 ms 4608 KB
hand_02.txt AC 4 ms 4608 KB
hand_03.txt AC 5 ms 4488 KB
hand_04.txt AC 4 ms 4408 KB
hand_05.txt AC 1 ms 3508 KB
hand_06.txt AC 1 ms 3508 KB
hand_07.txt AC 1 ms 3452 KB
hand_08.txt AC 1 ms 3532 KB
hand_09.txt AC 5 ms 4560 KB
hand_10.txt AC 5 ms 4484 KB
hand_11.txt AC 4 ms 4408 KB
hand_12.txt AC 4 ms 4420 KB
random_00.txt AC 7 ms 4428 KB
random_01.txt AC 11 ms 4472 KB
random_02.txt AC 4 ms 4420 KB
random_03.txt AC 10 ms 4336 KB
random_04.txt AC 11 ms 4560 KB
random_05.txt AC 4 ms 4476 KB
random_06.txt AC 4 ms 4500 KB
random_07.txt AC 4 ms 4480 KB
random_08.txt AC 4 ms 4428 KB
random_09.txt AC 4 ms 4560 KB
random_10.txt AC 4 ms 4432 KB
random_11.txt AC 4 ms 4304 KB
random_12.txt AC 4 ms 4596 KB
random_13.txt AC 4 ms 4548 KB
random_14.txt AC 4 ms 4584 KB
random_15.txt AC 5 ms 4500 KB
random_16.txt AC 5 ms 4392 KB
random_17.txt AC 4 ms 4276 KB
random_18.txt AC 4 ms 4412 KB
random_19.txt AC 6 ms 4596 KB
random_20.txt AC 4 ms 4468 KB
random_21.txt AC 4 ms 4496 KB
random_22.txt AC 4 ms 4372 KB
random_23.txt AC 4 ms 4504 KB
random_24.txt AC 4 ms 4440 KB


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