### hriss95's blog

By hriss95, 7 years ago, ,

Hey guys, do you know if there is any memory limit for the hacks' size. I am asking this because during contest #149 I tried to hack a solution which used an array of 10^4 elements while the problem's restrictions showed that there can be up to 10^5 numbers which have to be stored. So, of course I decided to hack the solution, but I was unhappy to see that my hack couldn't be processed and I should try again. I tried several times uploading the file or directly copying the data, but I would always get the same answer. My test was with 20001 rows. Later I saw that this solution had run-time error. I was upset to see that. Actually it doesn't matter so much because I joined this website to learn and practice, but I am just eager to know why this happened to me. I would be grateful if there is someone who can explain :) Thank you in advance guys :)

• +3

 » 7 years ago, # |   +10 You can write test generator, a program which writes test data to stdout, and upload it.
•  » » 7 years ago, # ^ |   0 I didn't try that, but do you have any idea if this will work. I mean are you aware why I had this answer by the system?
 » 7 years ago, # |   -9 there is no memory control in C++. see at example below int a[8]; int b[8]; if (&a[11] == &b[3]) cout << "ok"; let's suppose someone declares global array A[10000], and the is no other arrays declared immediately after this one. A[20001] can be situated in the memory interval assigned to array A, for example size of this interval have to be a multiple of size virtual memory page. you should use bigger index, for example 99 000.
•  » » 7 years ago, # ^ |   0 Yes, I am aware of that, but the problem is why was my hack not processed by the system and before someone suggests...it was not because I didn't input the test data correctly. I was simply told by the system "Your hack cannot be processed. Please try again!" or something like that
•  » » » 7 years ago, # ^ |   +1 acturally,the hack data you submitted is too large. it may be under 1M,i think. i have been faced with the same problem,but i don't remember the max size.
•  » » » » 7 years ago, # ^ |   +1 It's 256KB
•  » » » » » 7 years ago, # ^ |   0 Thank you very much guys. Now we have to solve the mystery why they put a memory limit on hack data that is less than the memory needed for the biggest test :D
•  » » » » » » 7 years ago, # ^ |   +3 To hack somebody with big test you must write a generator. it is probably done because servers can be easily overloaded if users would be able to upload large files.Generator is a program that outputs your test in stdout.For example: #include using namespace std; int main(){ int n = 100000; cout << n << endl; for(int i = 1; i <= n; ++i){ cout << i; if(i + 1 == n) cout << endl; else cout << " "; } } 
•  » » » » » » » 4 years ago, # ^ |   0 I pasted this same code for a hack, and I got the following error. INVALID INPUT Validator 'val.exe' returns exit code 3 [FAIL Unexpected character #13, but ' ' expected (stdin)]Can you please help?
•  » » » » » » » » 4 years ago, # ^ |   0 That particular generator was just an example. For each problem you should write a generator which will match the problem input specification given in the problem statement.
•  » » » » » » » » » 4 years ago, # ^ |   0 The problem statement was such that this code was valid for the hack. Here is the link of the hack:http://codeforces.com/contest/574/hacks/164509/test Problem:http://codeforces.com/contest/574/problem/C
•  » » » » » » » » » 4 years ago, # ^ |   +1 =========================== The code above outputs end of line before the last number.
•  » » » » » » » » » 4 years ago, # ^ |   0 Thanks!Can you tell me about this one please?http://codeforces.com/contest/574/hacks/164471/test
•  » » » » » » » » » 4 years ago, # ^ | ← Rev. 2 →   0 It will output ' ' in the end. It should be like this
•  » » » » » » » » » 4 years ago, # ^ |   0 Thank you so much!
•  » » » » » » » » 4 years ago, # ^ |   0 Did you ask during the contest?
•  » » » » » » 4 years ago, # ^ |   0 Hacking represents traffic: you need to transfer the test data from your machine to CF's servers at that specific point in time, and the limit on the size of this data has been set to prevent the contestants from overloading the servers. The limit on hack data size is the same for all tasks, it has nothing to do with the limits on test data size for specific tasks.