QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#792214#6563. Four Squarelukamosiashvili#WA 0ms3644kbC++17954b2024-11-29 06:56:462024-11-29 06:56:46

Judging History

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

  • [2024-11-29 06:56:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3644kb
  • [2024-11-29 06:56:46]
  • 提交

answer

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

pair <int, int> PU[9], p[9];
int bo[9];
int area = 0;
int side = 0;

void rec(int q){
    if(q > 4){
        if(p[1].first + p[3].first != side) return;
        if(p[1].second + p[2].second != side) return;
        if(p[3].second + p[4].second != side) return;
        if(p[2].first + p[4].first != side) return;
        cout << 1;
        exit(0);
        return;
    }

    for(int i = 1; i <= 4; i++){
        if(bo[i]) continue;
        bo[i] = 1;
        p[q] = PU[i];
        rec(q + 1);
        bo[i] = 0;
    }
}

int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    for(int i = 1; i <= 4; i++){
        cin >> PU[i].first >> PU[i].second;
        area += PU[i].first * PU[i].second;
    }

    side = sqrt(area);
    if(side * side != area){
        cout << 0;
        return 0;
    }

    rec(1);
    cout << 0;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3644kb

input:

1 1
1 1
1 1
1 1

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3564kb

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

input:

2 8
2 8
2 8
2 8

output:

0

result:

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