QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#111016#6563. Four SquareTobo#WA 2ms3388kbC++201.3kb2023-06-05 14:21:002023-06-05 14:21:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-05 14:21:01]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3388kb
  • [2023-06-05 14:21:00]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define N 2005

int x[4], y[4], sum;
void solve()
{
    for (int i = 0; i < 4; i++)
        cin >> x[i] >> y[i], sum += x[i] * y[i];
    int a = sqrt(sum + 0.5);
    if (a * a != sum)
    {
        cout << 0;
        return;
    }
    for (int i = 0; i < 16; i++)
    {
        for (int s = 0; s < 16; s++)
        {
            int b = 0, c = 0, d = 0, e = 0;
            for (int j = 0; j < 4; j++)
            {
                if (s >> j & 1)
                {
                    if (i >> j & 1)
                        b += x[j], c += y[j];
                    else
                        b += y[j], c += x[j];
                }
                else
                {
                    if (i >> j & 1)
                        d += x[j], e += y[j];
                    else
                        d += y[j], e += x[j];
                }
            }
            if (a == b && a == c && a == d && a == e)
            {
                cout << 1;
                return;
            }
        }
    }
    cout << 0;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    // cin >> t;
    while (t--)
        solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3388kb

input:

1 1
1 1
1 1
1 1

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3352kb

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

input:

2 8
2 8
2 8
2 8

output:

0

result:

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