QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#229076 | #7615. Sequence Folding | WJH# | WA | 91ms | 16276kb | C++14 | 1016b | 2023-10-28 14:59:23 | 2023-10-28 14:59:23 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<set>
#define Pair pair<ll,int>
#define It set<Pair >::iterator
#define ll long long
using namespace std;
set<Pair > S[2];
int Dye(ll N,int Now)
{
if(N==1){return 0;}
int z=0,X=0;It y;
for(It x=S[Now].begin();x!=S[Now].end();x++)
{
y=S[Now].lower_bound(make_pair(N-(x->first)+1ll,0));
if(y==S[Now].end()||(y->first)!=N-(x->first)+1ll)
{
if(x->first>(N>>1)){X=N-(x->first)+1ll;}
else{X=x->first;}
if((x->second)==1)
{
S[Now^1].insert(make_pair(X,2));z++;
}
}
else
{
if((x->first)>(N>>1)){continue;}
X=x->first;
if((x->second)==(y->second))
{
S[Now^1].insert(make_pair(X,x->second));
}
else
{
S[Now^1].insert(make_pair(X,1));
}
}
}
S[Now].clear();
return Dye(N>>1,Now^1)+z;
}
int main()
{
ll n=0,x=0;int m=0;
scanf("%lld%d",&n,&m);
for(int i=1;i<=m;i++)
{
scanf("%lld",&x);
S[0].insert(make_pair(x,1));
}
printf("%d",Dye(n,0));
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3824kb
input:
8 3 1 5 8
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
1 1 1
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 61ms
memory: 16276kb
input:
17179869184 100000 138476 774165 993977 1152277 1236393 1244970 1534017 1693701 1763926 1778781 1842066 1874644 1885666 2120429 2485344 2977941 3158255 3340476 3504862 4000117 4066652 4197639 4338723 4389163 4576965 4761601 5097091 5175412 5295902 5810551 5855982 6001770 6111262 6163309 6351547 6582...
output:
99999
result:
ok single line: '99999'
Test #4:
score: 0
Accepted
time: 59ms
memory: 16036kb
input:
549755813888 100000 16886305 20807233 27844305 30727441 30898344 35755457 38085835 43336454 47877882 50347884 53237225 53718183 60030541 66954859 80773500 82511603 84025040 86398615 93070876 94502940 98906398 100677488 103720017 105522694 116741042 122492007 135222584 155167916 160926866 166110647 1...
output:
100000
result:
ok single line: '100000'
Test #5:
score: 0
Accepted
time: 78ms
memory: 16036kb
input:
17592186044416 100000 44842545 229248515 253567434 347949154 349195610 404810585 639421407 650796923 1019260054 1250861689 1315840401 1318619991 1339387462 1388173647 1406074815 1459749263 1707998226 1902480662 2060860604 2075157570 2410720375 2589192480 2742051226 2784829021 3019629868 3194189913 3...
output:
100000
result:
ok single line: '100000'
Test #6:
score: 0
Accepted
time: 85ms
memory: 16024kb
input:
562949953421312 100000 8468403039 19260915102 24550792804 45571277635 47757798888 50487845666 53656890708 58778712483 63838097144 65697633747 74717895118 75607193564 75790076603 82739180544 88493216722 90960251492 93191423725 93775335122 96870622706 97818052601 107098516035 116573978680 117388104977...
output:
100000
result:
ok single line: '100000'
Test #7:
score: 0
Accepted
time: 78ms
memory: 16016kb
input:
18014398509481984 100000 595466408158 695142884370 811588821663 938951385045 955148012821 1074515190235 1209454535782 1319295844076 1465300774125 1634202068435 1761189966958 2474372766317 2493877995320 2532743464849 2607093321941 2755490217777 3183921545337 3499339208003 3649317240659 3873577127103 ...
output:
100000
result:
ok single line: '100000'
Test #8:
score: 0
Accepted
time: 91ms
memory: 16024kb
input:
576460752303423488 100000 13970345269592 15376826852028 24802122999858 27223268306434 36702541028981 43837014560573 44921933577642 58096934157757 59667447677923 66975875846281 84770936584661 86367511887665 89865085383436 91951807720175 103815897231785 104261045426912 107706410045438 108769878131800 ...
output:
100000
result:
ok single line: '100000'
Test #9:
score: 0
Accepted
time: 39ms
memory: 9980kb
input:
65536 65536 1 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 ...
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 66ms
memory: 13712kb
input:
131072 100000 1 2 4 5 6 9 11 12 14 15 17 18 19 21 22 23 24 26 28 30 31 32 33 34 37 39 40 41 43 44 45 46 47 48 49 51 52 53 54 55 56 57 61 62 64 65 66 67 68 69 70 72 73 74 75 76 77 78 80 81 82 83 84 85 86 87 88 89 90 91 92 93 96 97 98 100 102 103 104 105 106 107 108 109 110 111 112 113 115 116 117 118...
output:
27315
result:
ok single line: '27315'
Test #11:
score: 0
Accepted
time: 23ms
memory: 7776kb
input:
131072 35791 1 3 4 7 10 12 16 18 27 33 41 51 54 63 68 69 85 93 94 100 101 103 105 109 113 114 115 117 118 123 129 132 135 137 139 141 144 146 150 152 153 161 165 170 172 175 177 179 192 195 196 197 201 202 205 207 208 210 212 213 217 218 225 228 229 236 239 242 256 259 265 270 273 285 295 297 299 30...
output:
30694
result:
ok single line: '30694'
Test #12:
score: 0
Accepted
time: 32ms
memory: 9712kb
input:
131072 53908 4 6 12 13 14 16 20 23 24 31 33 35 37 39 40 42 46 47 48 52 53 55 57 58 60 61 62 66 68 69 75 79 80 81 82 83 87 90 94 95 97 98 100 103 105 106 107 109 110 111 112 117 120 123 127 128 131 132 138 146 147 148 154 155 159 161 163 164 168 171 172 173 174 177 178 179 181 183 187 188 189 190 192...
output:
40848
result:
ok single line: '40848'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
2 1 2
output:
1
result:
ok single line: '1'
Test #14:
score: 0
Accepted
time: 74ms
memory: 14916kb
input:
262144 100000 3 6 10 12 23 27 30 31 32 35 36 38 39 40 43 44 45 47 49 50 51 52 54 55 60 62 66 68 69 70 71 73 77 79 80 81 82 86 88 91 94 95 98 100 101 102 107 109 113 123 125 126 127 128 131 132 138 142 144 146 147 149 150 151 156 157 166 167 169 170 171 174 176 177 181 184 188 190 195 197 198 203 204...
output:
78358
result:
ok single line: '78358'
Test #15:
score: 0
Accepted
time: 71ms
memory: 15144kb
input:
262144 100000 4 6 8 13 16 18 19 20 21 27 28 32 36 37 38 42 44 47 51 53 55 56 61 62 65 66 68 80 81 82 84 85 88 89 90 92 96 110 112 113 114 117 118 121 123 124 127 129 131 133 136 137 140 142 152 153 156 161 162 163 164 167 174 176 177 178 182 183 188 190 192 194 195 198 200 207 208 210 211 212 214 21...
output:
78283
result:
ok single line: '78283'
Test #16:
score: 0
Accepted
time: 71ms
memory: 14836kb
input:
262144 100000 8 13 17 18 24 25 28 33 42 43 45 47 49 53 63 65 67 68 69 71 75 80 81 82 91 98 99 100 101 107 109 110 113 114 115 118 119 121 125 128 129 131 133 136 142 145 147 148 149 150 151 153 161 167 168 169 171 174 175 176 178 185 187 188 190 192 193 195 197 198 200 202 203 205 206 207 211 223 22...
output:
78377
result:
ok single line: '78377'
Test #17:
score: 0
Accepted
time: 61ms
memory: 16152kb
input:
288230376151711744 100000 2051253087133 5034791117487 16277884254216 18748708512249 25161273356777 36308675496739 36396901330480 36762586969507 37497387695665 37563665735752 39576584265761 41873710679871 49534817047754 53927300913267 54227259634409 56761933827487 57956114073060 63040701064548 641255...
output:
100000
result:
ok single line: '100000'
Test #18:
score: 0
Accepted
time: 84ms
memory: 16144kb
input:
288230376151711744 100000 13673747777668 15739859999866 21203445973142 23798904995363 26158220623088 28986290989623 33184712388237 35166671949347 36281038226194 41488068526902 47701082448077 63719553846332 64908694760680 73471939044692 73685979018933 75730004826420 81098014344469 81935325531771 8353...
output:
100000
result:
ok single line: '100000'
Test #19:
score: 0
Accepted
time: 75ms
memory: 16028kb
input:
288230376151711744 100000 595301495104 1718356412302 3503997570218 5034929023689 5044869417779 9078189744121 12507129448076 13515421734092 14995690016321 17184354842267 18805440477175 19403492814747 20651814136440 21836850228253 24681339065751 26416497021478 27195137574686 28473163660886 30072237858...
output:
100000
result:
ok single line: '100000'
Test #20:
score: 0
Accepted
time: 82ms
memory: 16024kb
input:
576460752303423488 100000 8107391531049 8397412343932 11817015312495 18591269865678 24476561473901 29556407820988 34956326024323 37463753731130 42304557847636 47883181462463 48668327829946 49181951408615 75388508288926 83647541308487 86526892361219 91560373134632 99258585092530 99439609915249 108353...
output:
100000
result:
ok single line: '100000'
Test #21:
score: 0
Accepted
time: 75ms
memory: 16100kb
input:
576460752303423488 100000 1388353887417 1565068348341 20461475046307 20808040783771 42262646665379 44452317030462 50311328008597 52632832423156 55287465462393 56822211676307 57465304610020 59928313328138 60749421163438 69204165591640 74148897147158 81829481137874 81855180888972 82832964869916 857539...
output:
100000
result:
ok single line: '100000'
Test #22:
score: 0
Accepted
time: 75ms
memory: 16276kb
input:
576460752303423488 100000 299412255631 5700704493184 10374640508969 12676997555789 14512812190840 23825590796082 28243772166098 37676718146017 38624523175525 47347897432412 53549672404802 65560500188236 68505011765890 69303909362599 73610277218696 76205159984856 79970846507950 80248430954621 8242864...
output:
100000
result:
ok single line: '100000'
Test #23:
score: 0
Accepted
time: 59ms
memory: 13196kb
input:
1073741824 100000 7047 15239 17530 33914 48007 50298 80775 83066 97159 113543 115834 124026 138119 146311 148602 164986 179079 181370 211847 214138 228231 244615 246906 255098 269191 277383 279674 296058 310151 312442 342919 345210 359303 361594 375687 377978 386170 400263 408455 410746 427130 44122...
output:
13
result:
ok single line: '13'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
2 2 1 2
output:
0
result:
ok single line: '0'
Test #25:
score: 0
Accepted
time: 53ms
memory: 13024kb
input:
1073741824 100000 11062 15697 21707 33456 49840 54475 76598 81233 92982 97617 115376 120011 142134 146769 164528 169163 180912 185547 207670 212305 228689 240438 246448 251083 273206 277841 295600 300235 311984 316619 338742 355126 359761 361136 377520 382155 404278 408913 426672 431307 443056 44769...
output:
24
result:
ok single line: '24'
Test #26:
score: 0
Accepted
time: 62ms
memory: 12900kb
input:
1073741824 100000 6505 7059 8678 10885 20167 26895 30989 36550 65229 90598 104178 112506 120188 124568 131380 171547 194829 225595 235250 241978 243578 251260 255086 255640 268649 269203 273029 280711 282311 289039 298694 329460 340282 345198 352742 364230 392909 393524 411783 433691 456973 459060 4...
output:
90
result:
ok single line: '90'
Test #27:
score: 0
Accepted
time: 61ms
memory: 13196kb
input:
1073741824 100000 4631 6834 8373 32781 33971 38739 40766 51539 63378 63647 95366 95522 96988 106293 109527 116616 121392 121774 127876 132110 141593 145704 169625 174333 220596 240067 254379 260831 273328 289832 289937 299226 328111 336206 337719 340223 342687 358454 363871 369338 386587 401980 4063...
output:
776
result:
ok single line: '776'
Test #28:
score: -100
Wrong Answer
time: 37ms
memory: 10080kb
input:
288230376151711744 99911 2658919856233 6137173165976 7056966367337 10535219677080 11455012878441 14933266188184 19331312699288 20251105900649 24649152411753 28127405721496 29047198922857 32525452232600 37843291945065 41321545254808 42241338456169 45719591765912 50117638277016 51037431478377 55435477...
output:
3
result:
wrong answer 1st lines differ - expected: '12', found: '3'