Submission #2099197


Source Code Expand

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long min = (long) 1e18;
		for(int t=0;t<2;t++){
		
			for(long x=1;x<=H;x++){
				long[] s = new long[3];
				s[0] = x * W;
				s[1] = (H - x) * W / 2;
				s[2] = H * W - s[0] - s[1];
				
				Array.Sort(s);
				min = Math.Min(s[2] - s[0], min);
				
				s[1] = (W - x) * H / 2;
				s[2] = H * W - s[0] - s[1];
				
				Array.Sort(s);
				min = Math.Min(s[2] - s[0], min);
			}
			
			var tmp = H; H = W; W = tmp;
		}
		Console.WriteLine(min);
		
		
	}
	long H,W;
	public Sol(){
		var d = rla();
		H = d[0]; W = d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}

Submission Info

Submission Time
Task C - Chocolate Bar
User kuuso
Language C# (Mono 4.6.2.0)
Score 0
Code Size 1432 Byte
Status WA
Exec Time 60 ms
Memory 17356 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 4
WA × 1
AC × 16
WA × 4
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt
Case Name Status Exec Time Memory
0_00.txt AC 22 ms 9172 KB
0_01.txt AC 23 ms 11220 KB
0_02.txt WA 23 ms 11220 KB
0_03.txt AC 41 ms 13264 KB
0_04.txt AC 60 ms 17356 KB
1_00.txt AC 22 ms 9172 KB
1_01.txt AC 39 ms 15312 KB
1_02.txt AC 35 ms 13264 KB
1_03.txt AC 39 ms 15440 KB
1_04.txt WA 33 ms 13268 KB
1_05.txt AC 42 ms 13264 KB
1_06.txt AC 51 ms 13260 KB
1_07.txt AC 39 ms 13392 KB
1_08.txt AC 41 ms 15312 KB
1_09.txt WA 45 ms 13264 KB
1_10.txt WA 49 ms 15308 KB
1_11.txt AC 34 ms 13268 KB
1_12.txt AC 47 ms 15312 KB
1_13.txt AC 41 ms 13264 KB
1_14.txt AC 32 ms 11220 KB