結果
問題 | No.5002 stick xor |
ユーザー | arbt |
提出日時 | 2018-06-01 12:51:18 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 332 ms / 1,000 ms |
コード長 | 4,093 bytes |
コンパイル時間 | 12,003 ms |
実行使用メモリ | 10,484 KB |
スコア | 40,509 |
最終ジャッジ日時 | 2018-06-01 12:51:33 |
ジャッジサーバーID (参考情報) |
judge8 / |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 285 ms
10,476 KB |
testcase_01 | AC | 279 ms
10,472 KB |
testcase_02 | AC | 298 ms
10,472 KB |
testcase_03 | AC | 274 ms
10,476 KB |
testcase_04 | AC | 282 ms
10,468 KB |
testcase_05 | AC | 280 ms
10,472 KB |
testcase_06 | AC | 326 ms
10,472 KB |
testcase_07 | AC | 279 ms
10,476 KB |
testcase_08 | AC | 279 ms
10,468 KB |
testcase_09 | AC | 278 ms
10,476 KB |
testcase_10 | AC | 285 ms
10,472 KB |
testcase_11 | AC | 315 ms
10,476 KB |
testcase_12 | AC | 291 ms
10,480 KB |
testcase_13 | AC | 269 ms
10,476 KB |
testcase_14 | AC | 281 ms
10,472 KB |
testcase_15 | AC | 332 ms
10,476 KB |
testcase_16 | AC | 277 ms
10,468 KB |
testcase_17 | AC | 274 ms
10,468 KB |
testcase_18 | AC | 276 ms
10,476 KB |
testcase_19 | AC | 276 ms
10,476 KB |
testcase_20 | AC | 321 ms
10,464 KB |
testcase_21 | AC | 285 ms
10,476 KB |
testcase_22 | AC | 274 ms
10,472 KB |
testcase_23 | AC | 273 ms
10,480 KB |
testcase_24 | AC | 279 ms
10,472 KB |
testcase_25 | AC | 303 ms
10,472 KB |
testcase_26 | AC | 292 ms
10,472 KB |
testcase_27 | AC | 278 ms
10,472 KB |
testcase_28 | AC | 277 ms
10,476 KB |
testcase_29 | AC | 297 ms
10,484 KB |
testcase_30 | AC | 288 ms
10,468 KB |
testcase_31 | AC | 265 ms
10,476 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 2.3.1.61919 (57c81319) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Numerics; class _Class { void _Do() { // var NK = Split.ints(); var N = NK[0]; var K = NK[1]; var L = Split.ints(); // var map = new int[N+1,N+1]; for (int y = 1; y <= N; y++) { var a = Split.strings()[0]; for (int x = 1; x <= N; x++) map[y,x] = int.Parse(a.Substring(x-1,1)); } // for (int i = 0; i < L.Length; i++) { var _長さ = L[i]; var _有効 = new bool[N + 1, N + 1]; { for (int x = 1; x <= N; x++) for (int y = 1; y <= N; y++) _有効[x, y] = false; } { for (int x = 1; x <= N; x++) for (int y = 1; y <= N; y++) _有効[x, y] = true; } // var x_res = 1; var y_res = 1; var _横 = true; int min = int.MaxValue; int max = int.MinValue; // for (int y = 1; y <= N; y++) { // for (int x = 1; x <= N - (_長さ - 1); x++) { var b = false; for (int s = 0; s < _長さ; s++) if (!_有効[y, x + s]) { b= true; break; } if(b ) continue; var n = 0; for (int s = 0; s < _長さ; s++) n += map[y, x + s]; if (n > max) { max = n; x_res = x; y_res = y; } } } // for (int x = 1; x <= N; x++) { // for (int y = 1; y <= N - (_長さ - 1); y++) { var b = false; for (int s = 0; s < _長さ; s++) if (!_有効[y+s, x ]) { b = true; break; } if (b) continue; var n = 0; for (int s = 0; s < _長さ; s++) n += map[y+s, x]; if (n > max) { max = n; x_res = x; y_res = y; _横 = false; } } } if (_横) { // 出力 Console.WriteLine( $"{y_res} {x_res} " + $"{y_res} {x_res + _長さ - 1}"); { for (int s = 0; s < _長さ; s++) map[y_res, x_res + s] = 1 - map[y_res, x_res + s]; } } else{ // 出力 Console.WriteLine( $"{y_res} {x_res} " + $"{y_res+_長さ-1} {x_res}"); { for (int s = 0; s < _長さ; s++) map[y_res+s, x_res] = 1 - map[y_res+s, x_res]; } } } } // static void Main(string[] args) { _(args); new _Class()._Do(); } [Conditional("DEBUG")] static void _(string[] args) { if (args.Length != 0 && File.Exists(args[0])) Console.SetIn(new StreamReader(args[0])); else Console.Error.WriteLine("in"); } } static class Split { // 1 public static string[] strings() { return Console.ReadLine().Split(); } // [2.1] -2,147,483,648 ~ +2,147,483,647 public static int[] ints() { var _s = Console.ReadLine().Split(); var x = new int[_s.Length]; for (var i = 0; i < _s.Length; i++) x[i] = int.Parse(_s[i]); return x; } // [2.2] // -9,223,372,036,854,775,808 ~ // +9,223,372,036,854,775,807 public static long[] longs() { var _s = Console.ReadLine().Split(); var x = new long[_s.Length]; for (var i = 0; i < _s.Length; i++) x[i] = long.Parse(_s[i]); return x; } public static double[] doubles() { var _s = Console.ReadLine().Split(); var x = new double[_s.Length]; for (var i = 0; i < _s.Length; i++) x[i] = double.Parse(_s[i]); return x; } public static BigInteger[] bigs() { var _s = Console.ReadLine().Split(); var x = new BigInteger[_s.Length]; for (var i = 0; i < _s.Length; i++) x[i] = BigInteger.Parse(_s[i]); return x; } }