QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#140318 | #6563. Four Square | smosp# | WA | 1ms | 3548kb | C++23 | 1.3kb | 2023-08-15 17:56:45 | 2023-08-15 17:56:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
bool check(vector<pair<int, int>> &v) {
if(v[0].second == v[1].second && v[2].second == v[3].second && v[0].first + v[1].first == v[2].first + v[3].first && v[0].first + v[1].first == v[0].second + v[2].second) return true;
if(v[0].second == v[1].second && v[1].second == v[2].second && v[0].first + v[1].first + v[2].first == v[3].first && v[0].second + v[3].second == v[3].first) return true;
if(v[0].first == v[1].first && v[1].first == v[2].first && v[2].first == v[3].first && v[0].first == v[0].second + v[1].second + v[2].second + v[3].second) return true;
return false;
}
int main() {
vector<pair<int, int>> v(4);
for(int i = 0; i < 4; i++) {
cin >> v[i].first >> v[i].second;
}
bool pos = false;
sort(v.begin(), v.end());
do {
for(int m = 0; m < 16; m++) {
for(int i = 0; i < 4; i++) {
if((m >> i) & 1) {
swap(v[i].first, v[i].second);
}
}
pos |= check(v);
for(int i = 0; i < 4; i++) {
if((m >> i) & 1) {
swap(v[i].first, v[i].second);
}
}
}
} while(next_permutation(v.begin(), v.end()));
cout << (pos ? 1 : 0) << '\n';
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3548kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3472kb
input:
3 1 3 3 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
2 8 2 8 2 8 2 8
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
5 3 5 5 3 3 3 5
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3504kb
input:
1 2 4 8 16 32 64 128
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3444kb
input:
4 4 2 1 4 4 2 1
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
995 51 559 565 154 536 56 780
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
391 694 540 42 240 937 691 246
output:
0
result:
ok single line: '0'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3448kb
input:
519 411 782 710 299 45 21 397
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
96 960 948 18 108 82 371 576
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3496kb
input:
3 2 4 3 3 1 1 4
output:
0
result:
ok single line: '0'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
4 3 1 2 4 4 3 2
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3492kb
input:
4 4 1 3 5 4 2 5
output:
0
result:
ok single line: '0'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
1000 1000 1000 1000 1000 1000 1000 1000
output:
1
result:
ok single line: '1'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
1000 999 998 1000 997 1000 997 997
output:
1
result:
ok single line: '1'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3436kb
input:
1 3 3 3 3 3 4 7
output:
1
result:
ok single line: '1'
Test #17:
score: -100
Wrong Answer
time: 0ms
memory: 3436kb
input:
2 5 5 4 7 1 6 2
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'