hriss95's blog

By hriss95, 7 years ago, In English,

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 :)

 
 
 
 
  • Vote: I like it
  • +3
  • Vote: I do not like it

»
7 years ago, # |
  Vote: I like it +10 Vote: I do not like it

You can write test generator, a program which writes test data to stdout, and upload it.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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, # |
  Vote: I like it -9 Vote: I do not like it

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, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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, # ^ |
        Vote: I like it +1 Vote: I do not like it

      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, # ^ |
          Vote: I like it +1 Vote: I do not like it

        It's 256KB

        • »
          »
          »
          »
          »
          7 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          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, # ^ |
              Vote: I like it +3 Vote: I do not like it

            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 <iostream> 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, # ^ |
              Vote: I like it 0 Vote: I do not like it

            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.