QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#122021 | #6563. Four Square | tacoref# | WA | 2ms | 3560kb | C++17 | 1.1kb | 2023-07-09 09:41:17 | 2023-07-09 09:41:20 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = array<int, 2>;
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
using ll = long long;
using pll = pair<ll, ll>;
bool Do(pll A, pll B, pll C, pll D) {
if (A.fi == B.fi + C.fi + D.fi && B.se == C.se && B.se == D.se && A.se + B.se == A.fi) {
return true;
}
if (A.fi + B.fi == C.fi + D.fi && A.se == B.se && C.se == D.se && A.se + C.se == A.fi + B.fi) {
return true;
}
return false;
}
int main() {
vector<pll> w(4);
for (int i = 0; i < 4; i++) {
scanf("%lld%lld", &w[i].fi, &w[i].se);
}
vector<int> Z(4);
for (int i = 0; i < 4; i++)
Z[i] = i;
do {
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 4; j++) {
if ((i >> j) & 1)
swap(w[j].fi, w[j].se);
}
if (Do(w[Z[0]], w[Z[1]], w[Z[2]], w[Z[3]])) {
puts("1");
return 0;
}
for (int j = 0; j < 4; j++) {
if ((i >> j) & 1)
swap(w[j].fi, w[j].se);
}
}
} while (next_permutation(all(Z)));
puts("0");
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3560kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
3 1 3 3 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: -100
Wrong Answer
time: 2ms
memory: 3444kb
input:
2 8 2 8 2 8 2 8
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'