QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#227594#6563. Four SquareNerovix#WA 1ms3404kbC++201.2kb2023-10-27 19:20:442023-10-27 19:20:44

Judging History

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

  • [2023-10-27 19:20:44]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3404kb
  • [2023-10-27 19:20:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second

typedef long long ll;
typedef pair<int, int> pii;

pii a[4];
signed main() {
    for(int i = 0; i < 4; i++)
        cin >> a[i].fi >> a[i].se;
    do {
        for(int s = 0; s < 1 << 4; s++) {
            pii b[4];
            for(int i = 0; i < 4; i++) {
                b[i] = a[i];
                if(s >> i & 1) swap(b[i].fi, b[i].se);
            }
            if(b[0].fi == b[1].se + b[2].se && b[1].fi == b[2].fi &&
                    b[0].se + b[1].fi == b[3].fi && b[3].fi == b[0].fi + b[0].se) {
                cout << "1\n";
                return 0;
            } else if(b[0].fi == b[1].fi + b[2].fi && b[1].se == b[2].se &&
                    b[0].fi == b[3].fi && b[0].fi == b[0].se + b[1].se + b[3].se) {
                cout << "1\n";
                return 0;
            } else if(b[0].fi + b[1].fi == b[2].fi + b[2].se && b[0].se == b[1].se &&
                    b[0].se + b[2].se == b[0].fi + b[1].fi && b[2].se == b[3].se) {
                cout << "1\n";
                return 0;
            }
        }
    } while(next_permutation(a, a + 4));
    cout << "0\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3332kb

input:

1 1
1 1
1 1
1 1

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3328kb

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

input:

2 8
2 8
2 8
2 8

output:

0

result:

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