QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#122021#6563. Four Squaretacoref#WA 2ms3560kbC++171.1kb2023-07-09 09:41:172023-07-09 09:41:20

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-09 09:41:20]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3560kb
  • [2023-07-09 09:41:17]
  • Submitted

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'