CSES - Datatähti 2020 alku - Results
Submission details
Task:Merkkijonot
Sender:Juho
Submission time:2019-10-04 08:50:02 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.01 s1, 2, 3details
#20.11 s2, 3details
#30.56 s3details
#40.14 s3details
#50.03 s3details
#60.01 s1, 2, 3details
#70.01 s1, 2, 3details
#80.01 s1, 2, 3details
#90.01 s1, 2, 3details
#100.20 s2, 3details
#110.20 s2, 3details
#120.20 s2, 3details
#130.19 s2, 3details
#140.20 s2, 3details
#150.88 s3details
#160.88 s3details
#170.88 s3details
#180.88 s3details
#190.88 s3details
#200.01 s1, 2, 3details
#210.01 s1, 2, 3details
#220.01 s1, 2, 3details
#230.01 s1, 2, 3details
#240.01 s1, 2, 3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:15:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(short j=0;j<x.size();j++){
                       ~^~~~~~~~~
input/code.cpp:24:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<v.size();j++){
                     ~^~~~~~~~~
input/code.cpp:37:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<u.size();i++){
                 ~^~~~~~~~~

Code

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n = 50000;
    vector<long long>v;
    vector<long long>u;
    
    for(int i=0;i<n;i++){
        string x;
        cin>>x;
        unordered_map<char,char>m;
        char muisti='A';
        long long y=0;
        long long potenssi =1;
        for(short j=0;j<x.size();j++){
            if(!(m.count(x[j]))){
                m[x[j]]=muisti;
                muisti++;
            }
            y = (y+potenssi*(long long)m[x[j]])%1833728171113LL;
            potenssi = (potenssi*281)%1833728171113LL;
        }
        bool totuus = true;
        for(int j=0;j<v.size();j++){
            if(v[j]==y){
                totuus=false;
                u[j]++;
                break;
            }
        }
        if(totuus){
            v.push_back(y);
            u.push_back(1);
        }
    }
    long long s = 0;
    for(int i=0;i<u.size();i++){
        s += u[i]*(u[i]-1)/2;
    }
    cout<<s;
}

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
20
FFDISOVJLPIASANJRBHQXJVW
HBGVRZFWOTAAVUPYKMKXAOBEYUE
JKHXTPHUKTLTLNXMXMSYYFLF
HCSZMXTZCUFHIHSTEWKHCFZRTXU
...

correct output
20

user output
1248925251

Test 2

Group: 2, 3

Verdict:

input
5000
AJEDROEDXRGDUSDAPZBXXQBPJ
PDGCTAGCRTBCJICPFELRRMLFD
TISAOTGMDKUCITIEFQVCSBZJYUUO
FMASVJYFPMELSVLQWFZVLVMSPHYL
...

correct output
2178556

user output
1014611057

Test 3

Group: 3

Verdict:

input
100000
RESKYADLVRSDCDXJVECAJCAP
CZLIWDHKVNRJHZINHFBOQEPN
LSTRSDTLADUIWXFQJSQPVRSPBCTZ
QEMSZOQSSVBRNQTCLJQIGVQO
...

correct output
404880850

user output
101489268

Test 4

Group: 3

Verdict:

input
100000
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4999950000

user output
1249925001

Test 5

Group: 3

Verdict:

input
100000
IPI
Q
SPGV
UNYE
...

correct output
1041990627

user output
260310456

Test 6

Group: 1, 2, 3

Verdict:

input
20
A
B
C
D
...

correct output
190

user output
1248925421

Test 7

Group: 1, 2, 3

Verdict:

input
1
A

correct output
0

user output
1249875004

Test 8

Group: 1, 2, 3

Verdict:

input
20
A
BB
CCC
DDDD
...

correct output
0

user output
1248925231

Test 9

Group: 1, 2, 3

Verdict:

input
2
A
A

correct output
1

user output
1249825009

Test 10

Group: 2, 3

Verdict:

input
5000
SEKNHNRHSRFYIHSCDPGXPTGUSYBFKZ...

correct output
20861

user output
1012453362

Test 11

Group: 2, 3

Verdict:

input
5000
UGPWHWOWAREEIROZTRJGUCKDKTZJEO...

correct output
22818

user output
1012455319

Test 12

Group: 2, 3

Verdict:

input
5000
FFQQCBCINBDWIKHFPO
SCJU
DNHYPGIQNZS
KNQCYRAXHHKORXMOVHL
...

correct output
22268

user output
1012454769

Test 13

Group: 2, 3

Verdict:

input
5000
QVWMSYPWXWBBXWCVEOUAVQLDWNBXZB...

correct output
22589

user output
1012455090

Test 14

Group: 2, 3

Verdict:

input
5000
JYORMNQAKXHNRBWGGSMWXWXMBKPBZU...

correct output
20482

user output
1012452984

Test 15

Group: 3

Verdict:

input
100000
DCXXVIEYQAASZJYUUVYZUIJFGVBAYC...

correct output
8925377

user output
2228267

Test 16

Group: 3

Verdict:

input
100000
IJZHBIYNWQBDWNGZWVXJKXXWFVLPQX...

correct output
8907840

user output
2260443

Test 17

Group: 3

Verdict:

input
100000
GWUGLGQDAYGGJROIAKBMMICQMDUQQQ...

correct output
8771809

user output
2223717

Test 18

Group: 3

Verdict:

input
100000
SWVSVXURRSLCSHCPAKWESIPCNDKYLD...

correct output
8704480

user output
2195343

Test 19

Group: 3

Verdict:

input
100000
ZLSNSZBGIMCOLPDEAKVDAJCTMBNRLH...

correct output
8672362

user output
2171756

Test 20

Group: 1, 2, 3

Verdict:

input
20
AAB
D
CDBAA
D
...

correct output
15

user output
1248925249

Test 21

Group: 1, 2, 3

Verdict:

input
20
A
CDD
AABBC
DBCB
...

correct output
15

user output
1248925248

Test 22

Group: 1, 2, 3

Verdict:

input
20
ACADD
CDDCD
DACA
CCDCA
...

correct output
17

user output
1248925250

Test 23

Group: 1, 2, 3

Verdict:

input
20
DCDA
BDBA
CACBD
BA
...

correct output
7

user output
1248925241

Test 24

Group: 1, 2, 3

Verdict:

input
20
DDA
BBCDC
DDD
CCD
...

correct output
14

user output
1248925245