QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#664903#6563. Four Squaredeepthought#WA 0ms3800kbC++232.1kb2024-10-21 23:16:572024-10-21 23:16:58

Judging History

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

  • [2024-10-21 23:16:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3800kb
  • [2024-10-21 23:16:57]
  • 提交

answer

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

int32_t main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    vector <pair <int,int>> vp;
    for(int i = 0; i < 4; i++) {
        int x, y;
        cin >> x >> y;
        vp.push_back({x, y});
    }

    do {    
        bool ok = false;
        for(int msk = 0; msk < 16; msk++) {
            int ax[4];
            int ay[4];    
            for(int i = 0; i < 4; i++) {
                ax[i] = vp[i].first;
                ay[i] = vp[i].second;
                if((1 << i) & msk) swap(ax[i], ay[i]);
            }

            int res = 0;
            for(int i = 0; i < 3; i++) if(ay[i] == ay[i + 1]) res++;
            if(res == 4 && ay[0] == ax[0]+ax[1]+ax[2]+ax[3]) ok = true;

            if(ay[0] == ay[1] && ay[2] == ay[1]) {
                if(ax[0] + ax[1] + ax[2] == ax[3]) {
                    if(ay[3] + ay[0] == ax[0] + ax[1] + ax[2]) ok = true;
                }
            }         

            if(ax[0] + ax[2] == ax[1] + ax[3]) {
                if(ay[0] == ay[2] && ay[1] == ay[3]) {
                    if(ax[0] + ax[2] == ay[2] + ay[3]) ok = true;
                }
            }
            
            if(ay[0] == ay[3] && ay[1] + ay[2] == ay[3]) {
                if(ax[1] == ax[2]) {
                    if(ax[0] + ax[1] + ax[3] == ay[0]) ok = true;
                }
            }

            if(ay[0] == ay[1]) {
                if(ay[0] == ay[2] + ay[3]) {
                    if(ax[2] == ax[3]) {
                        if(ax[0] + ax[1] + ax[2] == ay[0]) ok = true;
                    }
                }
            }
            
            if(ay[0] == ay[2] + ay[3]) {
                if(ax[2] == ax[3]) {
                    if(ax[2] + ax[0] == ax[1]) {
                        if(ax[0] + ax[2] == ay[0] + ay[1]) ok = true;
                    }
                }
            }
            
        }


        if(ok) {
            cout << 1 << endl;
            return 0;
        }

    } while (next_permutation(vp.begin(), vp.end()));
    cout << 0 << endl;
}

详细

Test #1:

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

input:

1 1
1 1
1 1
1 1

output:

1

result:

ok single line: '1'

Test #2:

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

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

input:

2 8
2 8
2 8
2 8

output:

0

result:

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