Submission #69099444


Source Code Expand

  #include "atcoder/all"
  //#include "atcoder/modint"
  //#pragma GCC optimize("Ofast")
  #include <bits/stdc++.h>
  #include  <string>
  using namespace std;
  using namespace atcoder;
  #define int long long
    template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
  template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
  //const int MOD =1e9+7;
  //constexpr int MOD =10;
  constexpr int MOD =998244353;
  const long long M1=167772161,M2=469762049,M3=1224736769;
  //const int MOD =31607;
  using mint = static_modint<MOD>;
  //using mint = double;
  //using mint = modint;
  ostream& operator << (ostream& ost, const mint& m){ost << m.val();return ost;}
  istream& operator >> (istream& ost,  mint& m){int a;ost >> a;m=a;return ost;}
  double time_limit = 10.0,start_temp=5.0,end_temp=0.0;
  std::random_device seed_gen;
  std::mt19937 engine(seed_gen());

  signed main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    int h,w;
    cin>>h>>w;
    string s[h];
    for(int i=0;i<h;i++)cin>>s[i];
    for(int i=0;i<h;i++)for(int j=0;j<w;j++)if(s[i][j]=='#'){
      int c=0;
      if(i!=0&&s[i-1][j]=='#')c++;
      if(i!=h-1&&s[i+1][j]=='#')c++;
      if(j!=0&&s[i][j-1]=='#')c++;
      if(j!=w-1&&s[i][j+1]=='#')c++;
      if(c!=2&&c!=4){
        cout<<"No"<<endl;
        return 0;
      }
    }
    cout<<"Yes"<<endl;
    
  }

Submission Info

Submission Time
Task B - Looped Rope
User yatuba
Language C++ 20 (gcc 12.2)
Score 200
Code Size 1468 Byte
Status AC
Exec Time 1 ms
Memory 3704 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 25
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_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, 02_handmade_14.txt, 02_handmade_15.txt, 02_handmade_16.txt, 02_handmade_17.txt, 02_handmade_18.txt, 02_handmade_19.txt, 02_handmade_20.txt, 02_handmade_21.txt, 02_handmade_22.txt, 02_handmade_23.txt, 02_handmade_24.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3512 KiB
00_sample_01.txt AC 1 ms 3548 KiB
00_sample_02.txt AC 1 ms 3488 KiB
00_sample_03.txt AC 1 ms 3484 KiB
01_random_04.txt AC 1 ms 3616 KiB
01_random_05.txt AC 1 ms 3568 KiB
01_random_06.txt AC 1 ms 3588 KiB
01_random_07.txt AC 1 ms 3580 KiB
01_random_08.txt AC 1 ms 3548 KiB
01_random_09.txt AC 1 ms 3524 KiB
01_random_10.txt AC 1 ms 3544 KiB
01_random_11.txt AC 1 ms 3548 KiB
01_random_12.txt AC 1 ms 3584 KiB
01_random_13.txt AC 1 ms 3704 KiB
02_handmade_14.txt AC 1 ms 3616 KiB
02_handmade_15.txt AC 1 ms 3564 KiB
02_handmade_16.txt AC 1 ms 3524 KiB
02_handmade_17.txt AC 1 ms 3544 KiB
02_handmade_18.txt AC 1 ms 3548 KiB
02_handmade_19.txt AC 1 ms 3544 KiB
02_handmade_20.txt AC 1 ms 3548 KiB
02_handmade_21.txt AC 1 ms 3524 KiB
02_handmade_22.txt AC 1 ms 3536 KiB
02_handmade_23.txt AC 1 ms 3556 KiB
02_handmade_24.txt AC 1 ms 3496 KiB