QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#751854#8779. Square of Trianglescyj888WA 0ms3848kbC++117.5kb2024-11-15 21:01:212024-11-15 21:01:22

Judging History

你现在查看的是最新测评结果

  • [2024-11-15 21:01:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3848kb
  • [2024-11-15 21:01:21]
  • 提交

answer

#include <bits/stdc++.h>
//#define int long long
#define fi first
#define se second 
#define pb push_back
#define gt()
#define ott(i, l, r) for (register int i = (l); i <= (r); i ++)
#define tto(i, l, r) for (register int i = (r); i >= (l); i --)
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
int read () {
	int x = 0; bool f = false; char c = getchar ();
	while (!isdigit (c)) f |= (c == '-'), c = getchar ();
	while (isdigit (c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar ();
	return f ? -x : x;
}
const int N = 1100, mod = 1e9 + 7;
const ld eps = 1e-6;
int T; int l2[5][4], id[5];
ld p, s;
ld ib[5][4];
ld sl, xl; ld l[5][4];
inline bool cmp (const ld &a1, const ld &a2) {
	return fabs (a1 - a2) <= eps;
}
inline bool irt (ld* jb) {
	return cmp (jb[1] * jb[1] + jb[2] * jb[2], jb[3] * jb[3]);
}
//level 0
inline bool test1 () {
	// if (irt (ib[1]) || irt (ib[2]) || irt (ib[3]) || irt (ib[4])) return false;
	return cmp (ib[1][3], sl) && cmp (ib[2][3], sl) && cmp (ib[3][3], sl) && cmp (ib[4][3], sl) && cmp (ib[1][2], ib[2][1]) && cmp (ib[2][2], ib[3][1]) && cmp (ib[3][2], ib[4][1]) && cmp (ib[4][2], ib[1][1]);
}
inline bool test2 () {
	if (!cmp (ib[1][1] + ib[3][2], xl) || !cmp (ib[2][1] + ib[4][2], xl)) return false;
	return cmp (ib[1][3], sl) && cmp (ib[2][3], sl) && cmp (ib[3][3], sl) && cmp (ib[4][3], sl) && cmp (ib[1][2], ib[3][1]) && cmp (ib[2][2], ib[4][1]) && cmp (ib[1][1] + ib[3][2], ib[2][1] + ib[4][2]);//sl * pow (2,0.5)
}
//level 1
inline bool test3 () {
	if (!irt (ib[2]) || !irt (ib[3])) return false;
	return cmp (ib[1][1] + ib[2][1], sl) && cmp (ib[2][2] + ib[3][2], sl) && cmp (ib[3][1], sl) && cmp (ib[1][3], ib[4][1]) && cmp (ib[2][3], ib[4][2]) && cmp (ib[3][3], ib[4][3]);
}
inline bool test4 () {
	if (!irt (ib[2])) return false;
	return cmp (ib[1][1] + ib[2][1], sl) && cmp (ib[2][2], sl) && cmp (ib[3][1], sl) && cmp (ib[4][1] + ib[3][2], ib[1][3]) && cmp (ib[3][3], ib[4][2]) && cmp (ib[2][3], ib[4][3]);
}
inline bool test5 () {
	if (!irt (ib[2])) return false;
	return cmp (ib[1][1] + ib[4][1] + ib[2][1], sl) && cmp (ib[2][2], sl) && cmp (ib[3][1], sl) && cmp (ib[3][2], ib[1][3]) && cmp (ib[3][3], ib[4][3]) && cmp (ib[2][3], ib[4][2]);
}
inline bool test6 () {
	if (!irt (ib[4])) return false;
	return cmp (ib[1][1] + ib[3][1], sl) && cmp (ib[2][1] + ib[4][1], sl) && cmp (ib[4][2], sl) && cmp (ib[1][3], ib[2][3]) && cmp (ib[2][2], ib[3][2]) && cmp (ib[3][3], ib[4][3]);
}
inline bool test7 () {
	if (!irt (ib[4])) return false;//no xl
	return cmp (ib[1][1] + ib[2][1] + ib[3][1], sl) && cmp (ib[4][1], sl) && cmp (ib[4][2], sl) && cmp (ib[1][3], ib[2][2]) && cmp (ib[2][3], ib[3][2]) && cmp (ib[3][3], ib[4][3]);
}
inline bool test8 () {
	if (!irt (ib[4]) || !cmp (ib[3][3], xl)) return false;
	return cmp (ib[1][1] + ib[2][1], sl) && cmp (ib[3][1] + ib[4][1], sl) && cmp (ib[4][2], sl) && cmp (ib[1][3], ib[2][2]) && cmp (ib[2][3], ib[3][3]) && cmp (ib[3][2], ib[4][3]);
}
inline bool test9 () {//irt?
	return cmp (ib[1][1] + ib[2][2], sl) && cmp (ib[4][3], sl) && cmp (ib[3][3], sl) && cmp (ib[2][1] + ib[3][1], ib[1][3]) && cmp (ib[2][3], ib[4][1]) && cmp (ib[3][2], ib[4][2]);
}
inline bool test10 () {
	if (!irt (ib[2])) return false;
	return cmp (ib[1][1] + ib[2][2], sl) && cmp (ib[2][1] + ib[3][1], sl) && cmp (ib[4][3], sl) && cmp (ib[1][3], ib[4][1]) && cmp (ib[2][3], ib[3][2]) && cmp (ib[3][3], ib[4][2]);
}
inline bool test11 () {
	if (!irt (ib[4])) return false;
	return cmp (ib[1][1] + ib[4][1], sl) && cmp (ib[4][2], sl) && cmp (ib[2][1] + ib[3][1], sl) && cmp (ib[1][3], ib[2][3]) && cmp (ib[2][2], ib[3][2]) && cmp (ib[3][3], ib[4][3]);
}
inline bool test12 () {
	if (!irt (ib[4])) return false;
	return cmp (ib[1][1] + ib[2][1], sl) && cmp (ib[4][2], sl) && cmp (ib[3][1] + ib[4][1], sl) && cmp (ib[1][3], ib[2][2]) && cmp (ib[2][3], ib[3][3]) && cmp (ib[3][2], ib[4][3]);
}
inline bool test13 () {
	if (!irt (ib[4])) return false;//no xl
	return cmp (ib[1][1] + ib[2][2], sl) && cmp (ib[4][1], sl) && cmp (ib[4][2], sl) && cmp (ib[2][1] + ib[3][1], ib[1][3]) && cmp (ib[2][3], ib[3][2]) && cmp (ib[3][3], ib[4][3]);
}
inline bool test14 () {
	return cmp (ib[1][1] + ib[2][1], sl) && cmp (ib[3][3], sl) && cmp (ib[4][3], sl) && cmp (ib[1][3], ib[2][2]) && cmp (ib[3][1] + ib[4][2], ib[2][3]) && cmp (ib[3][2], ib[4][1]);
}
inline bool test15 () {
	return cmp (ib[1][1] + ib[2][1], sl) && cmp (ib[3][3], sl) && cmp (ib[4][3], sl) && cmp (ib[1][3], ib[4][1]) && cmp (ib[2][3] + ib[3][2], ib[4][2]) && cmp (ib[2][2], ib[3][1]);
}
inline bool test16 () {
	if (!irt (ib[4])) return false;//no xl
	return cmp (ib[1][1] + ib[2][3], sl) && cmp (ib[4][1], sl) && cmp (ib[4][2], sl) && cmp (ib[1][3], ib[3][3]) && cmp (ib[2][1], ib[3][1]) && cmp (ib[2][2] + ib[3][2], ib[4][3]);
}
//level 2
inline bool test17 () {
	return cmp (ib[2][3], sl) && cmp (ib[4][3], sl) && cmp (ib[2][1] + ib[3][1] + ib[4][1], ib[1][3]) && cmp (ib[3][1], ib[2][2]) && cmp (ib[3][2], ib[4][2]);
}
inline bool test18 () {
	if (!irt (ib[4])) return false;
	return cmp (ib[3][1] + ib[4][1], sl) && cmp (ib[4][2] + ib[2][1], sl) && cmp (ib[1][3], ib[2][3]) && cmp (ib[2][2], ib[3][3]) && cmp (ib[3][2], ib[4][3]);
}
inline bool test19 () {
    return cmp (ib[2][3], sl) && cmp (ib[3][1] + ib[4][1], sl) && cmp (ib[3][2], ib[4][2]) && cmp (ib[2][1] + ib[4][3], ib[1][3]) && cmp (ib[2][2], ib[3][3]);
}
inline bool test20 () {
	return cmp (ib[2][3], sl) && cmp (ib[4][3], sl) && cmp (ib[2][1] + ib[3][2], ib[1][3]) && cmp (ib[3][1] + ib[4][1], ib[2][2]) && cmp (ib[3][3], ib[4][2]);
}
inline bool test21 () {
	return cmp (ib[2][3], sl) && cmp (ib[3][3] + ib[4][1], sl) && cmp (ib[1][3], ib[4][3]) && cmp (ib[2][2] + ib[3][1], ib[4][2]) && cmp (ib[2][1], ib[3][2]);
}
inline bool test22 () {
	return cmp (ib[2][3], sl) && cmp (ib[3][3], sl) && cmp (ib[2][1], ib[3][1]) && cmp (ib[4][1], ib[2][2]) && cmp (ib[4][2], ib[3][2]) && cmp (ib[4][3], ib[1][3]);
}
bool sol () {
	sl = 0; ott (i, 1, 4) {
		ott (j, 1, 3) l2[i][j] = read (); sort (l2[i] + 1, l2[i] + 4);
		p = 0; ott (j, 1, 3) p += l[i][j] = (ld)sqrt (l2[i][j]), printf ("%0.10Lf\n", l[i][j]); p /= 2.0;
		s = p; ott (j, 1, 3) s *= p - l[i][j]; sl += (ld)sqrt (s); id[i] = i;
	}
	sl = (ld)sqrt (sl), xl = sl * pow (2, 0.5); printf ("%.10Lf\n", sl); do {
		ott (i, 1, 4) 
			ott (j, 1, 3)
				ib[i][j] = l[id[i]][j];
		do {
			do {
				do {
					do {
						if (test1 ()) return true;  if (test2 ()) return true;
						if (!cmp (ib[1][2], sl) || !irt (ib[1])) continue;
						if (test3 ()) return true;  if (test4 ()) return true;
						if (test5 ()) return true;  if (test6 ()) return true;
						if (test7 ()) return true;  if (test8 ()) return true;
						if (test9 ()) return true;  if (test10 ()) return true;
						if (test11 ()) return true; if (test12 ()) return true;
						if (test13 ()) return true; if (test14 ()) return true;
						if (test15 ()) return true; if (test16 ()) return true;
						if (!cmp (ib[1][1], sl)) continue;
						if (test17 ()) return true; if (test18 ()) return true;
						if (test19 ()) return true; if (test20 ()) return true;
						if (test21 ()) return true; if (test22 ()) return true;
					} while (next_permutation (ib[4] + 1, ib[4] + 4));
				} while (next_permutation (ib[3] + 1, ib[3] + 4));
			} while (next_permutation (ib[2] + 1, ib[2] + 4));
		} while (next_permutation (ib[1] + 1, ib[1] + 4));
	} while (next_permutation (id + 1, id + 5));
	return false;
}
int main () {
	T = read (); while (T --) puts (sol () ? "1" : "0");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3848kb

input:

3
1 1 2
2 1 1
2 1 1
1 2 1
1 1 1
1 1 1
1 1 1
1 1 1
5 125 130
125 20 145
45 130 145
145 145 80

output:

1.0000000000
1.0000000000
1.4142135624
1.0000000000
1.0000000000
1.4142135624
1.0000000000
1.0000000000
1.4142135624
1.0000000000
1.0000000000
1.4142135624
1.4142135624
1
1.0000000000
1.0000000000
1.0000000000
1.0000000000
1.0000000000
1.0000000000
1.0000000000
1.0000000000
1.0000000000
1.0000000000...

result:

wrong answer 1st lines differ - expected: '1', found: '1.0000000000'