結果

問題 No.2535 多重同値
ユーザー kusagame12
提出日時 2024-03-04 19:20:47
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,187 bytes
コンパイル時間 1,932 ms
コンパイル使用メモリ 76,912 KB
実行使用メモリ 74,840 KB
最終ジャッジ日時 2024-09-29 17:31:13
合計ジャッジ時間 8,778 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 8 TLE * 1 -- * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
       
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
       
        boolean[] isTrue = new boolean[N+1];
        
        for(int i = 1 ; i <= N ; i++){
            String yOrN = sc.next();
            if(yOrN.equals("Yes")){
                isTrue[i] = true;
            }else{
                isTrue[i] = false;
            }
        }
       
        if(isTrue[1]){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
       
        for(int i = 2 ; i <= N ; i++){
            
            if(isMatch(isTrue , 1 , i) == isTrue[1]){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }
      
        
    }
    
    private static boolean isMatch(boolean[] isTrue , int l, int r){
        if(l != r){
            if(isMatch(isTrue , l+1 , r) == isTrue[l]){
                return true;
            }else{
                return false;
            }
        }else{
            return isTrue[r];
        }
    }
   
}
0