Submission #2543980
Source Code Expand
#include<bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1e9+7 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long using namespace std; int main(){ ll h,w;cin>>h>>w; ll ans=llINF; if(h%3==0||w%3==0){ cout<<0<<endl; }else{ if(h%2&&w%2){ ans=min(ans,h*(w/2)-(h/2)*(w/2)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-(h/2)*(w/2)); }else if(h%2&&w%2==0){ ans=min(ans,h*(w/2)-((h/2)+1)*(w/2)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-(h/2)*(w/2)); }else if(h%2==0&&w%2){ ans=min(ans,h*(w/2)-(h/2)*((w/2)+1)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-(h/2)*(w/2)); }else{ ans=min(ans,h*(w/2)-(h/2)*(w/2)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-(h/2)*(w/2)); } cout<<ans<<endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Chocolate Bar |
User | shi |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1008 Byte |
Status | WA |
Exec Time | 2 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 | 2 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | WA | 1 ms | 256 KB |
0_03.txt | WA | 1 ms | 256 KB |
0_04.txt | WA | 1 ms | 256 KB |
1_00.txt | WA | 1 ms | 256 KB |
1_01.txt | WA | 1 ms | 256 KB |
1_02.txt | AC | 1 ms | 256 KB |
1_03.txt | AC | 1 ms | 256 KB |
1_04.txt | WA | 1 ms | 256 KB |
1_05.txt | WA | 1 ms | 256 KB |
1_06.txt | AC | 1 ms | 256 KB |
1_07.txt | AC | 1 ms | 256 KB |
1_08.txt | WA | 1 ms | 256 KB |
1_09.txt | WA | 1 ms | 256 KB |
1_10.txt | WA | 1 ms | 256 KB |
1_11.txt | AC | 1 ms | 256 KB |
1_12.txt | AC | 1 ms | 256 KB |
1_13.txt | WA | 1 ms | 256 KB |
1_14.txt | WA | 1 ms | 256 KB |