QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#112369 | #6563. Four Square | ckiseki# | WA | 2ms | 3472kb | C++20 | 2.0kb | 2023-06-11 14:41:09 | 2023-06-11 14:41:12 |
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);
int a[4][2];
for (int i = 0; i < 4; i++) {
cin >> a[i][0] >> a[i][1];
}
int ok = 0;
for (int iter = 0; iter < 2; iter++) {
int p[4] = {0, 1, 2, 3};
do {
auto A = a[p[0]];
auto B = a[p[1]];
auto C = a[p[2]];
auto D = a[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;
for (int i = 0; i < 4; i++)
swap(a[i][0], a[i][1]);
} while (next_permutation(p, p+4));
}
cout << ok << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3308kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3364kb
input:
3 1 3 3 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3472kb
input:
2 8 2 8 2 8 2 8
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
5 3 5 5 3 3 3 5
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3280kb
input:
1 2 4 8 16 32 64 128
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3468kb
input:
4 4 2 1 4 4 2 1
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3304kb
input:
995 51 559 565 154 536 56 780
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
391 694 540 42 240 937 691 246
output:
0
result:
ok single line: '0'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3368kb
input:
519 411 782 710 299 45 21 397
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3228kb
input:
96 960 948 18 108 82 371 576
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3368kb
input:
3 2 4 3 3 1 1 4
output:
0
result:
ok single line: '0'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3356kb
input:
4 3 1 2 4 4 3 2
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3304kb
input:
4 4 1 3 5 4 2 5
output:
0
result:
ok single line: '0'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3360kb
input:
1000 1000 1000 1000 1000 1000 1000 1000
output:
1
result:
ok single line: '1'
Test #15:
score: -100
Wrong Answer
time: 1ms
memory: 3312kb
input:
1000 999 998 1000 997 1000 997 997
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'