| Task: | Judge correctness |
| Sender: | Barely Div 1 |
| Submission time: | 2016-05-28 13:13:15 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.07 s | details |
| #2 | ACCEPTED | 1.82 s | details |
| #3 | RUNTIME ERROR | 1.22 s | details |
| #4 | RUNTIME ERROR | 1.45 s | details |
| #5 | RUNTIME ERROR | 1.45 s | details |
| #6 | RUNTIME ERROR | 1.45 s | details |
| #7 | RUNTIME ERROR | 1.45 s | details |
| #8 | RUNTIME ERROR | 1.45 s | details |
| #9 | RUNTIME ERROR | 1.45 s | details |
| #10 | RUNTIME ERROR | 1.45 s | details |
Compiler report
input/code.cpp: In function 'void printmat(std::vector<std::vector<long int> >)':
input/code.cpp:25:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < M.size(); i++){
^
input/code.cpp:26:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j = 0; j < M.size(); j++){
^
input/code.cpp: In function 'std::vector<std::vector<long int> > read_matrix(LL)':
input/code.cpp:37:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j = 0; j < s.size(); j++){
^Code
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <utility>
using namespace std;
typedef int64_t LL;
vector<LL> matmul(vector<vector<LL> > M, vector<LL> v){
int n = v.size();
vector<LL> ans(n);
for(int i = 0; i < n; i++){
LL x = 0;
for(int j = 0; j < n; j++){
x += M[i][j] * v[j];
}
ans[i] = x % 64;
}
return ans;
}
void printmat(vector<vector<LL> > M){
for(int i = 0; i < M.size(); i++){
for(int j = 0; j < M.size(); j++){
cout << M[i][j] << " ";
}
cout << endl;
}
}
vector<vector<LL> > read_matrix(LL n){
vector<vector<LL> > M(n, vector<LL>(n));
for(int i = 0; i < n; i++){
string s; cin >> s;
for(int j = 0; j < s.size(); j++){
LL x = 0;
if(s[j] >= 'A' && s[j] <= 'Z') x = s[j] - 'A';
if(s[j] >= 'a' && s[j] <= 'z') x = s[j] - 'a' + 26;
if(s[j] >= '0' && s[j] <= '9') x = s[j] - '0' + 52;
if(s[j] == '+') x = 62;
if(s[j] == '/') x = 63;
M[i][j] = x;
}
}
return M;
}
void solve(){
LL n; cin >> n;
auto A = read_matrix(n);
auto X = read_matrix(n);
vector<vector<LL> > A_T(n, vector<LL>(n)); // transpose
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
A_T[i][j] = A[j][i];
}
}
//printmat(A); printmat(A_T); printmat(X);
for(int test = 0; test < 10; test++){
vector<LL> v;
for(int i = 0; i < n; i++){
v.push_back(rand() % 64);
}
vector<LL> Xv = matmul(X,v);
vector<LL> AA_Tv = matmul(A, matmul(A_T,v));
if(Xv != AA_Tv){
cout << 0 << "\n";
return;
}
}
cout << 1 << "\n";
}
int main(){
srand(345348345);
LL t; cin >> t;
while(t--) solve();
}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: ACCEPTED
| input |
|---|
| 3 666 OvHf9jpB0RViia/ZD3gRQ7o1FELYh3... |
| correct output |
|---|
| 0 0 1 |
| user output |
|---|
| 0 0 1 |
Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| 2 517 RWVknnH+hL6AfeKFbOu6OuAJL9dvLw... |
| correct output |
|---|
| 0 1 |
| user output |
|---|
| 0 |
Test 4
Verdict: RUNTIME ERROR
| input |
|---|
| 1 5000 QP9pS1MOq6eDDKGQh//TrJUIvbM53a... |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Test 5
Verdict: RUNTIME ERROR
| input |
|---|
| 1 5000 RSX7ZuQE6A94s8s+9oP1uCDHRkmZ+7... |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Test 6
Verdict: RUNTIME ERROR
| input |
|---|
| 1 5000 b0V0j4vQ8CeiJrcUk2yssPF1B9EEDb... |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| 1 5000 VLdpW71f4Cdr+xdCRlwmAnNfMjqwMU... |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| 1 5000 kBZaGETPWmyNR4NCvCPbJnvq2+JBfP... |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| 1 5000 PES9AhJn+FZBVO5gqRLYbavSvaDUfU... |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| 1 5000 EoXwgdrAtKtV4M7jn0jAkNwkJX+be9... |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
