QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#664903 | #6563. Four Square | deepthought# | WA | 0ms | 3800kb | C++23 | 2.1kb | 2024-10-21 23:16:57 | 2024-10-21 23:16:58 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
vector <pair <int,int>> vp;
for(int i = 0; i < 4; i++) {
int x, y;
cin >> x >> y;
vp.push_back({x, y});
}
do {
bool ok = false;
for(int msk = 0; msk < 16; msk++) {
int ax[4];
int ay[4];
for(int i = 0; i < 4; i++) {
ax[i] = vp[i].first;
ay[i] = vp[i].second;
if((1 << i) & msk) swap(ax[i], ay[i]);
}
int res = 0;
for(int i = 0; i < 3; i++) if(ay[i] == ay[i + 1]) res++;
if(res == 4 && ay[0] == ax[0]+ax[1]+ax[2]+ax[3]) ok = true;
if(ay[0] == ay[1] && ay[2] == ay[1]) {
if(ax[0] + ax[1] + ax[2] == ax[3]) {
if(ay[3] + ay[0] == ax[0] + ax[1] + ax[2]) ok = true;
}
}
if(ax[0] + ax[2] == ax[1] + ax[3]) {
if(ay[0] == ay[2] && ay[1] == ay[3]) {
if(ax[0] + ax[2] == ay[2] + ay[3]) ok = true;
}
}
if(ay[0] == ay[3] && ay[1] + ay[2] == ay[3]) {
if(ax[1] == ax[2]) {
if(ax[0] + ax[1] + ax[3] == ay[0]) ok = true;
}
}
if(ay[0] == ay[1]) {
if(ay[0] == ay[2] + ay[3]) {
if(ax[2] == ax[3]) {
if(ax[0] + ax[1] + ax[2] == ay[0]) ok = true;
}
}
}
if(ay[0] == ay[2] + ay[3]) {
if(ax[2] == ax[3]) {
if(ax[2] + ax[0] == ax[1]) {
if(ax[0] + ax[2] == ay[0] + ay[1]) ok = true;
}
}
}
}
if(ok) {
cout << 1 << endl;
return 0;
}
} while (next_permutation(vp.begin(), vp.end()));
cout << 0 << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3524kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
3 1 3 3 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3584kb
input:
2 8 2 8 2 8 2 8
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'