QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#617321 | #1958. Grid Triangle | Afterlife# | WA | 1ms | 3820kb | C++20 | 3.5kb | 2024-10-06 14:55:33 | 2024-10-06 14:55:34 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int a, b, c;
cin >> a >> b >> c;
ll ans = 0;
vector<vector<int> > v;
// v.push_back(vector<int>{0 , 1 , 1});
// v.push_back(vector<int>{1 , 1 , 2});
v.push_back(vector<int>{1 , 2 , 3});
v.push_back(vector<int>{1 , 2 , 4});
set<vector<int> > sv;
for(auto &x : v ) {
auto p1 = x;
do{
auto p2 = x;
do{
for(int s1 = 0;s1 < (1 << 3);s1++) {
for(int s2 = 0;s2 < (1<<3);s2++) {
bool ff=1;
auto p3 = p1;
auto p4 = p2;
for(int i = 0;i < 3;i++) {
if(((s1 >> i) & 1) && p1[i] == 0) {ff = 0;}
if((s1 >> i) & 1) p3[i] *= -1;
if(((s2 >> i) & 1) && p2[i] == 0) {ff = 0;}
if((s2 >> i) & 1) p4[i] *= -1;
}
if(!ff) continue ;
auto p5 = p3;
for(int i = 0;i < 3;i++) {
p5[i] = abs(p5[i] - p4[i]);
}
sort(p5.begin() , p5.end()) ;
if(p5 != x) continue;
int lm = 1e9;
if(p3[0]) lm = min(lm , a / abs(p3[0]));
if(p3[1]) lm = min(lm , b / abs(p3[1]));
if(p3[2]) lm = min(lm , c / abs(p3[2]));
if(p4[0]) lm = min(lm , a / abs(p4[0]));
if(p4[1]) lm = min(lm , b / abs(p4[1]));
if(p4[2]) lm = min(lm , c / abs(p4[2]));
// vector<int> cur;
// for(int j = 1 ; j <= lm;j++) {
// assert(abs(p3[0]) * lm <= a);
// assert(abs(p3[1]) * lm <= b);
// assert(abs(p3[2]) * lm <= c);
// assert(abs(p4[0]) * lm <= a);
// assert(abs(p4[1]) * lm <= b);
// assert(abs(p4[2]) * lm <= c);
// for(int k = 0;k < 3;k++) cur.push_back(p3[k] * j);
// for(int k = 0;k < 3;k++) cur.push_back(p4[k] * j);
// }
// printf("%d %d %d : %d %d %d : %d\n",p3[0],p3[1],p3[2] ,p4[0],p4[1],p4[2] , lm) ;
// if(sv.count(cur)) {
// puts("WA") ; exit(0) ;
// }
// sv.insert(cur) ;
ans += lm;
}
}
}while(next_permutation(p2.begin() , p2.end()));
}while(next_permutation(p1.begin() , p1.end()));
}
// for(auto &cur : sv) {
// vector<int> p1,p2,p3;
// for(int i = 0;i < 3;i++) p1.push_back(cur[i]);
// for(int i = 0;i < 3;i++) p2.push_back(cur[i + 3]);
// for(int i = 0;i < 3;i++) p3.push_back(p1[i] - p2[i]) ;
// for(auto &x : p1) x = abs(x);
// for(auto &x : p2) x = abs(x);
// for(auto &x : p3) x = abs(x);
// sort(p1.begin() , p1.end());
// sort(p2.begin() , p2.end());
// sort(p3.begin() , p3.end());
// assert(p1 == p2 && p2 == p3) ;
// }
cout << ans / 2 << '\n' ; return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3516kb
input:
1 1 4
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
1 1 5
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
1 2 6
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
1 2 7
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
2 2 8
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
2 3 9
output:
16
result:
ok single line: '16'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3820kb
input:
2 3 10
output:
16
result:
ok single line: '16'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
2 3 11
output:
16
result:
ok single line: '16'
Test #9:
score: -100
Wrong Answer
time: 1ms
memory: 3588kb
input:
3 4 12
output:
48
result:
wrong answer 1st lines differ - expected: '64', found: '48'