Submission #667526
Source Code Expand
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
class Program
{
public Program() { }
static void Main(string[] args)
{
new Program().prog();
}
Scanner cin;
const int MOD = 1000000007;
const int INF = int.MaxValue;
const double EPS = 1e-7;
int N = 30;
void prog()
{
cin = new Scanner();
int[,] a = new int[N, N];
Pair pos = new Pair();
int max = 0;
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
a[i, j] = cin.nextInt();
if (a[i, j] > max)
{
max = a[i, j];
pos = new Pair(i, j);
}
}
}
int[,] d = new int[,] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };
while (max > 0)
{
while (true)
{
Console.WriteLine("{0} {1}", pos.Key + 1, pos.Value + 1);
if (--a[pos.Key, pos.Value] == 0) break;
bool flag = false;
for (int i = 0; i < 4; i++)
{
if (pos.Key + d[i, 0] < 0 || pos.Key + d[i, 0] >= N
|| pos.Value + d[i, 1] < 0 || pos.Value + d[i, 1] >= N) continue;
if (a[pos.Key + d[i, 0], pos.Value + d[i, 1]] == a[pos.Key, pos.Value])
{
pos = new Pair(pos.Key + d[i, 0], pos.Value + d[i, 1]);
flag = true;
break;
}
}
if (!flag)
{
break;
}
}
max = 0;
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
if (a[i, j] > max)
{
max = a[i, j];
pos = new Pair(i, j);
}
}
}
//print(a);
}
}
void print(int[,] a)
{
Console.WriteLine();
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
Console.Write("{0:00}", a[i, j]);
}
Console.WriteLine();
}
Console.WriteLine();
}
}
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++];
string st = Console.ReadLine();
while (st == "") st = Console.ReadLine();
s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
i = 0;
return next();
}
public int nextInt()
{
return int.Parse(next());
}
public long nextLong()
{
return long.Parse(next());
}
public double nextDouble()
{
return double.Parse(next());
}
}
Submission Info
Submission Time |
|
Task |
A - 高橋君の山崩しゲーム |
User |
furuya1223 |
Language |
C# (Mono 4.6.2.0) |
Score |
815581 |
Code Size |
2458 Byte |
Status |
AC |
Exec Time |
678 ms |
Memory |
7128 KB |
Judge Result
Set Name |
test_01 |
test_02 |
test_03 |
test_04 |
test_05 |
test_06 |
test_07 |
test_08 |
test_09 |
test_10 |
Score / Max Score |
81545 / 100000 |
81145 / 100000 |
81698 / 100000 |
81029 / 100000 |
81330 / 100000 |
81491 / 100000 |
82009 / 100000 |
81890 / 100000 |
81808 / 100000 |
81636 / 100000 |
Status |
|
|
|
|
|
|
|
|
|
|
Set Name |
Test Cases |
test_01 |
subtask_01_01.txt |
test_02 |
subtask_01_02.txt |
test_03 |
subtask_01_03.txt |
test_04 |
subtask_01_04.txt |
test_05 |
subtask_01_05.txt |
test_06 |
subtask_01_06.txt |
test_07 |
subtask_01_07.txt |
test_08 |
subtask_01_08.txt |
test_09 |
subtask_01_09.txt |
test_10 |
subtask_01_10.txt |
Case Name |
Status |
Exec Time |
Memory |
subtask_01_01.txt |
AC |
588 ms |
7128 KB |
subtask_01_02.txt |
AC |
678 ms |
7000 KB |
subtask_01_03.txt |
AC |
662 ms |
7000 KB |
subtask_01_04.txt |
AC |
631 ms |
7000 KB |
subtask_01_05.txt |
AC |
657 ms |
7000 KB |
subtask_01_06.txt |
AC |
594 ms |
7000 KB |
subtask_01_07.txt |
AC |
669 ms |
7000 KB |
subtask_01_08.txt |
AC |
655 ms |
7000 KB |
subtask_01_09.txt |
AC |
604 ms |
7000 KB |
subtask_01_10.txt |
AC |
614 ms |
7000 KB |