QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#152643 | #6563. Four Square | BUET_POISSON# | WA | 1ms | 3848kb | C++20 | 1.3kb | 2023-08-28 15:47:13 | 2023-08-28 15:47:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0)
#define setbit0(n, i) ((n) & (~(1LL << (i))))
#define setbit1(n, i) ((n) | (1LL << (i)))
#define togglebit(n, i) ((n) ^ (1LL << (i)))
#define lastone(n) ((n) & (-(n)))
char gap = 32;
#define int long long
#define ii pair<int, int>
#define ll long long
#define lll __int128_t
#define pb push_back
void solve() {
vector<ii> planes;
int tot_area = 0;
for (int i=0; i<4; i++) {
int a, b;
cin >> a >> b;
planes.pb({a, b});
tot_area += a*b;
}
int possible = 0;
do {
for (int i=0; i<(1<<4); i++) {
vector<ii> a(planes);
for (int j=0; j<4; j++) if ( (i>>j) & 1) {
swap(a[j].first, a[j].second);
}
int p = a[0].first + a[1].first;
int q = a[1].second + a[3].second;
int r = a[0].second + a[2].second;
int s = a[2].first + a[3].first;
if (p == q and q == r and r == s and p*q == tot_area) possible = 1;
}
} while(next_permutation(planes.begin(), planes.end()));
cout << possible << endl;
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3556kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
3 1 3 3 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3556kb
input:
2 8 2 8 2 8 2 8
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'