Task: | Judge correctness |
Sender: | asdf |
Submission time: | 2024-09-28 16:58:21 +0300 |
Language: | C++ (C++20) |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.02 s | details |
#2 | ACCEPTED | 1.33 s | details |
#3 | ACCEPTED | 2.74 s | details |
#4 | ACCEPTED | 2.10 s | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
#7 | ACCEPTED | 2.09 s | details |
#8 | ACCEPTED | 2.09 s | details |
#9 | ACCEPTED | 2.30 s | details |
#10 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <bits/stdc++.h> using namespace std; using type = unsigned short; unsigned short mul[64][64]; struct Matrix { vector <vector <type> > data; int row() const { return data.size(); } int col() const { return data[0].size(); } auto & operator [] (int i) { return data[i]; } const auto & operator[] (int i) const { return data[i]; } Matrix() = default; Matrix(int r, int c): data(r, vector <type> (c)) { } Matrix(const vector <vector <type> > &d): data(d) {} friend ostream & operator << (ostream &out, const Matrix &d) { for (auto x : d.data) { for (auto y : x) out << y << ' '; out << '\n'; } return out; } Matrix operator - (const Matrix &b) { Matrix a = *this; // assert(a.col() == b.col()); // assert(a.row() == b.row()); Matrix c(a.row(), a.col()); for (int i = 0; i < a.row(); i++) { for (int j = 0; j < a.col(); j++) { c[i][j] = (a[i][j] - b[i][j] + 64) % 64; } } return c; } Matrix operator * (const Matrix &b) { Matrix a = *this; // assert(a.col() == b.row()); Matrix c(a.row(), b.col()); for (int i = 0; i < a.row(); ++i) for (int j = 0; j < b.col(); ++j) for (int k = 0; k < a.col(); ++k) { c[i][j] += mul[a[i][k]][b[k][j]]; c[i][j] %= 64; } return c; } }; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int Rand(int l, int r) { return l + rng() % (r - l + 1); } unsigned short decode(char c) { if (isupper(c)) return c - 'A'; if (islower(c)) return 26 + c - 'a'; if (isdigit(c)) return 52 + c - '0'; if (c == '+') return 62; return 63; } void solve() { int n; cin >> n; Matrix a(n, n), at(n, n), x(n, n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { char c; cin >> c; a[i][j] = decode(c); at[j][i] = decode(c); } } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { char c; cin >> c; x[i][j] = decode(c); } } // cout << a << '\n'; // cout << at << '\n'; // cout << (a * at) << '\n'; // cout << x << '\n'; int ite = 8; bool correct = true; while (ite--) { Matrix v(n, 1); for (int i = 0; i < n; i++) v[i][0] = Rand(0, 1); Matrix p = (a * (at * v)) - (x * v); for (int i = 0; i < n; i++) { if (p[i][0]) { correct = false; break; } } if (!correct) break; } cout << correct << '\n'; } signed main() { cin.tie(0)->sync_with_stdio(0); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { mul[i][j] = (i * j) % 64; } } int 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 ... Truncated |
Test 2
Verdict: ACCEPTED
input |
---|
3 666 OvHf9jpB0RViia/ZD3gRQ7o1FELYh3... |
correct output |
---|
0 0 1 |
user output |
---|
0 0 1 |
Test 3
Verdict: ACCEPTED
input |
---|
2 517 RWVknnH+hL6AfeKFbOu6OuAJL9dvLw... |
correct output |
---|
0 1 |
user output |
---|
0 1 |
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: ACCEPTED
input |
---|
1 5000 kBZaGETPWmyNR4NCvCPbJnvq2+JBfP... |
correct output |
---|
0 |
user output |
---|
0 |
Test 9
Verdict: ACCEPTED
input |
---|
1 5000 PES9AhJn+FZBVO5gqRLYbavSvaDUfU... |
correct output |
---|
0 |
user output |
---|
0 |
Test 10
Verdict: TIME LIMIT EXCEEDED
input |
---|
1 5000 EoXwgdrAtKtV4M7jn0jAkNwkJX+be9... |
correct output |
---|
1 |
user output |
---|
(empty) |