結果
問題 | No.274 The Wall |
ユーザー |
![]() |
提出日時 | 2016-05-11 01:33:05 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 4,013 bytes |
コンパイル時間 | 1,467 ms |
コンパイル使用メモリ | 111,880 KB |
実行使用メモリ | 26,016 KB |
最終ジャッジ日時 | 2024-06-29 13:45:16 |
合計ジャッジ時間 | 2,614 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 WA * 2 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Collections.Generic;using System.Text;using System.Linq;class Program{public void Proc(){Reader.IsDebug = false;int[] inpt = Reader.GetInt();int blockCount = inpt[0];int blockLength = inpt[1];int[] cnt = new int[blockLength + 1];for(int i=0; i<blockCount; i++) {inpt = Reader.GetInt();cnt[inpt[0]] += 1;cnt[inpt[1]+1] -= 1;}int siki = blockLength / 2;if(blockLength % 2 == 1) {siki++;}int[] val = new int[blockLength + 1];int currentVal = 0;for(int i=0; i<blockLength; i++) {currentVal += cnt[i];val[i] = currentVal;}for(int i=siki; i<blockLength; i++) {val[blockLength - i - 1] += val[i];}bool isYes = true;for(int i=1; i<blockLength / 2; i++) {if(val[i] > 2) {isYes = false;break;}}if(isYes && blockLength % 2 > 0) {if(val[blockLength / 2] > 1) {isYes = true;}}Console.WriteLine(isYes?"YES":"NO");}public class Reader{public static bool IsDebug = true;private static String PlainInput = @"181 2067595 6081963 19821791 17961897 19021552 15561934 1940830 844457 4592009 20121116 1118447 455578 578241 2411004 10061139 1146659 6661027 1036639 655196 197399 419750 752388 389717 731532 5481050 1054570 5751701 1703135 137468 476383 385289 290525 539735 739444 4471948 1953701 705611 6291914 19181366 1367267 271710 7151988 19881269 12851667 16761571 1578563 5681152 11721957 19571101 1107307 3081395 1397362 3631507 1510262 2671770 17701172 11861873 1884915 919530 5311743 1744858 866693 695934 9451468 1476400 404490 504470 4771747 17501538 1542929 9331108 1115336 338806 8326 61584 15891152 11551262 126723 261075 1087750 7781336 13461739 17432059 20591324 132968 711812 18311288 1308821 8291543 15471920 19261161 1170218 224552 560209 216257 261846 8481427 1428422 432450 4551783 17871479 14851063 10671022 10261733 17421947 1947870 8711738 1738177 1901006 1011478 48476 88745 749876 8761599 1600551 5521709 17091379 1381278 2881632 16401511 15131892 1902541 543366 3751138 11441389 1390779 793350 3551103 11131937 19411363 1368561 5631048 10491646 16531017 10201381 13821947 19551903 190473 7516 17384 3932052 20581704 1704692 694606 6101483 14851705 17111800 18241433 1441863 872680 6831753 17591600 1600223 226284 2911853 1856965 10031760 17612022 203760 61380 3821943 1945150 159353 354407 4091443 14521402 1406160 1631211 12122038 20451146 114845 512001 20021858 1872655 6571416 14241922 1924710 7171690 16901254 1258843 8561577 1583";private static System.IO.StringReader Sr = null;public static string ReadLine(){if (IsDebug){if (Sr == null){Sr = new System.IO.StringReader(PlainInput.Trim());}return Sr.ReadLine();}else{return Console.ReadLine();}}public static int[] GetInt(char delimiter = ' ', bool trim = false){string inptStr = ReadLine();if (trim){inptStr = inptStr.Trim();}string[] inpt = inptStr.Split(delimiter);int[] ret = new int[inpt.Length];for (int i = 0; i < inpt.Length; i++){ret[i] = int.Parse(inpt[i]);}return ret;}}static void Main(){Program prg = new Program();prg.Proc();}}