QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#341761 | #144. Primitive root / 原根 | KnownError_# | 10 ✓ | 782ms | 3900kb | C++14 | 1.7kb | 2024-02-29 21:05:04 | 2024-02-29 21:05:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ui = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define rep(i,l,r) for(int i=(l);i<=(r);++i)
#define per(i,l,r) for(int i=(l);i>=(r);--i)
#define repn(i,n) for(int i=0;i<(n);++i)
#define sizc(x) ((int)x.size())
#define allc(x) x.begin(),x.end()
#define fir first
#define sec second
namespace KnownError_{
mt19937_64 rng(random_device{}());
ll n,phi;
ll getphi(ll n){
ll res=n;
for(ll i=2;i*i<=n;++i)if(n%i==0){
res=res/i*(i-1);
while(n%i==0)n/=i;
}
if(n>1)res=res/n*(n-1);
return res;
}
vector<ll> factorize(ll n){
vector<ll> res;
for(ll i=2;i*i<=n;++i)if(n%i==0){
res.push_back(i);
while(n%i==0)n/=i;
}
if(n>1)res.push_back(n);
return res;
}
vector<ll> fac;
ll qpow(ll x,ll y){
ll ret=1;
while(y){
if(y&1)ret=(__int128_t)ret*x%n;
x=(__int128_t)x*x%n;
y>>=1;
}
return ret;
}
bool check(ll x){
if(__gcd(x,n)>1)return 0;
for(auto p:fac)if(qpow(x,phi/p)==1)return 0;
return 1;
}
void main(){
cin>>n;
if(n==1){cout<<"-1\n";return;}
if(n==2){cout<<"1\n";return;}
fac=factorize(phi=getphi(n));
while(clock()<0.9*CLOCKS_PER_SEC){
ll x=rng()%n;
if(check(x)){cout<<x<<'\n';return;}
}
cout<<"-1\n";
}
}
signed main(){
// freopen(".in","r",stdin);
// freopen(".out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(nullptr);
KnownError_::main();
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 1
Accepted
Test #1:
score: 1
Accepted
time: 1ms
memory: 3600kb
input:
433
output:
101
result:
ok good solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
197
output:
45
result:
ok good solution
Test #3:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
733
output:
408
result:
ok good solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
859
output:
452
result:
ok good solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
449
output:
264
result:
ok good solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
263
output:
215
result:
ok good solution
Test #7:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
683
output:
245
result:
ok good solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3492kb
input:
17
output:
10
result:
ok good solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
359
output:
315
result:
ok good solution
Test #10:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
89
output:
59
result:
ok good solution
Test #11:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
647
output:
142
result:
ok good solution
Test #12:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
487
output:
86
result:
ok good solution
Test #13:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
677
output:
496
result:
ok good solution
Test #14:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
829
output:
328
result:
ok good solution
Test #15:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
227
output:
55
result:
ok good solution
Test #16:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
151
output:
130
result:
ok good solution
Test #17:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
607
output:
373
result:
ok good solution
Test #18:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
661
output:
357
result:
ok good solution
Test #19:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
151
output:
112
result:
ok good solution
Test #20:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
101
output:
59
result:
ok good solution
Test #21:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
5
output:
3
result:
ok good solution
Test #22:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
877
output:
373
result:
ok good solution
Test #23:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
139
output:
123
result:
ok good solution
Test #24:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
389
output:
228
result:
ok good solution
Test #25:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
421
output:
331
result:
ok good solution
Test #26:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
709
output:
51
result:
ok good solution
Test #27:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
331
output:
295
result:
ok good solution
Test #28:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
269
output:
145
result:
ok good solution
Test #29:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
797
output:
765
result:
ok good solution
Test #30:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
997
output:
98
result:
ok good solution
Subtask #2:
score: 1
Accepted
Dependency #1:
100%
Accepted
Test #31:
score: 1
Accepted
time: 0ms
memory: 3604kb
input:
841
output:
656
result:
ok good solution
Test #32:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
289
output:
14
result:
ok good solution
Test #33:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
729
output:
569
result:
ok good solution
Test #34:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
169
output:
128
result:
ok good solution
Test #35:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
961
output:
570
result:
ok good solution
Test #36:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
31
output:
21
result:
ok good solution
Test #37:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
243
output:
227
result:
ok good solution
Test #38:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
625
output:
392
result:
ok good solution
Test #39:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
121
output:
35
result:
ok good solution
Test #40:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
125
output:
83
result:
ok good solution
Test #41:
score: 0
Accepted
time: 538ms
memory: 3644kb
input:
512
output:
-1
result:
ok no solution
Test #42:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
361
output:
147
result:
ok good solution
Test #43:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
529
output:
30
result:
ok good solution
Test #44:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
29
output:
3
result:
ok good solution
Test #45:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
23
output:
14
result:
ok good solution
Test #46:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
11
output:
8
result:
ok good solution
Test #47:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
25
output:
22
result:
ok good solution
Test #48:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
13
output:
11
result:
ok good solution
Test #49:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
19
output:
3
result:
ok good solution
Test #50:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
5
output:
2
result:
ok good solution
Test #51:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
17
output:
11
result:
ok good solution
Test #52:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
343
output:
206
result:
ok good solution
Test #53:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
81
output:
2
result:
ok good solution
Test #54:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
27
output:
5
result:
ok good solution
Test #55:
score: 0
Accepted
time: 482ms
memory: 3872kb
input:
256
output:
-1
result:
ok no solution
Test #56:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
49
output:
3
result:
ok good solution
Test #57:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
9
output:
5
result:
ok good solution
Test #58:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
3
output:
2
result:
ok good solution
Test #59:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
7
output:
3
result:
ok good solution
Test #60:
score: 0
Accepted
time: 506ms
memory: 3836kb
input:
128
output:
-1
result:
ok no solution
Subtask #3:
score: 1
Accepted
Dependency #2:
100%
Accepted
Test #61:
score: 1
Accepted
time: 1ms
memory: 3868kb
input:
578
output:
547
result:
ok good solution
Test #62:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
686
output:
451
result:
ok good solution
Test #63:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
242
output:
7
result:
ok good solution
Test #64:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
722
output:
561
result:
ok good solution
Test #65:
score: 0
Accepted
time: 435ms
memory: 3888kb
input:
236
output:
-1
result:
ok no solution
Test #66:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
486
output:
443
result:
ok good solution
Test #67:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
250
output:
213
result:
ok good solution
Test #68:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
98
output:
47
result:
ok good solution
Test #69:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
162
output:
101
result:
ok good solution
Test #70:
score: 0
Accepted
time: 499ms
memory: 3660kb
input:
770
output:
-1
result:
ok no solution
Test #71:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
14
output:
3
result:
ok good solution
Test #72:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
54
output:
29
result:
ok good solution
Test #73:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
22
output:
7
result:
ok good solution
Test #74:
score: 0
Accepted
time: 498ms
memory: 3616kb
input:
512
output:
-1
result:
ok no solution
Test #75:
score: 0
Accepted
time: 534ms
memory: 3644kb
input:
284
output:
-1
result:
ok no solution
Test #76:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
50
output:
27
result:
ok good solution
Test #77:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
34
output:
11
result:
ok good solution
Test #78:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
38
output:
29
result:
ok good solution
Test #79:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
338
output:
115
result:
ok good solution
Test #80:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
37
output:
13
result:
ok good solution
Test #81:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
10
output:
7
result:
ok good solution
Test #82:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
26
output:
19
result:
ok good solution
Test #83:
score: 0
Accepted
time: 539ms
memory: 3624kb
input:
256
output:
-1
result:
ok no solution
Test #84:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
18
output:
11
result:
ok good solution
Test #85:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
881
output:
469
result:
ok good solution
Test #86:
score: 0
Accepted
time: 450ms
memory: 3624kb
input:
128
output:
-1
result:
ok no solution
Test #87:
score: 0
Accepted
time: 498ms
memory: 3620kb
input:
64
output:
-1
result:
ok no solution
Test #88:
score: 0
Accepted
time: 468ms
memory: 3624kb
input:
32
output:
-1
result:
ok no solution
Test #89:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
6
output:
5
result:
ok good solution
Test #90:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
257
output:
164
result:
ok good solution
Subtask #4:
score: 1
Accepted
Dependency #1:
100%
Accepted
Test #91:
score: 1
Accepted
time: 0ms
memory: 3620kb
input:
182233
output:
62006
result:
ok good solution
Test #92:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
28771
output:
3682
result:
ok good solution
Test #93:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
579239
output:
10760
result:
ok good solution
Test #94:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
724747
output:
347305
result:
ok good solution
Test #95:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
143513
output:
104079
result:
ok good solution
Test #96:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
695509
output:
348109
result:
ok good solution
Test #97:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
999217
output:
291405
result:
ok good solution
Test #98:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
888161
output:
182968
result:
ok good solution
Test #99:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
234287
output:
154544
result:
ok good solution
Test #100:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
746483
output:
584303
result:
ok good solution
Test #101:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
985003
output:
823121
result:
ok good solution
Test #102:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
786959
output:
30733
result:
ok good solution
Test #103:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
1097
output:
622
result:
ok good solution
Test #104:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
105527
output:
33563
result:
ok good solution
Test #105:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
812519
output:
29767
result:
ok good solution
Test #106:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
161599
output:
21324
result:
ok good solution
Test #107:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
645131
output:
12047
result:
ok good solution
Test #108:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
63397
output:
20284
result:
ok good solution
Test #109:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
244429
output:
107520
result:
ok good solution
Test #110:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
911453
output:
289766
result:
ok good solution
Test #111:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
340477
output:
84003
result:
ok good solution
Test #112:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
28351
output:
25730
result:
ok good solution
Test #113:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
414277
output:
3045
result:
ok good solution
Test #114:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
411923
output:
62858
result:
ok good solution
Test #115:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
986281
output:
856020
result:
ok good solution
Test #116:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
882047
output:
279059
result:
ok good solution
Test #117:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
323009
output:
221683
result:
ok good solution
Test #118:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
577153
output:
357871
result:
ok good solution
Test #119:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
42281
output:
33010
result:
ok good solution
Test #120:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
601823
output:
429307
result:
ok good solution
Subtask #5:
score: 1
Accepted
Dependency #2:
100%
Accepted
Dependency #4:
100%
Accepted
Test #121:
score: 1
Accepted
time: 0ms
memory: 3656kb
input:
531441
output:
527999
result:
ok good solution
Test #122:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
703921
output:
219680
result:
ok good solution
Test #123:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
253009
output:
132155
result:
ok good solution
Test #124:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
229441
output:
137558
result:
ok good solution
Test #125:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
22801
output:
21675
result:
ok good solution
Test #126:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
160801
output:
91914
result:
ok good solution
Test #127:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
477481
output:
206303
result:
ok good solution
Test #128:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
177147
output:
159530
result:
ok good solution
Test #129:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
120409
output:
59706
result:
ok good solution
Test #130:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
185761
output:
141410
result:
ok good solution
Test #131:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
357911
output:
15915
result:
ok good solution
Test #132:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
358801
output:
335566
result:
ok good solution
Test #133:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
143641
output:
107533
result:
ok good solution
Test #134:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
727609
output:
665737
result:
ok good solution
Test #135:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
192721
output:
1117
result:
ok good solution
Test #136:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
201601
output:
7137
result:
ok good solution
Test #137:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
310249
output:
224925
result:
ok good solution
Test #138:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
124609
output:
67456
result:
ok good solution
Test #139:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
52441
output:
33604
result:
ok good solution
Test #140:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
299209
output:
258045
result:
ok good solution
Test #141:
score: 0
Accepted
time: 592ms
memory: 3644kb
input:
524288
output:
-1
result:
ok no solution
Test #142:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
564001
output:
473025
result:
ok good solution
Test #143:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
704969
output:
348996
result:
ok good solution
Test #144:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
58081
output:
49235
result:
ok good solution
Test #145:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
375769
output:
112430
result:
ok good solution
Test #146:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
853
output:
406
result:
ok good solution
Test #147:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
37249
output:
13756
result:
ok good solution
Test #148:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
389017
output:
107952
result:
ok good solution
Test #149:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
516961
output:
163385
result:
ok good solution
Test #150:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
677329
output:
566147
result:
ok good solution
Subtask #6:
score: 1
Accepted
Dependency #3:
100%
Accepted
Dependency #5:
100%
Accepted
Test #151:
score: 1
Accepted
time: 0ms
memory: 3596kb
input:
334562
output:
333493
result:
ok good solution
Test #152:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
138338
output:
126731
result:
ok good solution
Test #153:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
37538
output:
33373
result:
ok good solution
Test #154:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
144722
output:
118719
result:
ok good solution
Test #155:
score: 0
Accepted
time: 514ms
memory: 3872kb
input:
938250
output:
-1
result:
ok no solution
Test #156:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
722402
output:
93225
result:
ok good solution
Test #157:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
278258
output:
214927
result:
ok good solution
Test #158:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
826898
output:
769583
result:
ok good solution
Test #159:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
287282
output:
128057
result:
ok good solution
Test #160:
score: 0
Accepted
time: 663ms
memory: 3872kb
input:
697837
output:
-1
result:
ok no solution
Test #161:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
108578
output:
58113
result:
ok good solution
Test #162:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
354482
output:
186967
result:
ok good solution
Test #163:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
547058
output:
464675
result:
ok good solution
Test #164:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
1286
output:
979
result:
ok good solution
Test #165:
score: 0
Accepted
time: 689ms
memory: 3648kb
input:
247417
output:
-1
result:
ok no solution
Test #166:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
293378
output:
267461
result:
ok good solution
Test #167:
score: 0
Accepted
time: 1ms
memory: 3820kb
input:
227138
output:
132407
result:
ok good solution
Test #168:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
736898
output:
376299
result:
ok good solution
Test #169:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
954962
output:
595899
result:
ok good solution
Test #170:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
535022
output:
510345
result:
ok good solution
Test #171:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
49298
output:
11837
result:
ok good solution
Test #172:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
171698
output:
144109
result:
ok good solution
Test #173:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
717602
output:
254497
result:
ok good solution
Test #174:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
482162
output:
104059
result:
ok good solution
Test #175:
score: 0
Accepted
time: 619ms
memory: 3656kb
input:
313737
output:
-1
result:
ok no solution
Test #176:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
23762
output:
11395
result:
ok good solution
Test #177:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
674
output:
143
result:
ok good solution
Test #178:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
157922
output:
113365
result:
ok good solution
Test #179:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
585362
output:
499807
result:
ok good solution
Test #180:
score: 0
Accepted
time: 606ms
memory: 3716kb
input:
391017
output:
-1
result:
ok no solution
Subtask #7:
score: 1
Accepted
Dependency #4:
100%
Accepted
Test #181:
score: 1
Accepted
time: 1ms
memory: 3552kb
input:
842797909
output:
243613977
result:
ok good solution
Test #182:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
662460749
output:
511252207
result:
ok good solution
Test #183:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
583578713
output:
411568621
result:
ok good solution
Test #184:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
714745777
output:
286153292
result:
ok good solution
Test #185:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
626528689
output:
212076412
result:
ok good solution
Test #186:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
848747719
output:
304358501
result:
ok good solution
Test #187:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
780868019
output:
741044636
result:
ok good solution
Test #188:
score: 0
Accepted
time: 1ms
memory: 3724kb
input:
295695817
output:
90092789
result:
ok good solution
Test #189:
score: 0
Accepted
time: 1ms
memory: 3720kb
input:
950964661
output:
935753165
result:
ok good solution
Test #190:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
219526067
output:
189436058
result:
ok good solution
Test #191:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
763440683
output:
309548736
result:
ok good solution
Test #192:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
744457559
output:
40789513
result:
ok good solution
Test #193:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
117979097
output:
18003475
result:
ok good solution
Test #194:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
910461493
output:
207248152
result:
ok good solution
Test #195:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
796412147
output:
204181781
result:
ok good solution
Test #196:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
221019493
output:
84621478
result:
ok good solution
Test #197:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
237830497
output:
93853232
result:
ok good solution
Test #198:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
209079863
output:
201239580
result:
ok good solution
Test #199:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
808345841
output:
761307363
result:
ok good solution
Test #200:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
100217503
output:
32986699
result:
ok good solution
Test #201:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
99546341
output:
18849979
result:
ok good solution
Test #202:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
811108069
output:
549727149
result:
ok good solution
Test #203:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
121875503
output:
27558462
result:
ok good solution
Test #204:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
932569537
output:
255717504
result:
ok good solution
Test #205:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
598983901
output:
505404269
result:
ok good solution
Test #206:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
54645551
output:
20992109
result:
ok good solution
Test #207:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
22252519
output:
5730014
result:
ok good solution
Test #208:
score: 0
Accepted
time: 1ms
memory: 3892kb
input:
666436031
output:
78627236
result:
ok good solution
Test #209:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
900871603
output:
470432992
result:
ok good solution
Test #210:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
561111223
output:
58560568
result:
ok good solution
Subtask #8:
score: 1
Accepted
Dependency #5:
100%
Accepted
Dependency #7:
100%
Accepted
Test #211:
score: 1
Accepted
time: 0ms
memory: 3840kb
input:
65983129
output:
3414084
result:
ok good solution
Test #212:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
29626249
output:
21513696
result:
ok good solution
Test #213:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
25210441
output:
4361391
result:
ok good solution
Test #214:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
632673409
output:
157100484
result:
ok good solution
Test #215:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
150528361
output:
123989297
result:
ok good solution
Test #216:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
68417929
output:
38938262
result:
ok good solution
Test #217:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
106357969
output:
103431953
result:
ok good solution
Test #218:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
4068289
output:
858767
result:
ok good solution
Test #219:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
43309561
output:
30870746
result:
ok good solution
Test #220:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
668170801
output:
11938849
result:
ok good solution
Test #221:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
339038569
output:
3050161
result:
ok good solution
Test #222:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
522625321
output:
200601611
result:
ok good solution
Test #223:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
127938721
output:
33938033
result:
ok good solution
Test #224:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
41306329
output:
34406819
result:
ok good solution
Test #225:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
259564321
output:
67535975
result:
ok good solution
Test #226:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
13997521
output:
12965155
result:
ok good solution
Test #227:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
400920529
output:
200995022
result:
ok good solution
Test #228:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
119880601
output:
58806264
result:
ok good solution
Test #229:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
383493889
output:
179982015
result:
ok good solution
Test #230:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
122257249
output:
42159120
result:
ok good solution
Test #231:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
633579241
output:
312080790
result:
ok good solution
Test #232:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
53743561
output:
742286
result:
ok good solution
Test #233:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
481231969
output:
472016897
result:
ok good solution
Test #234:
score: 0
Accepted
time: 1ms
memory: 3900kb
input:
462379009
output:
144913632
result:
ok good solution
Test #235:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
1957201
output:
662873
result:
ok good solution
Test #236:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
196308121
output:
28966476
result:
ok good solution
Test #237:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
300017041
output:
96461918
result:
ok good solution
Test #238:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
414244609
output:
135868451
result:
ok good solution
Test #239:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
533411731
output:
206967717
result:
ok good solution
Test #240:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
529138009
output:
200215888
result:
ok good solution
Subtask #9:
score: 1
Accepted
Dependency #6:
100%
Accepted
Dependency #8:
100%
Accepted
Test #241:
score: 1
Accepted
time: 1ms
memory: 3620kb
input:
367367618
output:
20169539
result:
ok good solution
Test #242:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
489657218
output:
289260785
result:
ok good solution
Test #243:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
499469618
output:
218987149
result:
ok good solution
Test #244:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
24907682
output:
13154883
result:
ok good solution
Test #245:
score: 0
Accepted
time: 692ms
memory: 3656kb
input:
490448845
output:
-1
result:
ok no solution
Test #246:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
406068002
output:
247548981
result:
ok good solution
Test #247:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
219804478
output:
158357035
result:
ok good solution
Test #248:
score: 0
Accepted
time: 1ms
memory: 3812kb
input:
405726098
output:
18910761
result:
ok good solution
Test #249:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
474381602
output:
426843365
result:
ok good solution
Test #250:
score: 0
Accepted
time: 681ms
memory: 3648kb
input:
246521126
output:
-1
result:
ok no solution
Test #251:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
111930722
output:
97857099
result:
ok good solution
Test #252:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
472904258
output:
429926801
result:
ok good solution
Test #253:
score: 0
Accepted
time: 1ms
memory: 3720kb
input:
543642338
output:
461398347
result:
ok good solution
Test #254:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
610891058
output:
89021787
result:
ok good solution
Test #255:
score: 0
Accepted
time: 675ms
memory: 3544kb
input:
489880646
output:
-1
result:
ok no solution
Test #256:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
190086002
output:
138799035
result:
ok good solution
Test #257:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
541007618
output:
113489849
result:
ok good solution
Test #258:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
945168242
output:
446644829
result:
ok good solution
Test #259:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
577116338
output:
360473485
result:
ok good solution
Test #260:
score: 0
Accepted
time: 665ms
memory: 3548kb
input:
135176072
output:
-1
result:
ok no solution
Test #261:
score: 0
Accepted
time: 1ms
memory: 3820kb
input:
7136642
output:
3499889
result:
ok good solution
Test #262:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
690953138
output:
513654779
result:
ok good solution
Test #263:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
15691202
output:
13712179
result:
ok good solution
Test #264:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
8661122
output:
4073115
result:
ok good solution
Test #265:
score: 0
Accepted
time: 714ms
memory: 3660kb
input:
969491343
output:
-1
result:
ok no solution
Test #266:
score: 0
Accepted
time: 1ms
memory: 3836kb
input:
172273922
output:
161572821
result:
ok good solution
Test #267:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
40374098
output:
15914685
result:
ok good solution
Test #268:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
111213698
output:
44319797
result:
ok good solution
Test #269:
score: 0
Accepted
time: 1ms
memory: 3720kb
input:
535495538
output:
464369843
result:
ok good solution
Test #270:
score: 0
Accepted
time: 702ms
memory: 3652kb
input:
715962635
output:
-1
result:
ok no solution
Subtask #10:
score: 1
Accepted
Dependency #9:
100%
Accepted
Test #271:
score: 1
Accepted
time: 106ms
memory: 3648kb
input:
2670238111993922
output:
1390874244244493
result:
ok good solution
Test #272:
score: 0
Accepted
time: 73ms
memory: 3816kb
input:
1412768792638898
output:
1043451298870983
result:
ok good solution
Test #273:
score: 0
Accepted
time: 119ms
memory: 3548kb
input:
3415757055522338
output:
3153601761327227
result:
ok good solution
Test #274:
score: 0
Accepted
time: 51ms
memory: 3588kb
input:
609849802971602
output:
351891386767601
result:
ok good solution
Test #275:
score: 0
Accepted
time: 753ms
memory: 3556kb
input:
2470756780761188
output:
-1
result:
ok no solution
Test #276:
score: 0
Accepted
time: 138ms
memory: 3868kb
input:
4540448632181282
output:
3535409509337899
result:
ok good solution
Test #277:
score: 0
Accepted
time: 96ms
memory: 3548kb
input:
2191832922455282
output:
1525040479098191
result:
ok good solution
Test #278:
score: 0
Accepted
time: 176ms
memory: 3836kb
input:
7397519340340082
output:
1504637962549387
result:
ok good solution
Test #279:
score: 0
Accepted
time: 98ms
memory: 3720kb
input:
2243715766515218
output:
552321369956483
result:
ok good solution
Test #280:
score: 0
Accepted
time: 716ms
memory: 3660kb
input:
2212319589622572
output:
-1
result:
ok no solution
Test #281:
score: 0
Accepted
time: 98ms
memory: 3888kb
input:
2296554929310098
output:
2077492152810497
result:
ok good solution
Test #282:
score: 0
Accepted
time: 190ms
memory: 3616kb
input:
8659147610906018
output:
757243141838269
result:
ok good solution
Test #283:
score: 0
Accepted
time: 33ms
memory: 3652kb
input:
258429609036722
output:
54647776670235
result:
ok good solution
Test #284:
score: 0
Accepted
time: 193ms
memory: 3660kb
input:
7638862917598802
output:
6417938415907247
result:
ok good solution
Test #285:
score: 0
Accepted
time: 782ms
memory: 3644kb
input:
8275064231348893
output:
-1
result:
ok no solution
Test #286:
score: 0
Accepted
time: 138ms
memory: 3596kb
input:
4531313037563138
output:
515493953105923
result:
ok good solution
Test #287:
score: 0
Accepted
time: 122ms
memory: 3684kb
input:
3403611272369618
output:
2197094582492397
result:
ok good solution
Test #288:
score: 0
Accepted
time: 100ms
memory: 3548kb
input:
2379814327381922
output:
613653688784251
result:
ok good solution
Test #289:
score: 0
Accepted
time: 195ms
memory: 3548kb
input:
9150661439796962
output:
1400255179221295
result:
ok good solution
Test #290:
score: 0
Accepted
time: 766ms
memory: 3836kb
input:
4663789583183194
output:
-1
result:
ok no solution
Test #291:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
115014794498
output:
38157467121
result:
ok good solution
Test #292:
score: 0
Accepted
time: 65ms
memory: 3660kb
input:
1011914274734162
output:
242452639995655
result:
ok good solution
Test #293:
score: 0
Accepted
time: 188ms
memory: 3660kb
input:
6273881517086402
output:
2619647375903567
result:
ok good solution
Test #294:
score: 0
Accepted
time: 192ms
memory: 3684kb
input:
8837771746078802
output:
8244593645813407
result:
ok good solution
Test #295:
score: 0
Accepted
time: 677ms
memory: 3684kb
input:
2748517911524984
output:
-1
result:
ok no solution
Test #296:
score: 0
Accepted
time: 26ms
memory: 3816kb
input:
153116285124002
output:
25064475665855
result:
ok good solution
Test #297:
score: 0
Accepted
time: 60ms
memory: 3656kb
input:
676295415993698
output:
49052132455489
result:
ok good solution
Test #298:
score: 0
Accepted
time: 213ms
memory: 3684kb
input:
4859597134764338
output:
3791308653584665
result:
ok good solution
Test #299:
score: 0
Accepted
time: 18ms
memory: 3812kb
input:
70865774435618
output:
31633274591611
result:
ok good solution
Test #300:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
1639197169
output:
774781614
result:
ok good solution