結果

問題 No.1213 sio
ユーザー Rho
提出日時 2020-08-28 12:53:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 1,682 ms
コンパイル使用メモリ 165,968 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-09 01:10:31
合計ジャッジ時間 2,773 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define rep(i,n)for(int i=0;i<(int)(n);i++)
using namespace std;
#define all(a) a.begin(),a.end()
typedef long long ll;
#define vi vector<ll>
typedef pair<ll,ll>P;
const ll inf=1ll<<61;

signed main(){
	ll h,w;cin>>h>>w;
	if(h%2==0&&w%2==0)cout<<0<<endl;
	else if(h%2==0||w%2==0){
		if(h%2==0)swap(h,w);
		cout<<w/4<<endl;
	}
	else{
		if(h%4==3&&w%4==3){
			if(h>w)swap(h,w);
			if(h==3)cout<<w/4<<endl;
			else cout<<4<<endl;
		}
		else{
			cout<<(h-1)/4+(w-1)/4<<endl;
		}
	}
}
0