| Task: | Ruudukko |
| Sender: | aki |
| Submission time: | 2019-10-03 11:27:16 +0300 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.01 s | details |
| #2 | WRONG ANSWER | 0.01 s | details |
| #3 | WRONG ANSWER | 0.01 s | details |
| #4 | WRONG ANSWER | 0.01 s | details |
| #5 | WRONG ANSWER | 0.01 s | details |
| #6 | WRONG ANSWER | 0.01 s | details |
Code
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
inline int onko_harmoniset(const std::string& str0, const std::string& str1)
{
if(str0.length() != str1.length()) return 0;
unsigned char map_0[26], map_1[26];
for(int i = 0; i < 26; i++)
{
map_0[i] = 0;
map_1[i] = 0;
}
const char* str0_r = str0.c_str();
const char* str1_r = str1.c_str();
for(unsigned int i = 0; i < str0.length(); i++)
{
const unsigned char a = (str0_r[i] & 0b111111);
const unsigned char b = (str1_r[i] & 0b111111);
if((map_0[a] == 0) && (map_1[b] == 0))
{
map_0[a] = b;
map_1[b] = a;
}
else
{
if((map_0[a] != b) || (map_1[b] != a))
{
return 0;
}
}
}
return 1;
}
int main()
{
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
int n;
std::cin >> n;
std::vector<std::string> mjt;
mjt.resize(n);
for(int i = 0; i < n; i++)
{
std::cin >> mjt[i];
}
int hn = 0;
for(unsigned int i0 = 0; i0 < mjt.size(); i0++)
{
for(unsigned int i1 = i0 + 1; i1 < mjt.size(); i1++)
{
hn += onko_harmoniset(mjt[i0], mjt[i1]);
}
}
std::cout << hn;
return 0;
}Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 0 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 2 |
| correct output |
|---|
| 1 2 2 1 |
| user output |
|---|
| 1 |
Test 3
Verdict: WRONG ANSWER
| 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: WRONG ANSWER
| input |
|---|
| 42 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 861 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 99 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 4851 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 100 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 4950 |
