結果
| 問題 | 
                            No.700 LOVE
                             | 
                    
| コンテスト | |
| ユーザー | 
                             MATSUMAT
                         | 
                    
| 提出日時 | 2018-10-07 22:06:11 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 534 bytes | 
| コンパイル時間 | 1,547 ms | 
| コンパイル使用メモリ | 167,148 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-22 23:32:03 | 
| 合計ジャッジ時間 | 2,273 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 16 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,m;
  string s,ans="NO";
  cin >> n >> m;
  for(int i=0;i<n;i++){
    cin >> s;
    int cnt=0;
    for(int i=0;i<m;i++){
      if(s[i]=='L') cnt=1;
      else if(s[i]=='O' and cnt==1) cnt++;
      else if(s[i]=='O' and cnt!=1) cnt=0;
      else if(s[i]=='V' and cnt==2) cnt++;
      else if(s[i]=='V' and cnt!=2) cnt=0;
      else if(s[i]=='E' and cnt==3) ans="YES";
      else if(s[i]=='E' and cnt!=3) cnt=0;
      else cnt=0;
    }
  }
  cout << ans << endl;
}
            
            
            
        
            
MATSUMAT