QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#309966#8132. Freshman's Dreamucup-team1134#AC ✓17ms3756kbC++23998b2024-01-20 23:14:422024-01-20 23:14:42

Judging History

你现在查看的是最新测评结果

  • [2024-01-20 23:14:42]
  • 评测
  • 测评结果:AC
  • 用时:17ms
  • 内存:3756kb
  • [2024-01-20 23:14:42]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll Q;cin>>Q;
    while(Q--){
        ll N;cin>>N;
        if(N&1) cout<<-1<<"\n";
        else{
            ll a,b;
            for(ll t=60;t>=0;t--){
                if(N&(1LL<<t)){
                    b=(1LL<<(t+1))-1-N;
                    break;
                }
            }
            a=N/2;
            cout<<a<<" "<<b<<"\n";
            assert((a+b)==(a^(N+b)));
        }
    }
}


这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3724kb

input:

5
2
3
6
10
18

output:

1 1
-1
3 1
5 5
9 13

result:

ok ok

Test #2:

score: 0
Accepted
time: 12ms
memory: 3756kb

input:

100000
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101...

output:

1 1
-1
2 3
-1
3 1
-1
4 7
-1
5 5
-1
6 3
-1
7 1
-1
8 15
-1
9 13
-1
10 11
-1
11 9
-1
12 7
-1
13 5
-1
14 3
-1
15 1
-1
16 31
-1
17 29
-1
18 27
-1
19 25
-1
20 23
-1
21 21
-1
22 19
-1
23 17
-1
24 15
-1
25 13
-1
26 11
-1
27 9
-1
28 7
-1
29 5
-1
30 3
-1
31 1
-1
32 63
-1
33 61
-1
34 59
-1
35 57
-1
36 55
-1
37...

result:

ok ok

Test #3:

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

input:

100000
76316
55087
1035148
480523
322879
607749
440658
434700
941531
657517
247448
953385
569641
592597
188131
769378
397552
94739
487375
142576
407344
532339
798526
521099
294428
414998
415977
646853
941103
21816
299379
1029240
171218
784108
711027
121363
223925
197035
899124
613355
178257
213375
3...

output:

38158 54755
-1
517574 13427
-1
-1
-1
220329 83629
217350 89587
-1
-1
123724 14695
-1
-1
-1
-1
384689 279197
198776 126735
-1
-1
71288 119567
203672 116943
-1
399263 250049
-1
147214 229859
207499 109289
-1
-1
-1
10908 10951
-1
514620 19335
85609 90925
392054 264467
-1
-1
-1
-1
449562 149451
-1
-1
-1...

result:

ok ok

Test #4:

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

input:

100000
279938093875
699023415517
1048269983590
537007992988
908117019805
683806387338
334400705624
484515916103
888494261285
220468538805
253319179778
357268673752
644637898889
919322454545
854350801341
1022830170092
486578580191
750669735889
4206967959
937169662800
852140555915
924210466276
2534095...

output:

-1
-1
524134991795 51241644185
268503996494 12747820899
-1
341903193669 415705240437
167200352812 215355108263
-1
-1
-1
126659589889 21558727165
178634336876 192487140135
-1
-1
-1
511415085046 76681457683
-1
-1
-1
468584831400 162341964975
-1
462105233138 175301161499
126704791299 21468324345
416552...

result:

ok ok

Test #5:

score: 0
Accepted
time: 14ms
memory: 3568kb

input:

100000
1040995214518856201
963834979320064344
718413469456747239
720594233881658007
133510227004253867
342816554559204856
24244360004792499
32003367585596768
68757795892900724
211638297745299764
478782413658379896
503496146580989968
288072253164348517
131667719615682949
186429177128265488
6043925869...

output:

-1
481917489660032172 189086525286782631
-1
-1
-1
171408277279602428 233644197744218631
-1
16001683792798384 4025429433367199
34378897946450362 3299798145027211
105819148872649882 76592078406411979
239391206829189948 97678338645043591
251748073290494984 72964605722433519
-1
-1
93214588564132744 1018...

result:

ok ok

Test #6:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

1
1152921504606846975

output:

-1

result:

ok ok

Extra Test:

score: 0
Extra Test Passed