QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#792216 | #6563. Four Square | lukamosiashvili# | WA | 0ms | 3696kb | C++17 | 2.0kb | 2024-11-29 07:08:34 | 2024-11-29 07:08:35 |
Judging History
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 + 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: 3660kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3604kb
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: 3696kb
input:
2 8 2 8 2 8 2 8
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'