Submission #171932


Source Code Expand

Copy
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
	static void Main(string[] args) {
		new Program().solve();
	}

	Action<Object> PUTS = str => Console.WriteLine(str);
	Action<int[,]> LIST = (array2D) => {
		for (int i = 0; i < array2D.GetLength(0); i++) {
			for (int j = 0; j < array2D.GetLength(1); j++) Console.Write("{0,-3} ", array2D[i, j]);
			Console.WriteLine();
		}
	};
	Action<int, Action<int>> REP = (n, action) => { for (int i = 0; i < n; i++) action(i); };
	Action<int, int, Action<int>> FOR = (a, b, action) => { for (int i = a; i < b; i++) action(i); };
	Action<int, int, Action<int, int>> NEST = (row, col, action) => {
		for (int i = 0; i < row; i++) for (int j = 0; j < col; j++) action(i, j);
	};

	public void solve() {

		Scanner cin = new Scanner();
		int r = cin.nextInt();
		int c = cin.nextInt();
		int d = cin.nextInt();

		int[,] a = new int[r, c];
		for (int i = 0; i < r; i++) for (int j = 0; j < c; j++) a[i, j] = cin.nextInt();

		int ans = 0;

		if (d == 0) {
			ans = a[0, 0];
		} else {
			bool dIsOdd = d % 2 == 0 ? false : true;
			if (dIsOdd) {
				for (int i = 0; i < r; i++) for (int j = 0; j < c; j++)
						if (i % 2 != j % 2 && ans < a[i, j] && i + j <= d) ans = a[i, j];
			} else {
				for (int i = 0; i < r; i++) for (int j = 0; j < c; j++)
						if (i % 2 == j % 2 && ans < a[i, j] && i + j <= d) ans = a[i, j];
			}
		}
		PUTS(ans);

	}

}


class Scanner {
	string[] s;
	int i;
	char[] cs = new char[] { ' ' };

	public Scanner() {
		s = new string[0];
		i = 0;
	}

	public string next() {
		if (i < s.Length) return s[i++];
		s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return s[i++];
	}

	public int nextInt() {
		return int.Parse(next());
	}

	public long nextLong() {
		return long.Parse(next());
	}
}

Submission Info

Submission Time
Task B - 謎の人物X
User parfait
Language C# (Mono 2.10.8.1)
Score 100
Code Size 1907 Byte
Status AC
Exec Time 446 ms
Memory 15276 KB

Judge Result

Set Name Sample Subtask1 Subtask2
Score / Max Score 0 / 0 60 / 60 40 / 40
Status
AC × 3
AC × 18
AC × 30
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 sample_01.txt, sample_02.txt, sample_03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt
Subtask2 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt, subtask2_14.txt, subtask2_15.txt
Case Name Status Exec Time Memory
sample_01.txt AC 241 ms 7720 KB
sample_02.txt AC 136 ms 7788 KB
sample_03.txt AC 141 ms 7800 KB
subtask1_01.txt AC 137 ms 7792 KB
subtask1_02.txt AC 140 ms 7816 KB
subtask1_03.txt AC 141 ms 7812 KB
subtask1_04.txt AC 139 ms 8048 KB
subtask1_05.txt AC 138 ms 7792 KB
subtask1_06.txt AC 159 ms 7916 KB
subtask1_07.txt AC 148 ms 8048 KB
subtask1_08.txt AC 142 ms 8052 KB
subtask1_09.txt AC 149 ms 8056 KB
subtask1_10.txt AC 150 ms 8056 KB
subtask1_11.txt AC 145 ms 8040 KB
subtask1_12.txt AC 446 ms 7988 KB
subtask1_13.txt AC 144 ms 8056 KB
subtask1_14.txt AC 145 ms 8048 KB
subtask1_15.txt AC 142 ms 8052 KB
subtask2_01.txt AC 138 ms 7924 KB
subtask2_02.txt AC 139 ms 7920 KB
subtask2_03.txt AC 231 ms 10364 KB
subtask2_04.txt AC 139 ms 8044 KB
subtask2_05.txt AC 153 ms 8184 KB
subtask2_06.txt AC 186 ms 9332 KB
subtask2_07.txt AC 316 ms 15220 KB
subtask2_08.txt AC 431 ms 15156 KB
subtask2_09.txt AC 417 ms 15268 KB
subtask2_10.txt AC 420 ms 15276 KB
subtask2_11.txt AC 364 ms 15144 KB
subtask2_12.txt AC 431 ms 15132 KB
subtask2_13.txt AC 440 ms 15140 KB
subtask2_14.txt AC 435 ms 15144 KB
subtask2_15.txt AC 439 ms 15144 KB