CSES - HIIT Open 2016 - Results
Submission details
Task:Judge correctness
Sender:Oispa Kaljaa
Submission time:2016-05-28 15:48:44 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.05 sdetails
#2--details
#3--details
#4--details
#5--details
#6--details
#7--details
#8--details
#9--details
#10--details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:13:9: warning: array subscript has type 'char' [-Wchar-subscripts]
     cn[c] = nyt;
         ^
input/code.cpp:18:9: warning: array subscript has type 'char' [-Wchar-subscripts]
     cn[c] = nyt;
         ^
input/code.cpp:23:9: warning: array subscript has type 'char' [-Wchar-subscripts]
     cn[c] = nyt;
         ^
input/code.cpp:46:19: warning: array subscript has type 'char' [-Wchar-subscripts]
    sum+=cn[a[i][k]]*cn[a[j][k]];
                   ^
input/code.cpp:46:31: warning: array subscript has type 'char' [-Wchar-subscripts]
    sum+=cn[a[i][k]]*cn[a[j][k]];
                               ^

Code

#include <bits/stdc++.h>
using namespace std;
string a[5050], x[5050];
int main(){
cin.sync_with_stdio(0);
cin.tie(0);
int cn[1010];
char nc[1010];
int nyt = 0;
for(char c = 'A'; c <= 'Z'; c++){
cn[c] = nyt;
nc[nyt] = c;
nyt++;
}
for(char c = 'a'; c <= 'z'; c++){
cn[c] = nyt;
nc[nyt] = c;
nyt++;
}
for(char c = '0'; c <= '9'; c++){
cn[c] = nyt;
nc[nyt] = c;
nyt++;
}
cn['+'] = nyt;
nc[nyt] = '+';
nyt++;
cn['/'] = nyt;
nc[nyt] = '/';
nyt++;
int tests; cin >> tests;
while(tests--){
int n; cin >> n;
for(int i = 0; i < n; i++)
cin >> a[i];
for(int i = 0; i < n; i++)
cin >> x[i];
bool ans = 1;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
int sum = 0;
for(int k = 0; k < n; k++){
sum+=cn[a[i][k]]*cn[a[j][k]];
}
sum%=nyt;
if(x[i][j] != nc[sum]){
ans = 0;
goto ohi;
}
}
}
ohi:
cout << ans << endl;
}
return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
500
12
N49lyQuAZh1l
PwNJA+wuTBr+
HO09lJg8kbup
...

correct output
0
0
1
1
1
...

user output
0
0
1
1
1
...

Test 2

Verdict:

input
3
666
OvHf9jpB0RViia/ZD3gRQ7o1FELYh3...

correct output
0
0
1

user output
(empty)

Test 3

Verdict:

input
2
517
RWVknnH+hL6AfeKFbOu6OuAJL9dvLw...

correct output
0
1

user output
(empty)

Test 4

Verdict:

input
1
5000
QP9pS1MOq6eDDKGQh//TrJUIvbM53a...

correct output
0

user output
(empty)

Test 5

Verdict:

input
1
5000
RSX7ZuQE6A94s8s+9oP1uCDHRkmZ+7...

correct output
1

user output
(empty)

Test 6

Verdict:

input
1
5000
b0V0j4vQ8CeiJrcUk2yssPF1B9EEDb...

correct output
1

user output
(empty)

Test 7

Verdict:

input
1
5000
VLdpW71f4Cdr+xdCRlwmAnNfMjqwMU...

correct output
0

user output
(empty)

Test 8

Verdict:

input
1
5000
kBZaGETPWmyNR4NCvCPbJnvq2+JBfP...

correct output
0

user output
(empty)

Test 9

Verdict:

input
1
5000
PES9AhJn+FZBVO5gqRLYbavSvaDUfU...

correct output
0

user output
(empty)

Test 10

Verdict:

input
1
5000
EoXwgdrAtKtV4M7jn0jAkNwkJX+be9...

correct output
1

user output
(empty)