QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#673283 | #6563. Four Square | study_to_death | WA | 0ms | 3668kb | C++14 | 4.9kb | 2024-10-24 21:33:15 | 2024-10-24 21:33:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int sqr;
struct node
{
int w, h;
} cube[5];
int p[5];
int flag, w, h;
int num[1005];
signed main()
{
for (int i = 1; i <= 4; i++)
{
p[i] = i;
cin >> cube[i].w >> cube[i].h;
num[cube[i].w]++;
num[cube[i].h]++;
if (cube[i].w == cube[i].h)
num[cube[i].w]--;
}
for (int i = 1; i <= 4; i++)
{
sqr += cube[i].w * cube[i].h;
}
for (int i = 1; i <= 1000; i++)
{
if (num[i] == 4)
{
cout << 1 << endl;
return 0;
}
}
for (int i = 1; i <= 1000; i++)
{
if (num[i] == 3)
{
int len = 0, x;
for (int j = 1; j <= 4; j++)
{
if (cube[j].w == i)
len += cube[j].h;
else if (cube[j].h == i)
len += cube[j].w;
else
x = j;
}
if (cube[x].h == len || cube[x].w == len)
{
cout << 1 << endl;
return 0;
}
}
}
flag = 0;
for (int i = 1; i < 1001; i++)
{
if (num[i] == 2)
{
int len = 0, x = 0, y = 0;
for (int j = 1; j <= 4; j++)
{
if (cube[j].w == i)
len += cube[j].h;
else if (cube[j].h == i)
len += cube[j].w;
else
{
if (!x)
x = j;
else
y = j;
}
}
int len1 = 0;
if (cube[x].h == cube[y].h)
len1 = cube[x].w + cube[y].w;
if (len1 == len || len1 == i)
flag = 1;
if (cube[x].h == cube[y].w)
len1 = cube[x].w + cube[y].h;
if (len1 == len || len1 == i)
flag = 1;
if (cube[x].w == cube[y].w)
len1 = cube[x].h + cube[y].h;
if (len1 == len || len1 == i)
flag = 1;
if (cube[x].w == cube[y].h)
len1 = cube[x].h + cube[y].w;
if (len1 == len || len1 == i)
flag = 1;
if (flag)
{
cout << 1 << endl;
return 0;
}
}
}
for (int i = 1; i <= 1000; i++)
{
if (num[i] == 2)
{
int x = 0, y = 0, len = 0;
for (int j = 1; j <= 4; j++)
{
if (cube[j].h == i)
len += cube[j].w;
else if (cube[j].w == i)
len += cube[j].h;
else
{
if (!x)
x = j;
else
y = j;
}
}
if (len == cube[x].h)
{
if (i + cube[x].w == cube[y].h || i + cube[x].w == cube[y].w)
flag = 1;
}
else if (len == cube[x].w)
{
if (i + cube[x].h == cube[y].h || i + cube[x].h == cube[y].w)
flag = 1;
}
if (len == cube[y].h)
{
if (i + cube[y].w == cube[x].h || i + cube[y].w == cube[x].w)
flag = 1;
}
else if (len == cube[y].w)
{
if (i + cube[y].h == cube[x].h || i + cube[y].h == cube[x].w)
flag = 1;
}
}
else
{
int x = 0, len[2] = {0}, mx = 0;
len[0] = 2 * x;
for (int j = 1; j <= 4; j++)
{
if (cube[j].w == i)
{
if (cube[mx].h < cube[j].h)
mx = j;
}
else if (cube[j].h == i)
{
if (cube[mx].w < cube[mx].h)
mx = j;
}
else
{
x = j;
}
}
for (int j = 1; j <= 4; j++)
{
if (j == x || j == mx)
continue;
if (cube[j].h == i)
len[1] += cube[j].w;
else if (cube[j].w == i)
len[1] += cube[j].h;
}
if (len[0] == cube[x].h || len[0] == cube[x].w)
{
if (len[1] == cube[mx].h || len[1] == cube[mx].w)
flag = 1;
}
}
if (flag)
{
cout << 1 << endl;
return 0;
}
}
cout << 0 << endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3660kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
3 1 3 3 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
2 8 2 8 2 8 2 8
output:
1
result:
ok single line: '1'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3616kb
input:
5 3 5 5 3 3 3 5
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'