11448 - Who said crisis?

All about problems in Volume 114. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
FAQ
Learning poster
Posts: 84
Joined: Wed Jan 28, 2004 6:23 pm

11448 - Who said crisis?

Post by FAQ »

I got a ton of Runtime Error
Is there any trick in input format?

Please help me :'(
sapnil
Experienced poster
Posts: 106
Joined: Thu Apr 26, 2007 2:40 pm
Location: CSE-SUST
Contact:

Re: 11448 - Who Said Crisis?

Post by sapnil »

Code: Select all

Make large size of your array(10009) then get acc..
"Dream Is The Key To Success"

@@@ Jony @@@
FAQ
Learning poster
Posts: 84
Joined: Wed Jan 28, 2004 6:23 pm

Re: 11448 - Who Said Crisis?

Post by FAQ »

Thanks, I got WA instead :|
Some tests please?
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Re: 11448 - Who Said Crisis?

Post by sohel »

I got one RTE as well during the real time contest. I thought this line "Both numbers are between 0 and a googol (10^100) to the power of a hundred." meant the input is in the range [0, 10^100] and interpreted the last portion of the sentence as an emphasizer of the portion in bracket. But this was supposed to mean googl^100, ie (10^100)^100.

And about test cases:
Each case of input is just 2 numbers A B and you are asked to find A-B. Surely, you don't need help from others. You can make test cases on your own!! Just make few random cases for small numbers that fit in 32-bit integer. And compare your real code with this code " scanf("%d %d", &A, &B); printf("%d\n", A -B); "

One critical case that comes to mind is "10000 1" and that should output "9999".
FAQ
Learning poster
Posts: 84
Joined: Wed Jan 28, 2004 6:23 pm

Re: 11448 - Who Said Crisis?

Post by FAQ »

I got ACed ! Thanks a lot, you're right, I read the statement very carelessly ~~
nymo
Experienced poster
Posts: 149
Joined: Sun Jun 01, 2003 8:58 am
Location: :)

Re: 11448 - Who Said Crisis?

Post by nymo »

I am getting RE. I am using Java BigInteger class. What can go wrong? I am quite confident that my implementation is correct.
regards,
nymo
gr81
New poster
Posts: 46
Joined: Wed Sep 26, 2012 7:52 pm

Re: 11448 - Who Said Crisis?

Post by gr81 »

please help...does this problem solves the -ve number.I am ignoring the -ve integers in input.

here is my input.

Code: Select all

21
00002 09
009 002
900 200
0 0
10 3
1000 9
1000 999
4 9
0 8
5 2
1000 20000
999 997
16555 17000
10000 1
1 100000
2000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000001
20004 999
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 9999999999999999999999999999999999999999
-1 20
20 -5
2000000000000000000000000000000000000000000000000 100000000000000000000000000000000000000000000001

output.

Code: Select all

-7
7
700
0
7
991
1
-5
-8
3
-19000
2
-445
9999
-99999
1899999999999999999999999999999999999999999999999
19005
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990000000000000000000000000000000000000001
1899999999999999999999999999999999999999999999999
I am not able to figure out the failed test case.
my array is 10009 digits.

Thanks.
gr81
New poster
Posts: 46
Joined: Wed Sep 26, 2012 7:52 pm

Re: 11448 - Who Said Crisis?

Post by gr81 »

Thanks Brian, I will have to modify the code for considering -ve number too...I will try that..
gr81
New poster
Posts: 46
Joined: Wed Sep 26, 2012 7:52 pm

Re: 11448 - Who Said Crisis?

Post by gr81 »

Hi Brian,

I have modified code at http://ideone.com/66lkOP, and it passes all the input. kindly suggest.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11448 - Who Said Crisis?

Post by brianfry713 »

Input

Code: Select all

100
93517092697405393 1685174152645421743168853
253243043282775931409879 50864265143236091161059453498121472563641834308009626730196552002500945555416737973956313797386
566886371728132485391658354931165630099078572412 245768566218313261484941955402592005819120610179063831196492782509591823592429372154909942409525
998797470299936293967110359074432963753422524056858065631189710403884552895284824149123883725955 2378285401511847595079799177967517955636080982996811687709665163912676204399227822259640595
949014540913190473780509667237262942458 862462582019744575085019770776337751
7711069578316482 965526552857207223850862247594395571371772417377318986202852694693708875203311
556812199298371414753114435921913481634056802347333641134878 419985249044909901427182839992970
6579583827387814953809239959444319772590013421281846144570866115270988 57086901572655217086310100689997147082621534049264077416973064833859
6053028776872951076882220068806343176246833202471531888 40372969659349586937774082813006534552924076629563586307101455689146946623491646
751220117003745 19382762567488388156
50649852851 15942018164620055507815860290187853370873226084337924671
30973616110075309215190137329484595190418 23616337276707240279224513672062063696559
734487666850100606179947605213906130554566080333046904412 3651514595666105097147216575325576
55910375219225901160433696299928586514496648080097354810777430016135242837096300857308316 2903
76649109457531502934295757 87907138077552934761465254280184802086487007246381075933080703
3467475180036925957145393918750554324313246378354626410 7477308440415431198517527328499206617137938736944244546456523764210502491547931341
789929947280872068779905583245773669276069935273 913374844886205693095304003277711686204201718559854
135950333689606646837601397944 67608253778087624689310736163385469057316747060065596945074220141
689706993829221976988874499898868 190888762286094
56603862772970493097299729 103664796211536679612969262997438083308
6013026169312616796318507812184973634451589561201047752769162023 5135431998234246435702563870238035341990562948660334466912422705636388389648550606
57701161392985 386350034445
397740175038729576522951489246449 3808835301235680041
5562844751509802 996126900693709870224889640987917823842122429718290795725538756
8399564522084287263134733 5930216987421210706291334899082792652123774945805897551810823681
1354462185715514387360359833294053859695997382808136623031614740780173567274675697304371699 8400775288594237
5487238137264656047423593992542383733005116679140351115135933050 755806
9983624385046042253338475489943147382153083656524208709780905688324 5979874269267374567788598067477027364626817576793749140711869850172822
5733443791516370481805356719649500033460972640802616739226677 4
92925901239640841 4945285386121453531894580910370553846944913396653657704817525270275605680429397603453420338
64628087067550486698392 23351334263818657954476001
192478213302851708134503224439192878114841850384 264604841052850065568292
744378703293573694516424320736972878317675423419871994224306036988764215121332109983448821673915 1650834015961161476818347773906887208095350685347643863
577137994657620311432 1911429413861022757367088773465739317358775031836710043498603303
7355151174633006 1815270687971947534153404801930219743370648593103478284407455218
89610269828713010498039403698578198980201599205939649642 6989206307351711
52294801094858383380505246478046733301264126341312631139214518847856 1643356760383584278027706914202365263648716155890
8640981939281203584109408751321881654357772746023232876637177194264620592186217341691755338 3612108342004815962686425863
17451877890280919063463354502982728297979080138404140347563482251083240 7235621381211758390639951483397627652072525025876294433
1427264763071017824584713990266954572968005702111935727573864899075730153237 869601166817606926789145104630082675
31584519917757364678352780523977539974673 774158237701606706730592883386549756149743747296600823088365013354884295872201530887594117
342618231692240437790065066850714882552347412 3873274354711751083408104226537418351311254671760337829353359012094
4140033517551765172764773 160597353
253931716900830838291443622114871350517844369941572825070837968 97130544511413699261321987726497
3101135289116031779415128423390358639922628109011996424850 233644424121365847711827229245080067183348672889218953188991750
246461825202034366709 4446224919813411549943799176857135980925145416
8700185687319909454414999890807968446710488305035244984035991374585587697759 65910711050948
7335502375710354253194594937717814371009037131531983961867 783690855984061267852843687920927216976207399569
6184340789832770572024585982 510322487359261831893312439788136399344936871
5860427057950912148 8180971840890663369726158932510759674296866486927165408388695659845498959697
949927673752364469696765184505100554905931424727945657821379132358 217800886672001850221004
4336165696262059784206835 4321085168713950850958385895570904255269760469100397162552577418093801126351410678733025552040351
9423433330277414164206180310287 120780
9407064311628092966208522345453887909493477223990019487269472752838487542167808181328 521991976108300587955875874366567680552346492756954
74424775631077329025004481604528041722418 307494782126737787653495244855903060979464475113912449595269040756005903189504
2223499535074006601130645476609940599522942008428756282553233623194 338630351011930008769172872264726333861871160647751588454177726864399
85783040538766439207967331714 218939836657771667685689834450375857453393432744504444827379402355870816244
3236820216617253 8304011574748070906602616323580404835518355572402386574859787648436947584240935946
7475843972760926907839944308523034402771749878566651796100557826152371588028 459569452501042752605960198190499677135744946086
82313327306797931802476330835717847677775497721251731810269587664931967 689231408715427179695700002240956574742186780052321418363923183905760737482
266008368209166087499617 59615737131026425509889517994013
7831126982168174396504185360803310 347662870951778899239925563137192342305888270466444569175794
88966448386475937263778362666180113962592204434 1849650824762100811652074020171593660938846682871457473088859523761693782018391
15786880828067772579414615883014212652989983692979382302285532375041094718645792971864527146155703 4718590400919170954571335348252135910792771854565677528448244929
5402631717417874629611809183702332531051878 5325906365116383685998716695544509688377245971647955750269439995511750464364534030
4234412885349558990767403258771730149027628917530075902513376 34328233886333780632645587054148212067950247
800175195473507153254003301550229676632124059580715977587057815421 5557523102035050806861731397612508967178244500103
64892002259653875567023674113345161536071011083547560433159947881637000499180400518 72110699854786005787256505395872480321417755109690108043432727004177417682547958146271
7452490542949170733285782561114308420854865163350996466135135589503 19353405243450155709794744565560578669353720482999084611803124837457095018009213354399589921612252
3447889497660549960677951927695976989579512635030278093 9604674821715160095643192945300369174562616686585687417022753080953357104426496252
17157195590900176435676767491354245216052869389713027957779359776684725 7343133545831455484479421
4163 62867206287051900827031248441812625071235073463624396372273752398275061066330428127220
44 272669917978249220329463576395417830094
99074181922258728970306833442559603011413379048020597579 9587055905242571625786479518267382333486986467473473475175236536996944379275513587400
933935043749884001214585561673 30164340165389696
110631859495785234232925444024246473272645258704466849078390897150889199080043231403764396 971588138898265564212404538264145298330863914286652404492
7419950727999616758533 405204572159189615903288556165841413008012155147244242308826
7201 9440550705497858822955108468909189105374188
30755998806444850353832575926170544836781970848151296867 75429529733420500099
25696106221588332758746560105 1180862538025220104992459374526784343577
7677829558773775876870979863051 29146649879621665239008476623093684559768458508145505842780147481
89647681575985957941696425378841850169391961402955908189263535479307888251784 1152176
886026790927369582929486773355413711704598517396 1942468469222
4151851838544778126 495641511152247129211001398017323856496710301576582088442337992
7213590129852598116950773210916751850605899310096345896155079184183497281612047588673368 8349460882809186162287041258415011303151413514589613
713 83
725778678028537159991279714104955 428294433597632765258187845795832878417425704919053481809716830925336826103691773710644
3668050367781870821001762765426431337740564 4371916337229639797455486271779
85980853047944792252488 47463073612390265517993455969166664893877270635348058286431186431548705670860
5739735852828 49819256958465645859654740398433773886214530091377136454366728949000295
5953002366 6745350113818
83407 266
4243405273410004052366285 72874159716713122729410856
1169243 6392257519196106759029923411426686483053133917660333583596080159074960471
8754614849151414623267544442461427630246309746378845221812370 240204393083721690927674050
350417 3
624799364767475334 370934593195870493039315119243294121790775228260520367341117273412562245982624475
613307344159726 9101881884081956336297874795619539638185350767360256118909832465960014815485
532741757111752889559 439575130941589266134518436794912491388381403213792691765088332367101370582617144854591081298231511
996232998210829174766959072117051193 80572538574
AC output:

Code: Select all

-1685174059128329045763460
-50864265143236091161059453498121472563641834308009626730196552002500945302173694691180382387507
-245768566218313261484941955402592005819120610178496944824764650024200165237498206524810863837113
998795092014534782119515279275254996235466887975875068819502000738720640219080424921301624085360
948152078331170729205424647466486604707
-965526552857207223850862247594395571371772417377318986202852686982639296886829
556812199298371414753114435501928232589146900920150801141908
6522496925815159736722929858754322625507391887232582067153893050437129
-40372969659349586937774076759977757679972999747343517500758279442313744151959758
-19382011347371384411
-15942018164620055507815860290187853370873226033688071820
7357278833368068935965623657422531493859
734487666850100606179943953699310464449468933116471578836
55910375219225901160433696299928586514496648080097354810777430016135242837096300857305413
-87907138077552934761465254280184802009837897788849572998784946
-7477308440415431198517527325031731437101012779798850627705969439897256113193304931
-912584914938924821026524097694465912534925648624581
-67608253778087624689310736163385468921366413370458950107472822197
689706993829221976797985737612774
-103664796211480075750196292504340783579
-5135431998234246429689537700925418545672055136475360832460833144435340636879388583
57314811358540
397740175038725767687650253566408
-996126900693709870224889640987917823842122429712727950974028954
-5930216987421210706291334899082792652115375381283813264547688948
1354462185715514387360359833294053859695997382808136623031614740780173567266274922015777462
5487238137264656047423593992542383733005116679140351115135177244
-5969890644882328525535259591987084217244664493137224932002088944484498
5733443791516370481805356719649500033460972640802616739226673
-4945285386121453531894580910370553846944913396653657704817525270275605680336471702213779497
-23286706176751107467777609
192478213302851708134502959834351825264776282092
744378703293573694516424320736972878317673772585856033062829218640990308234124014632763474030052
-1911429413861022757367088773465739317358774454698715385878291871
-1815270687971947534153404801930219743370648593096123133232822212
89610269828713010498039403698578198980194609999632297931
52294801094858383378861889717663149023236419427110265875565802691966
8640981939281203584109408751321881654357772746023232876637177190652512250181401379005329475
17451877890280911827841973291224337658027596740776488275038456374788807
1427264763071017824584713990266954572967136100945118120647075753971100070562
-774158237701606706730592883386549756149743747296569238568447255990205943091677553347619444
-3873274354711751083407761608305726110873464606693487114470806664682
4140033517551765012167420
253931716900830838291443622114774219973332956242311503083111471
-233641322986076731680047814116656676824708750261109941192566900
-4446224919813411549943798930395310778890778707
8700185687319909454414999890807968446710488305035244984035991308674876646811
7335502374926663397210533669864970683088109914555776562298
-510322487359261825708971649955365827320350889
-8180971840890663369726158932510759674296866486927165408382835232787548047549
949927673752364469696765184505100554905931206927058985819528911354
-4321085168713950850958385895570904255269760469100397162552577418093801122015244982470965767833516
9423433330277414164206180189507
9407064311628092966208522345453887387501501115689431531393598386270806989821315424374
-307494782126737787653495244855903060905039699482835120570264559151477861467086
-336406851476856002168042226788116393262348218639322832171624493241205
-218939836657771667685689834450375857453393432658721404288612963147903484530
-8304011574748070906602616323580404835518355572402386574859787648433710764024318693
7475843972760926907839944308063464950270707125960691597910058149016626641942
-689149095388120381763897525910120856894509004554600166632112914318095805515
-59615736865018057300723430494396
-347662870951778899239925555306065360137713873962259208372484
-1849650824762100811652074020171504694490460206934193694726193343647731189813957
15786880828067772579414615883014207934399582773808427730950184122905183925873938406186998697910774
-5325906365116383685998716695544509688371843339930537875639828186328048131833482152
4234412885349558956439169372437949516382041863381863834563129
800175195473507147696480199515178869770392661968207010408813315318
-72045807852526351911689481721759135159881684098606560482999567056295780682048777745753
-19353405243450155709794744565553126178810771312265798829242010529036240152845862357933454786022749
-9604674821715160095643192941852479676902066725907735489326776091373844469396218159
17157195590900176435676767491354245216052869382369894411947904292205304
-62867206287051900827031248441812625071235073463624396372273752398275061066330428123057
-272669917978249220329463576395417830050
-9587055905242571625786479518168308151564727738503166641732676933985531000227492989821
933935043749853836874420171977
110631859495785234232925444024245501684506360438902636673852633005590868216128944751359904
-405204572159189615903288556165841413000592204419244625550293
-9440550705497858822955108468909189105366987
30755998806444850353832575926170544761352441114730796768
-1180862537999523998770871041768037783472
-29146649879621665239008476623093676881938899734369628971800284430
89647681575985957941696425378841850169391961402955908189263535479307887099608
886026790927369582929486773355413709762130048174
-495641511152247129211001398017323856496710297424730249897559866
7213590129852598116950773210916751842256438427287159733868037925768485978460634074083755
630
-428294433597632765258187845795832878417425704919053481083938152896799666112412059605689
3668050367777498904664533125628975851468785
-47463073612390265517993455969166664893877270635348058200450333383603913418372
-49819256958465645859654740398433773886214530091377136454360989213147467
-6739397111452
83141
-68630754443303118677044571
-6392257519196106759029923411426686483053133917660333583596080159073791228
8754614849151414623267544442461427390041916662657154294138320
350414
-370934593195870493039315119243294121790775228260520367341117272787762881215149141
-9101881884081956336297874795619539638185350767360256118909831852652670655759
-439575130941589266134518436794912491388381403213792691765088332367101370582616612112833969545341952
996232998210829174766958991544512619
You can solve this in just a few lines of JAVA.
Check input and AC output for thousands of problems on uDebug!
gr81
New poster
Posts: 46
Joined: Wed Sep 26, 2012 7:52 pm

Re: 11448 - Who Said Crisis?

Post by gr81 »

thanks, with previous code I failed one test case...i got AC. I don't know ABC of java....
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 11448 - Who Said Crisis?

Post by uDebug »

Replying to follow the thread.
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11448 - Who said crisis?

Post by lighted »

Problem description says
For each test case, there is a line with two positive integer numbers, A and B, corresponding to the
benefits and the costs, respectively. Both numbers are between 0 and a googol (10^100) to the power of
a hundred.
Statement that A and B are positive is a mistake. They are non-negative. Between 0..10^10000.
gr81 wrote:Thanks Brian, I will have to modify the code for considering -ve number too...I will try that..
So some inputs posted by gr81 and brianfry713 are invalid. Input numbers should be non-negative. There is no need to consider negative numbers.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11448 - Who said crisis?

Post by brianfry713 »

I deleted my post with invalid input.
Check input and AC output for thousands of problems on uDebug!
Post Reply

Return to “Volume 114 (11400-11499)”