結果
| 問題 | 
                            No.2518 Adjacent Larger
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ikoma
                         | 
                    
| 提出日時 | 2023-10-27 22:43:53 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,201 bytes | 
| コンパイル時間 | 13,274 ms | 
| コンパイル使用メモリ | 383,312 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-25 14:43:44 | 
| 合計ジャッジ時間 | 14,426 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 5 WA * 23 | 
ソースコード
#![allow(unused_imports, dead_code, unused_macros, unused_variables, non_snake_case, unused_parens)]
use std::cmp::{min,max,Ordering,Reverse};
use std::mem::swap;
use std::collections::{VecDeque,LinkedList,HashMap,BTreeMap,HashSet,BTreeSet,BinaryHeap};
const YES:&str="Yes";const NO:&str="No";#[inline]fn print_yesno(ans:bool){if ans{println!("{}",YES);}else{println!("{}",NO);}}
fn solve() -> bool {
	let n: usize = {
		let mut line: String = String::new();
		std::io::stdin().read_line(&mut line).unwrap();
		line.trim().parse().unwrap()
	};
	let A: Vec<i64> = {
		let mut line: String = String::new();
		std::io::stdin().read_line(&mut line).unwrap();
		line.split_whitespace()
			.map(|x| x.parse().unwrap())
			.collect()
	};
	let mut n0 = 0;
	let mut n2 = 0;
	for i in 0..n {
		if A[i] == 0 {
			n0+=1;
			if i>0 && A[i-1] == 0 || A[n-1]==0 {
				return false;
			}
		}else if A[i] == 2 {
			n2+=1;
			if i>0 && A[i-1] == 2 || A[n-1]==2 {
				return false;
			}
		}
	}
	n0 == n2 && n0 > 0
}
fn main() {
	let t: usize = {
		let mut line: String = String::new();
		std::io::stdin().read_line(&mut line).unwrap();
		line.trim().parse().unwrap()
	};
	for _ in 0..t {
		print_yesno(solve());
	}
}
            
            
            
        
            
ikoma