QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#112376 | #6563. Four Square | ckiseki# | AC ✓ | 2ms | 3404kb | C++20 | 2.0kb | 2023-06-11 14:55:32 | 2023-06-11 14:55:36 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
template <typename ...T>
void debug_(const char *s, T ...a) {
cerr << "\e[1;32m(" << s << ") = (";
int cnt = sizeof...(T);
(..., (cerr << a << (--cnt ? ", " : ")\e[0m\n")));
}
template <typename I>
void orange_(const char *s, I L, I R) {
cerr << "\e[1;32m[ " << s << " ] = [ ";
for (int f = 0; L != R; ++L)
cerr << (f++ ? ", " : "") << *L;
cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) ((void)0)
#define orange(...) ((void)0)
#endif
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
vector<array<int,2>> a(4);
for (int i = 0; i < 4; i++) {
cin >> a[i][0] >> a[i][1];
}
int ok = 0;
for (int s = 0; s < (1 << 4); s++) {
auto b = a;
for (int i = 0; i < 4; i++)
if (s >> i & 1)
swap(b[i][0], b[i][1]);
int p[4] = {0, 1, 2, 3};
do {
auto A = b[p[0]];
auto B = b[p[1]];
auto C = b[p[2]];
auto D = b[p[3]];
if (A[0] == B[0] && B[0] == C[0] && A[1] + B[1] + C[1] == D[1] && D[1] == A[0] + D[0])
ok = 1;
if (A[0] == B[0] && C[0] == D[0] && A[1] + B[1] == C[1] + D[1] && A[1] + B[1] == A[0] + C[0])
ok = 1;
if (A[0] == B[0] && B[0] == C[0] && C[0] == D[0] && A[0] == A[1]+B[1]+C[1]+D[1])
ok = 1;
if (A[1] == B[1] && A[0] + B[0] == C[0] && A[1] + C[1] == D[1] && D[1] == C[0] + D[0])
ok = 1;
if (A[0] == B[0] && A[1] + B[1] == C[1] && C[1] == D[1] && C[0] + D[0] + A[0] == A[1] + B[1])
ok = 1;
if (A[1] == B[1] && A[0] + B[0] == C[0] && C[0] == D[0] && A[1] + C[1] + D[1] == C[0])
ok = 1;
} while (next_permutation(p, p+4));
}
cout << ok << '\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3296kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3296kb
input:
3 1 3 3 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3328kb
input:
2 8 2 8 2 8 2 8
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3348kb
input:
5 3 5 5 3 3 3 5
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
1 2 4 8 16 32 64 128
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3388kb
input:
4 4 2 1 4 4 2 1
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3336kb
input:
995 51 559 565 154 536 56 780
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3316kb
input:
391 694 540 42 240 937 691 246
output:
0
result:
ok single line: '0'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
519 411 782 710 299 45 21 397
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3396kb
input:
96 960 948 18 108 82 371 576
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3324kb
input:
3 2 4 3 3 1 1 4
output:
0
result:
ok single line: '0'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3400kb
input:
4 3 1 2 4 4 3 2
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3316kb
input:
4 4 1 3 5 4 2 5
output:
0
result:
ok single line: '0'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3396kb
input:
1000 1000 1000 1000 1000 1000 1000 1000
output:
1
result:
ok single line: '1'
Test #15:
score: 0
Accepted
time: 2ms
memory: 3396kb
input:
1000 999 998 1000 997 1000 997 997
output:
1
result:
ok single line: '1'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3392kb
input:
1 3 3 3 3 3 4 7
output:
1
result:
ok single line: '1'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3292kb
input:
2 5 5 4 7 1 6 2
output:
1
result:
ok single line: '1'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3288kb
input:
12 2 12 7 7 12 16 4
output:
1
result:
ok single line: '1'
Test #19:
score: 0
Accepted
time: 2ms
memory: 3244kb
input:
7 2 2 14 5 14 7 12
output:
1
result:
ok single line: '1'
Test #20:
score: 0
Accepted
time: 2ms
memory: 3328kb
input:
32 36 5 1 1 37 35 5
output:
1
result:
ok single line: '1'
Test #21:
score: 0
Accepted
time: 2ms
memory: 3300kb
input:
28 30 30 1 31 1 2 30
output:
1
result:
ok single line: '1'
Test #22:
score: 0
Accepted
time: 2ms
memory: 3340kb
input:
66 68 9 11 7 66 9 64
output:
1
result:
ok single line: '1'
Test #23:
score: 0
Accepted
time: 2ms
memory: 3344kb
input:
59 44 25 44 40 32 40 52
output:
1
result:
ok single line: '1'
Test #24:
score: 0
Accepted
time: 2ms
memory: 3312kb
input:
4 4 2 3 4 2 3 2
output:
1
result:
ok single line: '1'