********************************** *** Взлом использует генератор *** ********************************** ** Аргументы командной строки ** нет аргументов ** Сгенерированный тест ** 15 20000 79925 132900 36813 31527 71407 69717 75589 50980 18212 38639 145461 140782 63541 109038 85965 26094 149284 138998 69334 30563 14389 22912 14179 71339 39083 102102 76491 5797 80679 72064 86693 104832 145251 30190 20565 2125 92612 139467 54316 120559 139086 89123 85069 46574 65565 34596 105163 147811 127389 22255 57078 79342 46334 133022 37718 8014 22417 22181 136236 88779 127983 112483 119461 38565 106230 25929 52950 141125 128494 26283 71510 58027 9545 31640 42990 65750 4939 101606 82509 117837 ... ** Исходный код генератора ** #include #pragma GCC optimize("O3") using namespace std; // effective for hacking CPython's defaultdict mt19937 rng(123456789); int randint(int a, int b){ uniform_int_distribution dist(a, b); return dist(rng); } int randint2(int a){ return randint(0, a-1); } // parameter on how hard to try to find a long probing chain for the insertion of the Mth element const int K = 14; // do not change this const int M = (2< found; int a[200005]; const int mask = (1<>= 5; indx = (indx*5 + 1 + offset)&mask; score ++; if(!found[indx]){return indx;} } return -1; } int findNextPythonHashIndx(int x){ int score = 0; return findNextPythonHashIndx(x, score); } void insertPythonHash(int x){ found[findNextPythonHashIndx(x)] = true; } bitset used; int main(){ // The total score is the estimated total number of hash collisions in the CPython hashing algorithm // It does not account for the resizing in CPython hash tables where there will be more insertions, // hence the estimate is likely conservative. long long totalScore = 0; int mostRecentBestScore = 0; for(int i = 0; i < M; i ++){ // greedy algorithm: choose the element that causes the greatest number of hashing collisions int bestScore = 0; int bestVal = -1; int j = MAX_TRIES; while(j > 0){ int x = randint(1, MAX_SIZE); if(used[x]){continue;} j --; int score = 0; findNextPythonHashIndx(x, score); if(score > bestScore){ bestScore = score; bestVal = x; } } insertPythonHash(bestVal); used[bestVal] = true; a[i] = bestVal; mostRecentBestScore = bestScore; totalScore += bestScore; } for(int i = M; i < N; i ++){ a[i] = a[M-1]; totalScore += mostRecentBestScore; } /* Insert hack test code here. */ int t = min(100, 300000/N); //printf("Total number of hash probes required: %lld\n", totalScore*t); //return 0; printf("%d\n", t); while(t --){ printf("%d\n", N); for(int i = 0; i < N; i ++){ printf("%d%c", a[i], (i == (N-1)) ? '\n' : ' '); } } }