CSES - Aalto Competitive Programming 2024 - wk11 - Wed - Results
Submission details
Task:Hacking hashes
Sender:aalto2024l_006
Submission time:2024-11-20 17:48:19 +0200
Language:C++ (C++17)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails
#4ACCEPTED0.00 sdetails
#5ACCEPTED0.00 sdetails
#6ACCEPTED0.00 sdetails
#7ACCEPTED0.00 sdetails
#8ACCEPTED0.00 sdetails
#9ACCEPTED0.00 sdetails
#10ACCEPTED0.00 sdetails
#11ACCEPTED0.00 sdetails
#12ACCEPTED0.00 sdetails
#13ACCEPTED0.00 sdetails
#14ACCEPTED0.00 sdetails
#15ACCEPTED0.00 sdetails
#16ACCEPTED0.00 sdetails
#17ACCEPTED0.00 sdetails
#18ACCEPTED0.00 sdetails
#19ACCEPTED0.01 sdetails
#20ACCEPTED0.00 sdetails
#21ACCEPTED0.00 sdetails
#22ACCEPTED0.00 sdetails
#23ACCEPTED0.00 sdetails
#24ACCEPTED0.00 sdetails
#25ACCEPTED0.00 sdetails
#26ACCEPTED0.00 sdetails
#27ACCEPTED0.00 sdetails
#28ACCEPTED0.00 sdetails
#29ACCEPTED0.00 sdetails
#30ACCEPTED0.00 sdetails
#31ACCEPTED0.01 sdetails
#32ACCEPTED0.00 sdetails
#33ACCEPTED0.00 sdetails
#34ACCEPTED0.00 sdetails
#35ACCEPTED0.00 sdetails
#36ACCEPTED0.00 sdetails
#37ACCEPTED0.01 sdetails
#38ACCEPTED0.00 sdetails
#39ACCEPTED0.01 sdetails
#40ACCEPTED0.00 sdetails
#41ACCEPTED0.01 sdetails
#42ACCEPTED0.01 sdetails
#43ACCEPTED0.01 sdetails
#44ACCEPTED0.00 sdetails
#45ACCEPTED0.01 sdetails
#46ACCEPTED0.00 sdetails
#47ACCEPTED0.01 sdetails
#48ACCEPTED0.01 sdetails
#49ACCEPTED0.01 sdetails
#50ACCEPTED0.01 sdetails
#51ACCEPTED0.01 sdetails
#52ACCEPTED0.01 sdetails
#53ACCEPTED0.02 sdetails
#54ACCEPTED0.01 sdetails
#55ACCEPTED0.01 sdetails
#56ACCEPTED0.01 sdetails
#57ACCEPTED0.01 sdetails
#58ACCEPTED0.02 sdetails
#59ACCEPTED0.03 sdetails
#60ACCEPTED0.03 sdetails
#61ACCEPTED0.02 sdetails
#62ACCEPTED0.05 sdetails
#63ACCEPTED0.03 sdetails
#64ACCEPTED0.02 sdetails
#65ACCEPTED0.05 sdetails
#66ACCEPTED0.03 sdetails
#67ACCEPTED0.01 sdetails
#68ACCEPTED0.04 sdetails
#69ACCEPTED0.01 sdetails
#70ACCEPTED0.02 sdetails
#71ACCEPTED0.08 sdetails
#72ACCEPTED0.25 sdetails
#73ACCEPTED0.01 sdetails
#74ACCEPTED0.02 sdetails
#75ACCEPTED0.06 sdetails
#76ACCEPTED0.04 sdetails
#77ACCEPTED0.03 sdetails
#78ACCEPTED0.04 sdetails
#79ACCEPTED0.01 sdetails
#80ACCEPTED0.13 sdetails
#81ACCEPTED0.18 sdetails
#82ACCEPTED0.10 sdetails
#830.45 sdetails
#84ACCEPTED0.19 sdetails
#85ACCEPTED0.65 sdetails
#86ACCEPTED0.51 sdetails
#87ACCEPTED0.12 sdetails
#88ACCEPTED0.15 sdetails
#89ACCEPTED0.13 sdetails
#90ACCEPTED0.23 sdetails

Code

#include<algorithm>
#include <algorithm>
#include <iostream>
#include <queue>
#include <numeric>

#include <random>
#include <string>

#include <map>

#define M 998244353
typedef long long int ll;
using namespace std;




int F(string& s, int A, int B) {
    long long h = 0;
    for (char c : s) h = (h * A + c) % B;
    return h;
}

string generateRandomString(int length)
{
    // Define the list of possible characters
    const string CHARACTERS
        = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv"
          "wxyz0123456789";

    // Create a random number generator
    random_device rd;
    mt19937 generator(rd());

    // Create a distribution to uniformly select from all
    // characters
    uniform_int_distribution<> distribution(
        0, CHARACTERS.size() - 1);

    // Generate the random string
    string random_string;
    for (int i = 0; i < length; ++i) {
        random_string
            += CHARACTERS[distribution(generator)];
    }

    return random_string;
}

int main() {
    int A, B;
    cin >> A >> B;

    map<int, string> m;

    while(true) {

        string s = generateRandomString(10);
        int idx = F(s, A, B);
        if (m.find(idx) != m.end()) { cout << m[idx] << ' ' << s << endl; break; }
        else m.insert( {idx, s} );
    }
    
}

Test details

Test 1

Verdict: ACCEPTED

input
6 6

correct output
dxvdzxfqi oheo

user output
NSPbXcGjta vIZaEa4cBg

Test 2

Verdict: ACCEPTED

input
5 10

correct output
yzzzeszzyc uuhdakc

user output
SJDPxfYLLP OmZKt59Il2

Test 3

Verdict: ACCEPTED

input
5 2

correct output
oheo yzzzeszzyc

user output
N0njmbSa3B SJ2jd3soOM

Test 4

Verdict: ACCEPTED

input
6 1

correct output
dxvdzxfqi oheo

user output
pf9ihIIzMv Hd1ya5u6em

Test 5

Verdict: ACCEPTED

input
10 10

correct output
yzzzeszzyc uuhdakc

user output
e44emmRNpL oHPui9ySXt

Test 6

Verdict: ACCEPTED

input
3 1

correct output
dxvdzxfqi oheo

user output
O96tZxJE59 IzD70WWkVf

Test 7

Verdict: ACCEPTED

input
9 10

correct output
oheo yzzzeszzyc

user output
3yMTFSiGuw e8DsS9B6qC

Test 8

Verdict: ACCEPTED

input
1 3

correct output
dxvdzxfqi oheo

user output
i0m4QWERh1 UANQPcHc04

Test 9

Verdict: ACCEPTED

input
9 1

correct output
dxvdzxfqi oheo

user output
Lj0ECl0OMP 8C1hDfbJsJ

Test 10

Verdict: ACCEPTED

input
1 4

correct output
oheo yzzzeszzyc

user output
v3mS9wyR3s kVdXPhXJdK

Test 11

Verdict: ACCEPTED

input
78 30

correct output
dxvdzxfqi uuhdakc

user output
VMsD9FObY5 LsvwoiPLFe

Test 12

Verdict: ACCEPTED

input
19 7

correct output
dxvdzxfqi uuhdakc

user output
LGT5ZeO5CF ug2yTmUYFt

Test 13

Verdict: ACCEPTED

input
16 45

correct output
yrrkt aihwbdczv

user output
8s6Ie988Lt lfb9Mf1xV3

Test 14

Verdict: ACCEPTED

input
78 61

correct output
oedtdfgv zgivhgayf

user output
BI6VdqZLnM z7m36DQNqX

Test 15

Verdict: ACCEPTED

input
52 93

correct output
yzzzeszzyc uuhdakc

user output
3YTgvML7WA 0Nv7BVOFZU

Test 16

Verdict: ACCEPTED

input
85 82

correct output
dxvdzxfqi onbkb

user output
mWWa00XNxF 37DJCkRf1M

Test 17

Verdict: ACCEPTED

input
23 33

correct output
yzzzeszzyc aekmllmqu

user output
zFfkOevq4g frxw82vVvj

Test 18

Verdict: ACCEPTED

input
30 19

correct output
oheo jftb

user output
nlq7OOs99c sUXpvkq2Kj

Test 19

Verdict: ACCEPTED

input
66 8

correct output
yzzzeszzyc uuhdakc

user output
DEJMJ21tfh jdW91nXr6P

Test 20

Verdict: ACCEPTED

input
10 44

correct output
uuhdakc gvnyskxly

user output
V52Fe34fys YPw4bguQQg

Test 21

Verdict: ACCEPTED

input
589 888

correct output
irnrs nvmno

user output
4nxYBdf5Hk 5mxaNsd7sM

Test 22

Verdict: ACCEPTED

input
49 800

correct output
irnrs nvmno

user output
PqLGa14CZQ oTojfATZ43

Test 23

Verdict: ACCEPTED

input
209 702

correct output
yzzzeszzyc bpuse

user output
D4rKh1jgbE 7gNV4cPQxT

Test 24

Verdict: ACCEPTED

input
518 670

correct output
nvmno mgmo

user output
TL0GNlQYbz x3nsmOnJk2

Test 25

Verdict: ACCEPTED

input
961 295

correct output
aekmllmqu wcpqoadrw

user output
5JoSgfExKK MMsPfUiWNr

Test 26

Verdict: ACCEPTED

input
871 697

correct output
xfwgyq eokm

user output
fQb8sU38cp VqTc64WDXQ

Test 27

Verdict: ACCEPTED

input
308 714

correct output
nvmno lcwlpcmzza

user output
Vl1qmCQdYO c3Z73ujxy3

Test 28

Verdict: ACCEPTED

input
426 481

correct output
onbkb kqupmfo

user output
qHyxpqMqdc ed8i2wda17

Test 29

Verdict: ACCEPTED

input
730 171

correct output
eqdlmuyo wpvfat

user output
U86ympH8d4 mbTrz21tii

Test 30

Verdict: ACCEPTED

input
864 801

correct output
wpvfat onbkb

user output
4kkYi7XdaA 2E2GbQgUtw

Test 31

Verdict: ACCEPTED

input
6442 9170

correct output
wgqgje blui

user output
Oft0uxODpG k6tXYqKxHU

Test 32

Verdict: ACCEPTED

input
2861 290

correct output
wpvfat onbkb

user output
A0dlNdVN2b k1iZ0ubePj

Test 33

Verdict: ACCEPTED

input
8589 597

correct output
oheo uuhdakc

user output
WbVz6RnPxu rH5DmYEvRl

Test 34

Verdict: ACCEPTED

input
2486 6897

correct output
zlscxfnxo ngvkz

user output
EhOI61fPxC G4FOPWr9Fd

Test 35

Verdict: ACCEPTED

input
386 1958

correct output
vdihr miezzgst

user output
jho6cZqOBR oW9bVM6ZDB

Test 36

Verdict: ACCEPTED

input
4581 4498

correct output
uxqojd rhvuifulrn

user output
HXoRqCaQtx cL9a33Wmc5

Test 37

Verdict: ACCEPTED

input
7286 877

correct output
irnrs iphgzlf

user output
6BJvjA0aAO FgUXijbKag

Test 38

Verdict: ACCEPTED

input
9445 1393

correct output
hdwsfcnq veukbhkw

user output
MvMPnlZCel Wno95PKKX8

Test 39

Verdict: ACCEPTED

input
3848 8971

correct output
xshrtktoj fcuzyfii

user output
AxDwpQOAvi VffOp1HrTR

Test 40

Verdict: ACCEPTED

input
5469 57

correct output
dxvdzxfqi yzzzeszzyc

user output
ry7LPsfCVC r7gaik0C8s

Test 41

Verdict: ACCEPTED

input
40770 64402

correct output
tced hbmnyt

user output
ZlEpX5tyS3 umtX2SnaLA

Test 42

Verdict: ACCEPTED

input
25093 68059

correct output
ljrc wjxknzhykr

user output
yjpMrENDfY wUxgrFwn5M

Test 43

Verdict: ACCEPTED

input
37455 79656

correct output
tppoycpya wviirv

user output
0NRGtTvkSY uOPjEZRh3J

Test 44

Verdict: ACCEPTED

input
11506 49687

correct output
xaupctgiid jcdd

user output
9qQMHi6TF5 mrvLS87iE5

Test 45

Verdict: ACCEPTED

input
83486 43255

correct output
bodw cdmncijoh

user output
CIEuZe4T8c 12LZYQR1wg

Test 46

Verdict: ACCEPTED

input
98903 30455

correct output
xshrtktoj pofnegkmkq

user output
oWxMg8HWT5 POdHkhQpiX

Test 47

Verdict: ACCEPTED

input
78385 25806

correct output
fnyjzygwa zyfhqqpkk

user output
HG5FUhJkh1 EfOqBwUSra

Test 48

Verdict: ACCEPTED

input
11350 85178

correct output
tsgztkzvwc rkra

user output
sqTkxuoGkQ DeO1BWfIAy

Test 49

Verdict: ACCEPTED

input
1750 42650

correct output
rlmle czxwmutnse

user output
FQhlvPwl6A cHqMVILA6A

Test 50

Verdict: ACCEPTED

input
30097 47375

correct output
zlscxfnxo ayfmd

user output
HeZy7DgPyI 9ulDAuNvs8

Test 51

Verdict: ACCEPTED

input
494714 129204

correct output
czxwmutnse hudvk

user output
OSk7jjUy9E PxCvZDEJiI

Test 52

Verdict: ACCEPTED

input
675884 327185

correct output
rlmle rejxztcu

user output
zHLXVxuKAV Ibx5TL2sUd

Test 53

Verdict: ACCEPTED

input
823296 823560

correct output
ratyx aurscmksx

user output
2vld0Hj5T8 7xN0bBMsp8

Test 54

Verdict: ACCEPTED

input
846854 678908

correct output
rfpuucjk yjndrg

user output
5EGizW1liG TqFqfL30Nq

Test 55

Verdict: ACCEPTED

input
420278 193978

correct output
begabk sqac

user output
fPNe6Xjxce knIFIUxKxA

Test 56

Verdict: ACCEPTED

input
93130 695227

correct output
nkomreccwl dfboyzq

user output
kU6brIg5pV zDXpj1jzsZ

Test 57

Verdict: ACCEPTED

input
984414 95962

correct output
plsmw rufywewnbq

user output
WdiQWuVqPQ OaGy3mt6Uq

Test 58

Verdict: ACCEPTED

input
87370 612080

correct output
psmbxgyf yzwvwyf

user output
nPwDrimrLK xirNHRb2ts

Test 59

Verdict: ACCEPTED

input
365188 833610

correct output
jbbjpkxs asruylwnc

user output
QlBZQi4AL9 DPwgd89qrC

Test 60

Verdict: ACCEPTED

input
924244 804799

correct output
bxok beqs

user output
gPDw9tyUCI ZzoN4uiFvl

Test 61

Verdict: ACCEPTED

input
3012218 7755483

correct output
rzhfdn bhig

user output
Ao2x3BvbeW wjlshIOtqf

Test 62

Verdict: ACCEPTED

input
8254242 8634301

correct output
gleo mavrtxor

user output
DJBUGz9iQU yD9VNDkdz0

Test 63

Verdict: ACCEPTED

input
337938 5429289

correct output
hexlssw zxdfne

user output
Lcb1rVf6cp 6LxgY4Y331

Test 64

Verdict: ACCEPTED

input
5545825 4865884

correct output
copwroka xebbxy

user output
wxDASiQ0Mq OAakKL5PEb

Test 65

Verdict: ACCEPTED

input
3795375 7727646

correct output
rgde yqleban

user output
FqdBTUkOM4 Q4kup5u5KR

Test 66

Verdict: ACCEPTED

input
2188983 8702106

correct output
zmjbhiiqo gyrickzf

user output
EaddTKr6S1 qfSY229UP4

Test 67

Verdict: ACCEPTED

input
1544663 1956286

correct output
lwvsjair peplyj

user output
XykegPGqXK z34vFCx5mi

Test 68

Verdict: ACCEPTED

input
5464835 7522941

correct output
wjctw wqbqsqcdqg

user output
EI4GBVksNb sumqj7H3DR

Test 69

Verdict: ACCEPTED

input
2596718 4049688

correct output
nvyasakcug bsbyew

user output
kscN47gZ1k KMpe44Uk0U

Test 70

Verdict: ACCEPTED

input
2965922 4020437

correct output
zthes oazfss

user output
DJGCptvUaI btBhYPzNiI

Test 71

Verdict: ACCEPTED

input
56122287 60624959

correct output
hgllxkyp oukmzblohw

user output
878sXmLnz6 EDW1oOovi0

Test 72

Verdict: ACCEPTED

input
42645140 73661194

correct output
xkdotul jvryawmaj

user output
MCxrSrd0Vd SBa71KcfZX

Test 73

Verdict: ACCEPTED

input
44585330 18926703

correct output
yqmfko hogdxzgt

user output
zFs2YZsayA d6Zy6nLmQN

Test 74

Verdict: ACCEPTED

input
56325214 7232406

correct output
wvmuumpi weyyifgfw

user output
EKLHWamHvD BqsgTRrpk4

Test 75

Verdict: ACCEPTED

input
98889561 92098565

correct output
xcesn xvzzheobbo

user output
YBOCzMWKXx uCeyB1duTD

Test 76

Verdict: ACCEPTED

input
22701272 5642782

correct output
lescyxpmpw hkszwirdqk

user output
reClkDTKao 8qnyhFHI6Q

Test 77

Verdict: ACCEPTED

input
91304885 96889971

correct output
rnve dxgzxms

user output
xdvkuq6N4u HdvnWVxBb7

Test 78

Verdict: ACCEPTED

input
7803372 23247950

correct output
aofeuxbryn bgcepuzv

user output
ytxmiCI5Lf uFNlqCdiRJ

Test 79

Verdict: ACCEPTED

input
89317875 1136575

correct output
kfdzbbelk esohyirdk

user output
m02UIx6WGV byCqkL6fUV

Test 80

Verdict: ACCEPTED

input
1060874 37270195

correct output
pkkvrpnjgw aoljv

user output
2H0YDxdKvN qARv4PWsHX

Test 81

Verdict: ACCEPTED

input
828199235 320792352

correct output
cmqjomgda cyptxxyb

user output
IimgAqfVbk HiJgVlG05w

Test 82

Verdict: ACCEPTED

input
193563111 73343920

correct output
gtswukro ziuzhijy

user output
LfCJrLi6Qk iiql1bwYNz

Test 83

Verdict:

input
165531091 479126951

correct output
ozbczatbfr nplek

user output
cFnhvRv8B7 cFnhvRv8B7

Test 84

Verdict: ACCEPTED

input
835051605 652127789

correct output
ypkbe jvzy

user output
csy9nFPPhe NEpiloXegd

Test 85

Verdict: ACCEPTED

input
551842459 989875543

correct output
ajtuqsqbs tqboquks

user output
WnxDHzxESJ aHJB0wGbJS

Test 86

Verdict: ACCEPTED

input
911411059 873575358

correct output
bhhhipl bcgsdgu

user output
EO6ikArhoV sLb2rhiBeA

Test 87

Verdict: ACCEPTED

input
239756971 350744380

correct output
gddvcp osie

user output
ctGCrBUlB9 PtblyOtBqR

Test 88

Verdict: ACCEPTED

input
316394140 195182397

correct output
jthyube jxvfzsh

user output
4jdctGgD5A jQxctG6AF6

Test 89

Verdict: ACCEPTED

input
698334027 81615941

correct output
ikrcixfxr ugacbxbd

user output
6RjVe7Nj74 IhsRUhx9RW

Test 90

Verdict: ACCEPTED

input
104725912 462211740

correct output
alzppvu qlyi

user output
4QJ02cWDmM 8ugx4GaOIU