QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#796775#6563. Four Squarezeyu#WA 0ms3788kbC++232.5kb2024-12-02 02:49:552024-12-02 02:49:55

Judging History

你现在查看的是最新测评结果

  • [2024-12-02 02:49:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3788kb
  • [2024-12-02 02:49:55]
  • 提交

answer

#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define pl pair<ll, ll>
#define pi pair<int, int>
#define minpq priority_queue<ll, vector<ll>, greater<ll>>
using namespace std;

#if 1
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '['; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "]";}
void _print() {cerr << endl << flush;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "*["<<__LINE__<<"]\t"<< #x << " = "; _print(x)
#endif

const ll mod = 1e9 + 7;

template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;}
ll gcd(ll a, ll b) {if(b == 0){return a;} return gcd(b, a % b);}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int w[4], h[4];
	for (int i = 0; i < 4; i ++) cin >> w[i] >> h[i];
	int area = 0;
	for (int i = 0; i < 4; i ++) area += h[i] * w[i];
	int len = sqrt(area);
	for (int i = len - 1; i <= len + 1; i ++){
		if (i * i == area) len = i;
	}
	if (len * len != area){
		cout << 0 << '\n';
		return 0;
	}
	vector<int> perm(4); for (int i = 0; i < 4; i ++) perm[i] = i;
	do{
		for (int mask = 0; mask < (1 << 4); mask ++){
			int nh[4], nw[4];
			for (int i = 0; i < 4; i ++){
				nh[i] = (mask & (1 << i) ? w[perm[i]] : h[perm[i]]);
				nw[i] = (mask & (1 << i) ? h[perm[i]] : w[perm[i]]);
			}
			if (nh[0] == nh[1] && nh[2] == nh[3] && nh[0] + nh[2] == len && nw[0] + nw[1] == len && nw[2] + nw[3] == len){
				cout << 1 << '\n';
				return 0;
			}
		}
	} while(next_permutation(perm.begin(), perm.end()));
	cout << 0 << '\n';
}

/*
Do something instead of nothing!
Print out stuffs / study samples when you cannot find the bug!
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3548kb

input:

1 1
1 1
1 1
1 1

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3608kb

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: 3788kb

input:

2 8
2 8
2 8
2 8

output:

0

result:

wrong answer 1st lines differ - expected: '1', found: '0'