結果

問題 No.262 面白くないビットすごろく
ユーザー t98slidert98slider
提出日時 2023-02-20 15:28:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 480 ms / 2,000 ms
コード長 14,207 bytes
コンパイル時間 1,909 ms
コンパイル使用メモリ 184,572 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-21 07:50:27
合計ジャッジ時間 3,289 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 480 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 475 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

vector<pair<ll,ll>> a = 
{{1,0},{1469980682,100000000},{3043866212,200000000},{4668805409,300000000},{6304910373,400000000},{7993963848,500000000},{9642632564,600000000},{11294354943,700000000},{13027785740,800000000},{14738125641,900000000},{16528261375,1000000000},{18210846386,1100000000},{19866094009,1200000000},{21598491427,1300000000},{23305273534,1400000000},{25096174497,1500000000},{26851772374,1600000000},{28602397046,1700000000},{30427698867,1800000000},{32270214646,1900000000},{34179892637,2000000000},{35795799216,2100000000},{37474898933,2200000000},{39197471652,2300000000},{40939570400,2400000000},{42754518130,2500000000},{44462028976,2600000000},{46246138687,2700000000},{48061009294,2800000000},{49915842586,2900000000},{51804505761,3000000000},{53529119448,3100000000},{55324780533,3200000000},{57133698007,3300000000},{59013445746,3400000000},{60879847551,3500000000},{62731107733,3600000000},{64657845640,3700000000},{66594902248,3800000000},{68606219970,3900000000},{70213317069,4000000000},{71896995173,4100000000},{73611431536,4200000000},{75356722003,4300000000},{77182126886,4400000000},{78884623046,4500000000},{80667255480,4600000000},{82482422734,4700000000},{84337635812,4800000000},{86217961301,4900000000},{87953309938,5000000000},{89746820666,5100000000},{91556662143,5200000000},{93439998092,5300000000},{95303593667,5400000000},{97158013922,5500000000},{99080204117,5600000000},{101016865959,5700000000},{103042167188,5800000000},{104735939624,5900000000},{106520038461,6000000000},{108339020461,6100000000},{110194551904,6200000000},{112090962920,6300000000},{113932646967,6400000000},{115853066778,6500000000},{117756428334,6600000000},{119756595296,6700000000},{121611143237,6800000000},{123494368506,6900000000},{125404818570,7000000000},{127360339056,7100000000},{129354551818,7200000000},{131294634763,7300000000},{133318905970,7400000000},{135350966231,7500000000},{137462808125,7600000000},{139052375614,7700000000},{140732668145,7800000000},{142445346067,7900000000},{144194746393,8000000000},{146037422438,8100000000},{147724195504,8200000000},{149512054409,8300000000},{151331584274,8400000000},{153185209653,8500000000},{155051645119,8600000000},{156798952109,8700000000},{158596635939,8800000000},{160402984627,8900000000},{162286550795,9000000000},{164149606192,9100000000},{166003338830,9200000000},{167926774511,9300000000},{169866379992,9400000000},{171876516828,9500000000},{173576727178,9600000000},{175365124328,9700000000},{177188326764,9800000000},{179046824749,9900000000},{180935812837,10000000000},{182776411125,10100000000},{184711441709,10200000000},{186615413487,10300000000},{188617425859,10400000000},{190457184794,10500000000},{192340450187,10600000000},{194259404542,10700000000},{196219122517,10800000000},{198200809867,10900000000},{200148332580,11000000000},{202170968418,11100000000},{204206289209,11200000000},{206291552308,11300000000},{207999147186,11400000000},{209789717168,11500000000},{211606934845,11600000000},{213471105767,11700000000},{215354169177,11800000000},{217198961226,11900000000},{219130300531,12000000000},{221046311026,12100000000},{223051245661,12200000000},{224881948287,12300000000},{226765329947,12400000000},{228690056611,12500000000},{230647419412,12600000000},{232625258768,12700000000},{234578074839,12800000000},{236597532732,12900000000},{238637796475,13000000000},{240718182584,13100000000},{242543758169,13200000000},{244441961634,13300000000},{246354023499,13400000000},{248340289572,13500000000},{250293791186,13600000000},{252267865239,13700000000},{254282368803,13800000000},{256342539975,13900000000},{258381856246,14000000000},{260332956441,14100000000},{262353169362,14200000000},{264392085346,14300000000},{266499308735,14400000000},{268531551868,14500000000},{270653190668,14600000000},{272777094984,14700000000},{274954969328,14800000000},{276550885608,14900000000},{278235349289,15000000000},{279949996554,15100000000},{281699656520,15200000000},{283532815989,15300000000},{285230291483,15400000000},{287018460850,15500000000},{288843338529,15600000000},{290697914218,15700000000},{292555622135,15800000000},{294299027632,15900000000},{296108809336,16000000000},{297913802581,16100000000},{299797478106,16200000000},{301659455418,16300000000},{303513296426,16400000000},{305438074433,16500000000},{307378730113,16600000000},{309375584150,16700000000},{311084691351,16800000000},{312874881380,16900000000},{314691888318,17000000000},{316556574461,17100000000},{318438834135,17200000000},{320283900459,17300000000},{322215373230,17400000000},{324132816437,17500000000},{326137829796,17600000000},{327967124398,17700000000},{329850743236,17800000000},{331776265114,17900000000},{333733585567,18000000000},{335710857866,18100000000},{337664009017,18200000000},{339683323432,18300000000},{341723231862,18400000000},{343789429912,18500000000},{345507238667,18600000000},{347300064350,18700000000},{349113030840,18800000000},{350984406135,18900000000},{352860264736,19000000000},{354707032557,19100000000},{356636401290,19200000000},{358564384537,19300000000},{360569937186,19400000000},{362394197650,19500000000},{364277970856,19600000000},{366198335844,19700000000},{368164629325,19800000000},{370136993397,19900000000},{372090932249,20000000000},{374111296941,20100000000},{376151464705,20200000000},{378224220960,20300000000},{380058390875,20400000000},{381957670005,20500000000},{383870119640,20600000000},{385856452156,20700000000},{387803833108,20800000000},{389785718954,20900000000},{391799556548,21000000000},{393861322106,21100000000},{395892667666,21200000000},{397847294362,21300000000},{399867029816,21400000000},{401906744673,21500000000},{404011963610,21600000000},{406045283138,21700000000},{408166458655,21800000000},{410293988630,21900000000},{412459892513,22000000000},{414170300487,22100000000},{415960418167,22200000000},{417777139873,22300000000},{419642241648,22400000000},{421523913358,22500000000},{423369329089,22600000000},{425300867467,22700000000},{427219090689,22800000000},{429224980146,22900000000},{431052903006,23000000000},{432936691509,23100000000},{434863107905,23200000000},{436819529994,23300000000},{438796401986,23400000000},{440750473367,23500000000},{442769590824,23600000000},{444808941609,23700000000},{446887863691,23800000000},{448715363575,23900000000},{450613672574,24000000000},{452525875722,24100000000},{454512303700,24200000000},{456465371949,24300000000},{458440607830,24400000000},{460454459144,24500000000},{462516131473,24600000000},{464552796690,24700000000},{466505438580,24800000000},{468525009072,24900000000},{470565134403,25000000000},{472670820245,25100000000},{474703374234,25200000000},{476824486461,25300000000},{478949396296,25400000000},{481137046691,25500000000},{482947439062,25600000000},{484844914786,25700000000},{486755371546,25800000000},{488739231350,25900000000},{490705646259,26000000000},{492663323054,26100000000},{494681424791,26200000000},{496736570450,26300000000},{498791098622,26400000000},{500733994162,26500000000},{502758835083,26600000000},{504792318352,26700000000},{506906580542,26800000000},{508935069724,26900000000},{511049944011,27000000000},{513166144224,27100000000},{515389888649,27200000000},{517288857480,27300000000},{519289749375,27400000000},{521307331285,27500000000},{523399099799,27600000000},{525438600325,27700000000},{527525826917,27800000000},{529645152611,27900000000},{531830142929,28000000000},{533911179954,28100000000},{535991669365,28200000000},{538110881857,28300000000},{540290279141,28400000000},{542445766977,28500000000},{544627454221,28600000000},{546846436546,28700000000},{549136811513,28800000000},{550918245602,28900000000},{552577704794,29000000000},{554309590979,29100000000},{556033975615,29200000000},{557829972985,29300000000},{559563840963,29400000000},{561330089610,29500000000},{563154351847,29600000000},{564994400089,29700000000},{566933008719,29800000000},{568618071111,29900000000},{570404156594,30000000000},{572223399213,30100000000},{574077826799,30200000000},{575973613140,30300000000},{577815644715,30400000000},{579740475323,30500000000},{581642857022,30600000000},{583642878785,30700000000},{585412682639,30800000000},{587185448355,30900000000},{589004843649,31000000000},{590849466513,31100000000},{592776838356,31200000000},{594584205659,31300000000},{596480632590,31400000000},{598390213848,31500000000},{600373164701,31600000000},{602276789225,31700000000},{604131558058,31800000000},{606055535834,31900000000},{607996922408,32000000000},{610014086322,32100000000},{611936152792,32200000000},{613942070950,32300000000},{615953831172,32400000000},{618055837482,32500000000},{619832855781,32600000000},{621609731741,32700000000},{623425191203,32800000000},{625271673298,32900000000},{627194398350,33000000000},{629008378139,33100000000},{630905954546,33200000000},{632817224875,33300000000},{634802011556,33400000000},{636703471280,33500000000},{638556986940,33600000000},{640483343578,33700000000},{642421663991,33800000000},{644434745133,33900000000},{646369655949,34000000000},{648375252409,34100000000},{650387040722,34200000000},{652490864964,34300000000},{654340820929,34400000000},{656224576189,34500000000},{658146134026,34600000000},{660104803135,34700000000},{662085614135,34800000000},{664034735323,34900000000},{666056469887,35000000000},{668092915894,35100000000},{670191528127,35200000000},{672123851671,35300000000},{674129434810,35400000000},{676141175724,35500000000},{678244658509,35600000000},{680275412064,35700000000},{682374196306,35800000000},{684492287082,35900000000},{686688081834,36000000000},{688498052941,36100000000},{690271265396,36200000000},{692090271191,36300000000},{693934884550,36400000000},{695861454783,36500000000},{697669335632,36600000000},{699566093251,36700000000},{701476114233,36800000000},{703459014946,36900000000},{705362572698,37000000000},{707217077730,37100000000},{709141525004,37200000000},{711083438845,37300000000},{713099812794,37400000000},{715022516642,37500000000},{717028460170,37600000000},{719040292107,37700000000},{721142705765,37800000000},{723002026267,37900000000},{724885629032,38000000000},{726803561592,38100000000},{728761045579,38200000000},{730747568720,38300000000},{732693287993,38400000000},{734717019390,38500000000},{736749758874,38600000000},{738856174302,38700000000},{740777465961,38800000000},{742783307821,38900000000},{744795165468,39000000000},{746896572050,39100000000},{748933922639,39200000000},{751024347007,39300000000},{753141880458,39400000000},{755336643853,39500000000},{757242843585,39600000000},{759125818601,39700000000},{761035892927,39800000000},{762989904072,39900000000},{764984543942,40000000000},{766926219065,40100000000},{768950249380,40200000000},{770981663499,40300000000},{773102984407,40400000000},{775002837011,40500000000},{777003979124,40600000000},{779020939116,40700000000},{781115568136,40800000000},{783154062627,40900000000},{785241482314,41000000000},{787360097555,41100000000},{789546215920,41200000000},{791553252818,41300000000},{793534166666,41400000000},{795550462220,41500000000},{797612465334,41600000000},{799687356918,41700000000},{801743227036,41800000000},{803862443625,41900000000},{806016345293,42000000000},{808158770188,42100000000},{810211805541,42200000000},{812331967883,42300000000},{814480115181,42400000000},{816665287720,42500000000},{818815284449,42600000000},{821033071135,42700000000},{823291446296,42800000000},{825336664996,42900000000},{827085965369,43000000000},{828930392300,43100000000},{830720144582,43200000000},{832614810573,43300000000},{834456466214,43400000000},{836329001352,43500000000},{838244378913,43600000000},{840200563740,43700000000},{842172566043,43800000000},{844015128001,43900000000},{845924301194,44000000000},{847830932678,44100000000},{849827622308,44200000000},{851765990426,44300000000},{853747688137,44400000000},{855773169362,44500000000},{857835953013,44600000000},{859806361441,44700000000},{861660536604,44800000000},{863582897550,44900000000},{865519592653,45000000000},{867544389704,45100000000},{869447143816,45200000000},{871446393635,45300000000},{873463619464,45400000000},{875554302728,45500000000},{877522802074,45600000000},{879503038972,45700000000},{881526923742,45800000000},{883590032966,45900000000},{885658701687,46000000000},{887720236940,46100000000},{889838183538,46200000000},{891996345815,46300000000},{894045653774,46400000000},{895894981736,46500000000},{897822674154,46600000000},{899754550956,46700000000},{901760199509,46800000000},{903674751149,46900000000},{905672137367,47000000000},{907685190026,47100000000},{909772129132,47200000000},{911755883600,47300000000},{913735370979,47400000000},{915747908991,47500000000},{917808707287,47600000000},{919885714570,47700000000},{921941106979,47800000000},{924059753965,47900000000},{926210825894,48000000000},{928324426778,48100000000},{930270736126,48200000000},{932294263359,48300000000},{934327743215,48400000000},{936441420445,48500000000},{938472256198,48600000000},{940594928117,48700000000},{942709938290,48800000000},{944923194197,48900000000},{946936098999,49000000000},{949049124016,49100000000},{951165540848,49200000000},{953382717840,49300000000},{955503787985,49400000000},{957723191654,49500000000},{959946162612,49600000000},{962209863199,49700000000},{964024768740,49800000000},{965922590824,49900000000},{967834326487,50000000000},{969819285239,50100000000},{971779514592,50200000000},{973744657012,50300000000},{975763287764,50400000000},{977816739031,50500000000},{979866439343,50600000000},{981812882713,50700000000},{983836311144,50800000000},{985870025629,50900000000},{987983393422,51000000000},{990014429317,51100000000},{992137825273,51200000000},{994252783159,51300000000},{996463258969,51400000000},{998367757387,51500000000}};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, cnt = 0, pos = 1, v = 0, d = 100000000;
    cin >> n;
    int j = lower_bound(a.begin(), a.end(), make_pair(n, 1ll << 60)) - a.begin();
    tie(pos, cnt) = a[j - 1];
    while(pos < n){
        pos += __builtin_popcountll(pos);
        cnt++;
    }
    cout << (pos == n ? cnt + 1 : -1) << '\n';
}
0