QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#594509 | #6563. Four Square | Golden | WA | 1ms | 3912kb | C++23 | 3.5kb | 2024-09-28 01:08:47 | 2024-09-28 01:08:47 |
Judging History
answer
#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2")
//#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define DEBUG
#define x first
#define y second
#define pb push_back
#define all(a) a.begin(),a.end()
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vii;
typedef vector<pll> vll;
template<class T> bool umin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool umax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnd(time(nullptr));
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(ll x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(ull x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(ld 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 << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef DEBUG
#define dbg(x...) cerr << __func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << endl;
#else
#define dbg(x...)
#endif
const int N = 4;
int w[N], h[N];
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
for (int i = 1; i <= 4; ++i) {
cin >> w[i] >> h[i];
}
vi p = {1, 2, 3, 4};
do {
for (int msk = 0; msk <= 15; ++msk) {
bool ok = true;
ok &= ((msk & 1) ? h[p[0]] : w[p[0]]) == ((msk & 2) ? h[p[1]] : w[p[1]]);
ok &= ((msk & 4) ? h[p[2]] : w[p[2]]) == ((msk & 8) ? h[p[3]] : w[p[3]]);
int w1 = ((msk & 1) ? w[p[0]] : h[p[0]]) + ((msk & 2) ? w[p[1]] : h[p[1]]);
int w2 = ((msk & 4) ? w[p[2]] : h[p[2]]) + ((msk & 8) ? w[p[3]] : h[p[3]]);
ok &= w1 == w2;
ok &= ((msk & 2) ? w[p[1]] : h[p[1]]) == ((msk & 8) ? w[p[3]] : h[p[3]]);
ok &= ((msk & 1) ? w[p[0]] : h[p[0]]) == ((msk & 2) ? w[p[2]] : h[p[2]]);
int h1 = ((msk & 2) ? h[p[1]] : w[p[1]]) + ((msk & 8) ? h[p[3]] : w[p[3]]);
int h2 = ((msk & 1) ? w[p[0]] : h[p[0]]) + ((msk & 2) ? w[p[2]] : h[p[2]]);
ok &= h1 == h2;
ok &= w1 == h1;
if (ok) {
cout << 1;
exit(0);
}
}
} while (next_permutation(all(p)));
cout << 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3684kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3620kb
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: 3912kb
input:
2 8 2 8 2 8 2 8
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'