CSES - Datatähti 2020 alku - Results
Submission details
Task:Ruudukko
Sender:Microwave Abuser
Submission time:2019-10-01 22:28:48 +0300
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.01 sdetails
#20.01 sdetails
#30.01 sdetails
#40.01 sdetails
#50.01 sdetails
#60.01 sdetails

Code

//g++ -std=c++11 -O2 -Wall microwave.cpp -o microwave
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
//COMMENCE CODE
int n;
cin >> n; //N = AMOUNT OF JONOJA
string gayarray [n+1];
//char aakkoset [27] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
for(int jono = 1; jono <= n; jono++)
{
cin >> gayarray[jono];
}
//INPUT COLLECTED, LETS DO STUFF
for(int jono = 1; jono <= n; jono++) //Jokaiselle jonolle
{
string cipher [2]; //0:plain, 1:cipher
cipher[1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //Eka plain = a, toka = b...
int nextPlain = 0;
bool found;
for(unsigned int paikka = 0; gayarray[jono][paikka] != '\0'; paikka++) //jokaiselle paikalle [!]RISKI ;-;
{
found = false;
for(int r = 0; r < nextPlain; r++)
{
if(cipher[0][r] == gayarray[jono][paikka]) //Jos kirjanin on cipheris
{
gayarray[jono][paikka] = cipher[1][r];
found = true;
break;
}
}
if(!found) //Jos ei ole cipheris, adaa se
{
cipher[0][nextPlain] = gayarray[jono][paikka];
//adattu, vaihda viel nykyne kirjain
gayarray[jono][paikka] = cipher[1][nextPlain];
nextPlain++;
}
}
}
//JONOT REKONSTRUOITU, COMMENCE VERTAILU
int count = 0;
for(int vertaaja = 1; vertaaja <= n; vertaaja++)
{
for(int verrattava = vertaaja + 1; verrattava <= n; verrattava++)
{
if(gayarray[vertaaja] == gayarray[verrattava])
{
count++;
}
}
}
cout << count;
}

Test details

Test 1

Verdict:

input
1

correct output

user output
0

Test 2

Verdict:

input
2

correct output
1 2 
2 1 

user output
1

Test 3

Verdict:

input
5

correct output
1 2 3 4 5 
2 1 4 3 6 
3 4 1 2 7 
4 3 2 1 8 
5 6 7 8 1 

user output
10

Test 4

Verdict:

input
42

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
861

Test 5

Verdict:

input
99

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
4851

Test 6

Verdict:

input
100

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
4950