QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#792344#6563. Four Squarelukamosiashvili#WA 0ms3652kbC++172.3kb2024-11-29 09:23:112024-11-29 09:23:12

Judging History

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

  • [2024-11-29 09:23:12]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3652kb
  • [2024-11-29 09:23:11]
  • 提交

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){
        /*while(1){
            if(p[1].first + p[3].first != side) break;
            if(p[1].second + p[2].second != side) break;
            if(p[3].second + p[4].second != side) break;
            if(p[2].first + p[4].first != side) break;
            cout << 1;
            exit(0);
        }*/

        while(1){
            if(p[1].first + p[2].first != side) break;
            if(p[3].first + p[4].first != side) break;
            if(p[1].second != p[2].second || p[3].second != p[4].second) break;
            if(p[1].second + p[3].second != side) break;
            cout << 1;
            exit(0);
        }

        while(1){
            if(p[1].first + p[2].first + p[3].first != p[4].first) break;
            if(p[1].second != p[2].second || p[2].second != p[3].second) break;
            if(p[1].first + p[2].first + p[3].first != side || p[1].second + p[4].second != side) break;
            cout << 1;
            exit(0);
        }

        while(1){
            if(p[1].first + p[2].first != p[3].first || p[3].first != p[4].first) break;
            if(p[1].second != p[2].second) break;
            if(p[1].first + p[2].first != side || p[1].second + p[3].second + p[4].second != side) break;
            cout << 1;
            exit(0);
        }

        while(1){
            if(p[1].first != p[2].first || p[1].first + p[3].first != p[4].first) break;
            if(p[1].second + p[2].second != p[3].second) break;
            if(p[4].first != side || p[3].second + p[4].second != side) break;
            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);
        p[q] = {PU[i].second, PU[i].first};
        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;
}

詳細信息

Test #1:

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

input:

1 1
1 1
1 1
1 1

output:

1

result:

ok single line: '1'

Test #2:

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

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

input:

2 8
2 8
2 8
2 8

output:

0

result:

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