QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#827707#9770. Middle Pointucup-team6225WA 0ms3676kbC++141.5kb2024-12-23 09:02:082024-12-23 09:02:10

Judging History

This is the latest submission verdict.

  • [2024-12-23 09:02:10]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3676kb
  • [2024-12-23 09:02:08]
  • Submitted

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))) : 1, ny = (b >> i) > 0 ? (y / (b >> i) > (1 << (i - 1))) : 1;
        // 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: 3588kb

input:

2 2
1 1

output:

1
0 0 2 2

result:

ok correct!

Test #2:

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

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

input:

0 0
0 0

output:

0

result:

ok correct!

Test #4:

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

input:

2024 0
1012 0

output:

1
0 0 2024 0

result:

ok correct!

Test #5:

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

input:

2024 2024
2023 2023

output:

-1

result:

ok correct!

Test #6:

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

input:

8 6
7 3

output:

3
0 0 8 0
8 0 4 0
8 6 6 0

result:

ok correct!

Test #7:

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

input:

2024 2026
2024 2026

output:

0

result:

ok correct!

Test #8:

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

input:

1000000000 1000000000
70 0

output:

-1

result:

ok correct!

Test #9:

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

input:

3 6
2 4

output:

-1

result:

ok correct!

Test #10:

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

input:

7 7
7 2

output:

-1

result:

ok correct!

Test #11:

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

input:

6 2
5 2

output:

-1

result:

ok correct!

Test #12:

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

input:

5 7
5 5

output:

-1

result:

ok correct!

Test #13:

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

input:

4 7
2 3

output:

-1

result:

ok correct!

Test #14:

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

input:

8 2
2 2

output:

2
0 2 8 2
0 2 4 2

result:

ok correct!

Test #15:

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

input:

3 3
0 2

output:

-1

result:

ok correct!

Test #16:

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

input:

7 7
1 4

output:

-1

result:

ok correct!

Test #17:

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

input:

6 3
6 1

output:

-1

result:

ok correct!

Test #18:

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

input:

4 2
2 1

output:

1
0 0 4 2

result:

ok correct!

Test #19:

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

input:

7 2
3 2

output:

-1

result:

ok correct!

Test #20:

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

input:

2 7
0 3

output:

-1

result:

ok correct!

Test #21:

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

input:

1 7
1 0

output:

0

result:

ok correct!

Test #22:

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

input:

5 1
0 0

output:

0

result:

ok correct!

Test #23:

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

input:

8 7
4 3

output:

-1

result:

ok correct!

Test #24:

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

input:

180057652 674822131
110693180 428023738

output:

-1

result:

ok correct!

Test #25:

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

input:

62347541 812142018
42922107 486416913

output:

-1

result:

ok correct!

Test #26:

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

input:

239604722 244429197
78993837 108804105

output:

-1

result:

ok correct!

Test #27:

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

input:

416861903 381749084
375027630 373683256

output:

-1

result:

ok correct!

Test #28:

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

input:

594119084 519068971
429116021 298715088

output:

-1

result:

ok correct!

Test #29:

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

input:

536870912 536870912
233225286 372408647

output:

29
536870912 0 536870912 536870912
0 536870912 536870912 268435456
536870912 536870912 268435456 402653184
0 0 402653184 469762048
0 0 201326592 234881024
0 0 100663296 117440512
536870912 536870912 50331648 58720256
0 0 293601280 297795584
0 536870912 146800640 148897792
0 0 73400320 342884352
5368...

result:

ok correct!

Test #30:

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

input:

536870912 536870912
242171716 210314503

output:

29
536870912 0 536870912 536870912
536870912 536870912 536870912 268435456
0 536870912 536870912 402653184
0 0 268435456 469762048
0 0 134217728 234881024
0 0 67108864 117440512
536870912 0 33554432 58720256
0 0 285212672 29360128
536870912 536870912 142606336 14680064
536870912 0 339738624 27577548...

result:

ok correct!

Test #31:

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

input:

536870912 536870912
251118145 48220392

output:

29
0 536870912 536870912 536870912
0 536870912 268435456 536870912
0 536870912 134217728 536870912
0 0 67108864 536870912
0 0 33554432 268435456
0 536870912 16777216 134217728
536870912 536870912 8388608 335544320
0 536870912 272629760 436207616
0 0 136314880 486539264
536870912 0 68157440 243269632...

result:

ok correct!

Test #32:

score: -100
Wrong Answer
time: 0ms
memory: 3532kb

input:

126070784 536870912
70206899 483718753

output:

29
0 0 1387405312 536870912
126070784 0 -1453780992 268435456
0 0 1483628544 134217728
126070784 0 -1405669376 67108864
126070784 0 1507684352 33554432
126070784 536870912 816877568 16777216
0 536870912 471474176 276824064
126070784 0 -1911746560 406847488
0 0 1254645760 203423744
126070784 53687091...

result:

wrong answer Integer 1387405312 violates the range [0, 10^9]