Submission #5913513
Source Code Expand
#include "bits/stdc++.h" using namespace std; #define ll long long int #define rep(i,n) for( int i = 0; i < n; i++ ) #define rrep(i,n) for( int i = n; i >= 0; i-- ) #define REP(i,s,t) for( int i = s; i <= t; i++ ) #define RREP(i,s,t) for( int i = s; i >= t; i-- ) #define dump(x) cerr << #x << " = " << (x) << endl; #define INF 2000000000 #define mod 1000000007 #define INF2 1000000000000000000 #define int long long signed main(void) { cin.tie(0); ios::sync_with_stdio(false); int H, W; cin >> H >> W; if (H % 3 == 0 || W % 3 == 0) { cout << 0 << endl; return 0; } int ans = H * W; rep(i, 2) { for(int i = max(0LL, H / 3 - 10); i <= min(H - 1, H / 3 + 10); i++) { for(int j = 0; j < W; j++) { int S1 = W * i; int S2 = j * (H - i); int S3 = (W - j) * (H - i); ans = min(ans, max({S1, S2, S3}) - min({S1, S2, S3})); } } swap(H, W); } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Chocolate Bar |
User | toame |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1080 Byte |
Status | WA |
Exec Time | 10 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
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 | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
0_03.txt | AC | 2 ms | 256 KB |
0_04.txt | AC | 10 ms | 256 KB |
1_00.txt | AC | 1 ms | 256 KB |
1_01.txt | AC | 2 ms | 256 KB |
1_02.txt | AC | 1 ms | 256 KB |
1_03.txt | AC | 1 ms | 256 KB |
1_04.txt | WA | 4 ms | 256 KB |
1_05.txt | AC | 7 ms | 256 KB |
1_06.txt | AC | 1 ms | 256 KB |
1_07.txt | AC | 1 ms | 256 KB |
1_08.txt | AC | 6 ms | 256 KB |
1_09.txt | WA | 7 ms | 256 KB |
1_10.txt | AC | 9 ms | 256 KB |
1_11.txt | AC | 1 ms | 256 KB |
1_12.txt | AC | 1 ms | 256 KB |
1_13.txt | AC | 6 ms | 256 KB |
1_14.txt | AC | 4 ms | 256 KB |