Submission #19723060


Source Code Expand

Copy
#include <cstdio>
#include <algorithm>
using namespace std;

template <typename T>
void read(T &x) {
	T f=1;x=0;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-') f=-1;s=getchar();}
	while(s>='0'&&s<='9') {x=(x<<3)+(x<<1)+(s^'0');s=getchar();}
	x *= f;
}

int T;

int main() {
	scanf("%d" , &T);
	while(T -- > 0) {
		int ax , ay , bx , by , cx , cy;
		read(ax),read(ay),read(bx),read(by),read(cx),read(cy);
		int hx , hy;
		if((ax == bx && ay == cy) || (ax == cx && ay == by)) hx = ax , hy = ay;
		if((ax == bx && by == cy) || (bx == cx && ay == by)) hx = bx , hy = by;
		if((cx == bx && ay == cy) || (ax == cx && by == cy)) hx = cx , hy = cy;
		int mx = min(ax , min(bx , cx)) , my = min(ay , min(by , cy));
		if(!hx && !hy && !mx && !my) {
			puts("0");
			continue;
		}
		if(hx >= 0 && hy >= 0) {
			int ans = max(abs(mx) , abs(my)) * 2;
			if(hx != mx || mx == my) ans ++;
			printf("%d\n" , ans);
		}
		else if(hx < 0 && hy >= 0){
			int ans = max(abs(mx) , abs(my)) * 2;
			if(mx + 1 == hx && my + 1 == hy) ans --;
			printf("%d\n" , ans);
		}
		else if(hx < 0 && hy < 0) {
			int ans = max(abs(mx) , abs(my)) * 2;
			if(hx == mx && mx != my) ans --;
			printf("%d\n" , ans);
		}
		else {
			int ans = max(abs(mx) , abs(my)) * 2;
			if(mx == hx && my + 1 == hy) ans --;
			printf("%d\n" , ans);
		}
	}
	return 0;
}

Submission Info

Submission Time
Task D - L
User Reanap
Language C++ (Clang 10.0.0)
Score 0
Code Size 1370 Byte
Status WA
Exec Time 11 ms
Memory 3196 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
AC × 2
AC × 2
WA × 13
Set Name Test Cases
Sample sample.txt, sample_2.txt
All edge.txt, edge_2.txt, edge_3.txt, edge_4.txt, edge_5.txt, edge_6.txt, edge_7.txt, edge_8.txt, random.txt, random_2.txt, random_3.txt, random_4.txt, random_5.txt, sample.txt, sample_2.txt
Case Name Status Exec Time Memory
edge.txt WA 11 ms 3196 KB
edge_2.txt WA 2 ms 3152 KB
edge_3.txt WA 2 ms 2992 KB
edge_4.txt WA 2 ms 3020 KB
edge_5.txt WA 2 ms 3052 KB
edge_6.txt WA 2 ms 3084 KB
edge_7.txt WA 3 ms 3056 KB
edge_8.txt WA 2 ms 2992 KB
random.txt WA 3 ms 3056 KB
random_2.txt WA 2 ms 3028 KB
random_3.txt WA 2 ms 3196 KB
random_4.txt WA 2 ms 2992 KB
random_5.txt WA 3 ms 3004 KB
sample.txt AC 3 ms 3000 KB
sample_2.txt AC 2 ms 3048 KB