QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#827705 | #9770. Middle Point | ucup-team6225 | WA | 0ms | 3656kb | C++14 | 1.5kb | 2024-12-23 09:00:00 | 2024-12-23 09:00:00 |
Judging History
answer
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
using pii = pair<int, int>;
const int N = 1000010;
int a, b, x, y;
vector<pii> px, py;
int main() {
#ifdef Kelly
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
freopen("err.txt", "w", stderr);
#endif
cin >> a >> b >> x >> y;
int suma = 0, sumb = 0;
if(a != 0) {
for(int i = 0; i <= 30; ++i)
if(a % (1 << i) == 0 && x % (a >> i) == 0 && x / (a >> i) <= (1 << i)) {suma = i; break;}
else if(a % (1 << i)) {cout << -1; return 0;}
}
if(b != 0) {
for(int i = 0; i <= 30; ++i)
if(b % (1 << i) == 0 && y % (b >> i) == 0 && y / (b >> i) <= (1 << i)) {sumb = i; break;}
else if(b % (1 << i)) {cout << -1; return 0;}
}
cout << max(suma, sumb) << "\n";
for(int i = max(suma, sumb); i > 0; --i) {
int nx = (a >> i) > 0 ? (x / (a >> i) > (1 << (i - 1))) : 0, ny = (b >> i) > 0 ? (y / (b >> i) > (1 << (i - 1))) : 0;
// cerr << i << " : " << nx << " " << ny << " " << x << " " << y << "\n";
px.pb({nx ? a : 0, ny ? b : 0}), py.pb({2 * x - px.back().fi, 2 * y - px.back().se});
x = py.back().fi, y = py.back().se;
}
for(int i = px.size() - 1; i >= 0; --i)
cout << px[i].fi << " " << px[i].se << " " << py[i].fi << " " << py[i].se << "\n";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3656kb
input:
2 2 1 1
output:
1 0 0 2 2
result:
ok correct!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
8 8 5 0
output:
3 0 0 8 0 0 0 4 0 8 0 2 0
result:
ok correct!
Test #3:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
0 0 0 0
output:
0
result:
ok correct!
Test #4:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
2024 0 1012 0
output:
1 0 0 2024 0
result:
ok correct!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
2024 2024 2023 2023
output:
-1
result:
ok correct!
Test #6:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
8 6 7 3
output:
3 0 6 8 6 8 6 4 6 8 0 6 6
result:
ok correct!
Test #7:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
2024 2026 2024 2026
output:
0
result:
ok correct!
Test #8:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
1000000000 1000000000 70 0
output:
-1
result:
ok correct!
Test #9:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
3 6 2 4
output:
-1
result:
ok correct!
Test #10:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
7 7 7 2
output:
-1
result:
ok correct!
Test #11:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
6 2 5 2
output:
-1
result:
ok correct!
Test #12:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
5 7 5 5
output:
-1
result:
ok correct!
Test #13:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
4 7 2 3
output:
-1
result:
ok correct!
Test #14:
score: -100
Wrong Answer
time: 0ms
memory: 3648kb
input:
8 2 2 2
output:
2 0 2 8 6 0 0 4 4
result:
wrong answer (8,6) is not in S