QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#673283#6563. Four Squarestudy_to_deathWA 0ms3668kbC++144.9kb2024-10-24 21:33:152024-10-24 21:33:17

Judging History

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

  • [2024-10-24 21:33:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3668kb
  • [2024-10-24 21:33:15]
  • 提交

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'