??透?jìng)賽題目講解_Touring cities
2022-05-07 14:27 作者:Clayton_Zhou | 我要投稿
//??https://ac.nowcoder.com/acm/contest/33549/E
#include <cstdio>
#include <cstring>
//#include<bits/stdc++.h>?
using namespace std;
int main()
{
? ? int t;
? ? scanf("%d",&t);
? ? while(t--)
? ? {
? ? ? ? int n,m,k;
? ? ? ? bool flag=false;
? ? ? ? scanf("%d%d%d",&n,&m,&k);
? ? ? ? int x1,x2,y1,y2;
? ? ? ? for(int i=0;i<k;i++)
? ? ? ? {
? ? ? ? ? ? scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
? ? ? ? ? ? if(x1==x2&&y1==y2)continue;
? ? ? ? ? ? if(x1%2==y1%2&&x2%2==y2%2)flag=true;
? ? ? ? }
? ? ? ? if(n%2==0||m%2==0||flag)
? ? ? ? {
? ? ? ? ? ? printf("%d\n",n*m);
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? printf("%d\n",n*m+1);
? ? ? ? }
? ? }
? ? return 0;
}
標(biāo)簽: