Task: | Judge correctness |
Sender: | asdf |
Submission time: | 2024-09-28 16:01:51 +0300 |
Language: | C++ (C++20) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.02 s | details |
#2 | WRONG ANSWER | 0.88 s | details |
#3 | RUNTIME ERROR | 1.67 s | details |
#4 | RUNTIME ERROR | 0.20 s | details |
#5 | RUNTIME ERROR | 0.20 s | details |
#6 | RUNTIME ERROR | 0.20 s | details |
#7 | RUNTIME ERROR | 0.20 s | details |
#8 | RUNTIME ERROR | 0.20 s | details |
#9 | RUNTIME ERROR | 0.20 s | details |
#10 | RUNTIME ERROR | 0.20 s | details |
Compiler report
In file included from /usr/include/c++/11/cassert:44, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:33, from input/code.cpp:1: input/code.cpp: In constructor 'Matrix::Matrix(const std::vector<std::vector<int> >&)': input/code.cpp:79:47: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 79 | /**/ for (auto x : d) assert(x.size() == size); | ~~~~~~~~~^~~~~~~
Code
#include <bits/stdc++.h> using namespace std; // #define int long long string to_string(string s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename A> string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; } void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); } #ifdef LOCAL #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #else #define debug(...) 42 #endif using type = int; // Kiểu dữ liệu các phần tử của ma trận struct Matrix { vector <vector <type> > data; // Số lượng hàng của ma trận int row() const { return data.size(); } // Số lượng hàng của ma trận 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) { // Kiểm tra các hàng có cùng size không và size có lớn hơn 0 hay không // Tuy nhiên không thực sự cần thiết, ta có thể bỏ các dòng /**/ đi /**/ assert(d.size()); /**/ int size = d[0].size(); /**/ assert(size); /**/ for (auto x : d) assert(x.size() == size); } // In ra ma trận. friend ostream & operator << (ostream &out, const Matrix &d) { for (auto x : d.data) { for (auto y : x) out << y << ' '; out << '\n'; } return out; } // Ma trận đơn vị static Matrix identity(long long n) { Matrix a = Matrix(n, n); while (n--) a[n][n] = 1; return a; } // Nhân ma trận Matrix operator * (const Matrix &b) { Matrix a = *this; // Kiểm tra điều kiện nhân ma trận 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] += a[i][k] * b[k][j]; } return c; } // Lũy thừa ma trận Matrix pow(long long exp) { // Kiểm tra điều kiện lũy thừa ma trận (là ma trận vuông) assert(row() == col()); Matrix base = *this, ans = identity(row()); for (; exp > 0; exp >>= 1, base = base * base) if (exp & 1) ans = ans * base; return ans; } }; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int Rand(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); } const int N = 5005; int n; int 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() { 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); } } int ite = 6; bool correct = true; while (ite--) { Matrix v(n, 1); for (int i = 0; i < n; i++) v[i][0] = Rand(0, 1); Matrix lhs = (a * (at * v)); Matrix rhs = x * v; for (int i = 0; i < n; i++) { if ((lhs[i][0]) % 64 != (rhs[i][0] % 64)) { correct = false; break; } } if (!correct) break; } cout << correct << '\n'; } signed main() { cin.tie(0)->sync_with_stdio(0); int t; cin >> t; while (t--) { solve(); } }
Test details
Test 1
Verdict: WRONG ANSWER
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: WRONG ANSWER
input |
---|
3 666 OvHf9jpB0RViia/ZD3gRQ7o1FELYh3... |
correct output |
---|
0 0 1 |
user output |
---|
0 0 0 |
Test 3
Verdict: RUNTIME ERROR
input |
---|
2 517 RWVknnH+hL6AfeKFbOu6OuAJL9dvLw... |
correct output |
---|
0 1 |
user output |
---|
(empty) |
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) |