QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#111014#6563. Four SquareTobo#WA 2ms3396kbC++20925b2023-06-05 14:13:272023-06-05 14:13:30

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:13:30]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3396kb
  • [2023-06-05 14:13:27]
  • 提交

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++)
    {
        int b = 0, c = 0;
        for (int j = 0; j < 4; j++)
        {
            if (i >> j & 1)
                b += x[j], c += y[j];
            else
                b += y[j], c += x[j];
        }
        if (b & 1 || c & 1)
            continue;
        b >>= 1, c >>= 1;
        if (a == b && a == c)
        {
            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: 3380kb

input:

1 1
1 1
1 1
1 1

output:

1

result:

ok single line: '1'

Test #2:

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

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

input:

2 8
2 8
2 8
2 8

output:

0

result:

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