QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#414725 | #6563. Four Square | karuna# | WA | 0ms | 3628kb | C++20 | 1.1kb | 2024-05-19 15:56:23 | 2024-05-19 15:56:24 |
Judging History
answer
#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
pii V[4];
for (int i = 0; i < 4; i++) {
cin >> V[i].ff >> V[i].ss;
}
sort(V, V + 4);
for (int msk = 0; msk < 16; msk++) {
do {
int a[4], b[4];
for (int i = 0; i < 4; i++) {
tie(a[i], b[i]) = V[i];
if (msk >> i & 1) {
swap(a[i], b[i]);
}
}
if (a[0] == a[1] && a[2] == a[3] && b[0] + b[1] == b[2] + b[3]) {
return !(cout << 1 << '\n');
}
if (a[1] == a[2] && a[2] == a[3] && b[0] == b[1] + b[2] + b[3]) {
return !(cout << 1 << '\n');
}
if (a[0] + a[1] == a[2] && a[2] == a[3] && b[0] == b[1]) {
return !(cout << 1 << '\n');
}
if (a[0] + a[1] == a[2] && b[0] == b[1] && b[0] + b[2] == b[3]) {
return !(cout << 1 << '\n');
}
if (a[0] == a[1] && a[1] == a[2] && a[2] == a[3]) {
return !(cout << 1 << '\n');
}
} while (next_permutation(V, V + 4));
}
cout << 0 << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3512kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
3 1 3 3 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
2 8 2 8 2 8 2 8
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
5 3 5 5 3 3 3 5
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 2 4 8 16 32 64 128
output:
0
result:
ok single line: '0'
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3548kb
input:
4 4 2 1 4 4 2 1
output:
1
result:
wrong answer 1st lines differ - expected: '0', found: '1'