I wonder the same. Did you find a solution?
So i did a hash table now. Since there was the tag âHash Tableâ i figured it is in fact the way to go. I have now a problem with âLimite size in filenamesâ i dont even know what that means. Do they mean to check if the filename is to long? And what should i do if it is to long?
Try to test your code with a filename of maximum allowed size.
This might lead to some problems with the end-of-string handling in C.
Hi, I was puzzled over âProcess has timed outâ error in large dataset test case, and then noticed that I included list library that I don`t need. When I excluded extra library from my program, large dataset suddenly become passed. Can somebody explain why program was failed before, and then become passed after excluding unused library?
I am stuck with this puzzle in the last test but not because of a timeout problem. It looks like the tests expect an extension when it should not. Here is the output I have generated to explain my problem:
filename : anotherfiletest.zip
ext: zip
mimetype: application/zip
application/zip
filename : thisisanotherfilename.longextens
ext: longextens
mimetype: UNKNOWN
UNKNOWN
filename : iLowerCaseAndUpperCaseLetters.
ext:
mimetype: UNKNOWN
UNKNOWN
Failure
Found: UNKNOWN
Expected: image/jpeg
As you can see in the last iteration, the filename do not have any extension so the mimetype is âUNKNOWNâ but the test expect âimage/jpegâ.
I can not see where I am wrong given that I pass all the other tests.
I canât find your data in the test.
The three filenames you provide appear in this order at the very end and the expected result is zip unknown unknown as your program returns.
This puzzle is cool!
Hi everyone
My algorithm passed test 1, 2 and 4
Whatâs asked in test 3 ?
Whatâs âcorrect division of the extensionâ ?
Thanks for your help
it means that every one of the following should be identified as ext:
.ext
xxx.ext
xxxâŚext
xxxâŚext
ok thanks, now iâhave understood.
My code fails only at âCorrect division of the extensionâ with this message:
Found: applicatâŚ
Expected: UNKNOWN
I do not get why it fails because my last print is âUNKNOWNâ. From debugging with stderr I also do not why it should fail. Can somebody help me please?
Maybe the error is before your last UNKNOWN.
"Limite size in filenames "Problem
anyone can help?
Hi,
so iâm back here after whatâŚ4 years? and decided to finish this puzzle.
It works pretty well, except for the last test with big dataset. I got a âsegmentation faultâ arror at the line fgets(FNAME, 501, stdin); // One file name per line.
But this line is an automatical one. Itâs the one supposed to get the text out of the file and give it to me; i shouldnât have to touch it. My code is below that. I donât think i should correct this âdefault codeâ, i mean itâs supposed to work since itâs given to us. Or am i wrong?
Welcome back on CodinGame!
Iâm not very familiar with C but after some tests, I understood that the issue in your code comes from this line:
char ExtFound[Q][501];
where Q = 9999
Thatâs too big. This could help: https://stackoverflow.com/questions/12552968/is-there-any-limitation-on-the-maximum-size-of-array-in-c
Iâll investigate why the console doesnât show the correct line.
Good luck!
Ok thanks. Thatâs probably why my teacher always tell me to use malloc XD
Meanwhile iâve changed the fgets for a scanf, so i get rid of the last \n in the file name.
now, i just have to make it faster. It did past one time, but most of the time it stops after ~7000 mime types because itâs too long.
but something is weird here: When iâm doing the filename treatment to get back the extension and then look for this extension in the mimetype table, it takes longer than when i get every file extension, store them in an array, and then start another loop to compare with the mime types. I thought it should be faster with only one loop and not two. How can it not be?
EDIT: i got a 100% even if it doesnât pass the large data set test; on the validation test, it works o_O
âYou are provided with a table which associates MIME types to file extensions.â
âIf the extension for a given file can be found in the association tableâŚâ
Iâm afraid Iâm not seeing this table, what did I overlook?
the association table is given to you as the input of the puzzle
If thatâs the case why does it expect âimage/gifâ as one of the outputs when that is not one of the MIME types mentioned in the input?
Nevermind, I was looking at the example for the list for some reason.
I could just get it to read me the types that each test case has.
My oversight, thanks for the help.