CSES - Practice Contest 2024 - Results
Submission details
Task:Judge correctness
Sender:asdf
Submission time:2024-09-28 15:33:21 +0300
Language:C++ (C++20)
Status:READY
Result:
Test results
testverdicttime
#10.01 sdetails
#20.77 sdetails
#31.50 sdetails
#41.24 sdetails
#51.25 sdetails
#61.25 sdetails
#71.25 sdetails
#81.24 sdetails
#91.25 sdetails
#101.25 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:50:20: warning: statement has no effect [-Wunused-value]
   50 | #define debug(...) 42
      |                    ^~
input/code.cpp:121:5: note: in expansion of macro 'debug'
  121 |     debug(S);
      |     ^~~~~

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

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;
string S;

int n;
int a[N][N], x[N][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; 
}

int pro(int i, int ii) {
    int sum = 0;
    for (int j = 1; j <= n; j++) {
        sum += a[i][j] * a[ii][j];
    }
    return sum % 64;
}

char encode(int x) {
    return S[x];
}

void solve() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            char c;
            cin >> c;
            a[i][j] = decode(c);
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            char c;
            cin >> c;
            x[i][j] = decode(c);
        }
    }

    int ite = 200;
    bool correct = true;
    while (ite--) {
        int i = Rand(1, n);
        int j = Rand(1, n);
        if (pro(i, j) != x[i][j]) {
            correct = false;
            break;
        }
    }

    cout << correct << '\n';
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);

    for (char c = 'A'; c <= 'Z'; c++) S += c;
    for (char c = 'a'; c <= 'z'; c++) S += c;
    for (char c = '0'; c <= '9'; c++) S += c;
    S += '+';
    S += '/';
    debug(S);

    int t;
    cin >> t;

    while (t--) {
        solve();
    }
}

Test details

Test 1

Verdict:

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

correct output
0
0
1
1
1
...

user output
1
0
1
1
1
...
Truncated

Test 2

Verdict:

input
3
666
OvHf9jpB0RViia/ZD3gRQ7o1FELYh3...

correct output
0
0
1

user output
1
1
1

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)