Submission #1518382
Source Code Expand
#include <bits/stdc++.h> using namespace std; long long x, y, f1, f2, f3, smax, smin, kq1 = 999999999, kq = 999999999; int main() { cin >> x >> y; if(x % 3 == 0 || y % 3 == 0){ cout << 0; return 0; } for(int i = 1; i <= x / 2; i++){ for(int j = 1; j < y; j++){ f1 = i * j; smax = smin = f1; f2 = (x - i)* j; smax = max(smax, f2); smin = min(smin, f2); f3 = x*y - f1 - f2; smax = max(smax, f3); smin = min(smin, f3); kq1 = min(kq1, smax - smin); } } kq = min(kq, kq1); for(int i = 1; i <= y / 2; i++){ for(int j = 1; j < x; j++){ f1 = i * j; smax = smin = f1; f2 = (y - i)* j; smax = max(smax, f2); smin = min(smin, f2); f3 = x*y - f1 - f2; smax = max(smax, f3); smin = min(smin, f3); kq1 = min(kq1, smax - smin); } } kq = min(kq, kq1); cout << kq; }
Submission Info
Submission Time | |
---|---|
Task | C - Chocolate Bar |
User | uongnuocbangmom |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1100 Byte |
Status | TLE |
Exec Time | 2103 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 | TLE | 2103 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 | TLE | 2103 ms | 256 KB |
1_05.txt | TLE | 2103 ms | 256 KB |
1_06.txt | AC | 1 ms | 256 KB |
1_07.txt | AC | 1 ms | 256 KB |
1_08.txt | TLE | 2103 ms | 256 KB |
1_09.txt | TLE | 2103 ms | 256 KB |
1_10.txt | TLE | 2103 ms | 256 KB |
1_11.txt | AC | 1 ms | 256 KB |
1_12.txt | AC | 1 ms | 256 KB |
1_13.txt | TLE | 2103 ms | 256 KB |
1_14.txt | TLE | 2103 ms | 256 KB |