Task: | Judge correctness |
Sender: | Barely Div 1 |
Submission time: | 2016-05-28 15:28:04 +0300 |
Language: | C++ |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 1.33 s | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
#4 | ACCEPTED | 3.00 s | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
#7 | ACCEPTED | 2.99 s | details |
#8 | TIME LIMIT EXCEEDED | -- | details |
#9 | TIME LIMIT EXCEEDED | -- | details |
#10 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <vector> #include <iostream> #include <string> using namespace std; int getnum(char c) { if (c >= 'A' && c <= 'Z') return c - 'A'; if (c >= 'a' && c <= 'z') return c - 'a' + 26; if (c >= '0' && c <= '9') return c - '0' + 52; if (c == '+') return 62; return 63; } bool test(vector<vector<char>> & m, vector<vector<char>> & m_t, vector<vector<char>> & ans, vector<int> & r) { int n = m.size(); vector<long long> check1(n); vector<long long> check2(n); for (int row = 0; row < n; row++) { for (int col = 0; col < n; col++) { check1[row] += r[col]*m_t[row][col]; } check1[row] %= 64; } vector<long long> tmpr = check1; for (int row = 0; row < n; row++) { check1[row] = 0; for (int col = 0; col < n; col++) { check1[row] += tmpr[col]*m[row][col]; } check1[row] %= 64; } for (int row = 0; row < n; row++) { for (int col = 0; col < n; col++) { check2[row] += r[col]*ans[row][col]; } check2[row] %= 64; } return check1 == check2; } int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<vector<char>> m(n); vector<vector<char>> ans(n); int ntmp = n; int idx = 0; while (ntmp--) { string s; cin >> s; for (auto c : s) { m[idx].push_back(getnum(c)); } idx++; } ntmp = n; idx = 0; while (ntmp--) { string s; cin >> s; for (auto c : s) { ans[idx].push_back(getnum(c)); } idx++; } vector<vector<char>> m_t(n, vector<char>(n)); for (int row = 0; row < n; row++) { for (int col = 0; col < n; col++) { m_t[col][row] = m[row][col]; } } bool printed = false; for (int testn = 0; testn < 10; testn++) { vector<int> r(n); for (int i = 0; i < n; i++) { r[i] = rand() % 64; } if (!test(m, m_t, ans, r)) { cout << "0" << "\n"; printed = true; break; } } if (!printed) cout << "1" << "\n"; } }
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: TIME LIMIT EXCEEDED
input |
---|
2 517 RWVknnH+hL6AfeKFbOu6OuAJL9dvLw... |
correct output |
---|
0 1 |
user output |
---|
(empty) |
Test 4
Verdict: ACCEPTED
input |
---|
1 5000 QP9pS1MOq6eDDKGQh//TrJUIvbM53a... |
correct output |
---|
0 |
user output |
---|
0 |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
1 5000 RSX7ZuQE6A94s8s+9oP1uCDHRkmZ+7... |
correct output |
---|
1 |
user output |
---|
(empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
1 5000 b0V0j4vQ8CeiJrcUk2yssPF1B9EEDb... |
correct output |
---|
1 |
user output |
---|
(empty) |
Test 7
Verdict: ACCEPTED
input |
---|
1 5000 VLdpW71f4Cdr+xdCRlwmAnNfMjqwMU... |
correct output |
---|
0 |
user output |
---|
0 |
Test 8
Verdict: TIME LIMIT EXCEEDED
input |
---|
1 5000 kBZaGETPWmyNR4NCvCPbJnvq2+JBfP... |
correct output |
---|
0 |
user output |
---|
(empty) |
Test 9
Verdict: TIME LIMIT EXCEEDED
input |
---|
1 5000 PES9AhJn+FZBVO5gqRLYbavSvaDUfU... |
correct output |
---|
0 |
user output |
---|
(empty) |
Test 10
Verdict: TIME LIMIT EXCEEDED
input |
---|
1 5000 EoXwgdrAtKtV4M7jn0jAkNwkJX+be9... |
correct output |
---|
1 |
user output |
---|
(empty) |