Блог пользователя hriss95

Автор hriss95, 12 лет назад, По-английски

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
  • Проголосовать: не нравится

»
12 лет назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

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

  • »
    »
    12 лет назад, # ^ |
      Проголосовать: нравится 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?

»
12 лет назад, # |
  Проголосовать: нравится -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.

  • »
    »
    12 лет назад, # ^ |
      Проголосовать: нравится 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

    • »
      »
      »
      12 лет назад, # ^ |
        Проголосовать: нравится +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.

      • »
        »
        »
        »
        12 лет назад, # ^ |
          Проголосовать: нравится +1 Проголосовать: не нравится

        It's 256KB

        • »
          »
          »
          »
          »
          12 лет назад, # ^ |
            Проголосовать: нравится 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

          • »
            »
            »
            »
            »
            »
            12 лет назад, # ^ |
              Проголосовать: нравится +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 <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 << " "; } }
          • »
            »
            »
            »
            »
            »
            9 лет назад, # ^ |
              Проголосовать: нравится 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.