(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #781990

#TimeUsernameProblemLanguageResultExecution timeMemory
781990t6twotwoAlice, Bob, and Circuit (APIO23_abc)C++17
36 / 100
267 ms91268 KiB
#include "abc.h" #include <bits/stdc++.h> using namespace std; // you may find the definitions useful const int OP_ZERO = 0; // f(OP_ZERO, x0, x1) = 0 const int OP_NOR = 1; // f(OP_NOR, x0, x1) = !(x0 || x1) const int OP_GREATER = 2; // f(OP_GREATER, x0, x1) = (x0 > x1) const int OP_NOT_X1 = 3; // f(OP_NOT_X1, x0, x1) = !x1 const int OP_LESS = 4; // f(OP_LESS, x0, x1) = (x0 < x1) const int OP_NOT_X0 = 5; // f(OP_NOT_X0, x0, x1) = !x0 const int OP_XOR = 6; // f(OP_XOR, x0, x1) = (x0 ^ x1) const int OP_NAND = 7; // f(OP_NAND, x0, x1) = !(x0 && x1) const int OP_AND = 8; // f(OP_AND, x0, x1) = (x0 && x1) const int OP_EQUAL = 9; // f(OP_EQUAL, x0, x1) = (x0 == x1) const int OP_X0 = 10; // f(OP_X0, x0, x1) = x0 const int OP_GEQ = 11; // f(OP_GEQ, x0, x1) = (x0 >= x1) const int OP_X1 = 12; // f(OP_X1, x0, x1) = x1 const int OP_LEQ = 13; // f(OP_LEQ, x0, x1) = (x0 <= x1) const int OP_OR = 14; // f(OP_OR, x0, x1) = (x0 || x1) const int OP_ONE = 15; // f(OP_ONE, x0, x1) = 1 const int mod = 65536; // Alice int // returns la alice( /* in */ const int N, /* in */ const char s[][5], /* in */ const unsigned short v[], /* out */ bool ans[] ) { ans[0] = 0; ans[1] = 1; vector<int> a(26); for (int i = 0; i < 26; i++) { a[s[i][0] - 'a'] = v[i]; } for (int i = 0; i < 26; i++) { for (int j = 0; j < 16; j++) { ans[i * 16 + j + 2] = a[i] >> j & 1; } } for (int i = 0; i < 26; i++) { for (int j = 0; j < 26; j++) { ans[418 + 26 * i + j] = s[i][0] - 'a' == j; } } return 1094; } // Bob int // returns lb bob( /* in */ const int M, /* in */ const char s[][5], /* in */ const char t[][5], /* out */ bool ans[] ) { for (int i = 0; i < M; i++) { for (int j = 0; j < 26; j++) { ans[52 * i + j] = s[i][0] - 'a' == j; } for (int j = 0; j < 26; j++) { ans[52 * i + 26 + j] = t[i][0] - 'a' == j; } } return 52 * M; } // Circuit int // returns l circuit( /* in */ const int n, /* in */ const int m, /* out */ int A[], /* out */ int B[][2], /* out */ int ans[][16] ) { int N = 26; int M = m / 52; int T = n + m; vector v(26, vector<int>(16)); for (int i = 0; i < M; i++) { vector<int> f(16); for (int j = 0; j < 16; j++) { vector<int> g(26); for (int k = 0; k < 26; k++) { g[k] = T; A[T] = 8; B[T][0] = 16 * k + j + 2; B[T][1] = 52 * i + k + n; T++; } A[T] = 14; B[T][0] = g[0]; B[T][1] = g[1]; T++; for (int k = 2; k < 26; k++) { A[T] = 14; B[T][0] = T - 1; B[T][1] = g[k]; T++; } f[j] = T - 1; } for (int j = 0; j < 26; j++) { int c = 0; for (int k = 0; k < 16; k++) { A[T] = 8; B[T][0] = f[k]; B[T][1] = 52 * i + 26 + j + n; T++; A[T] = 6; B[T][0] = T - 1; B[T][1] = v[j][k]; T++; A[T] = 8; B[T][0] = T - 2; B[T][1] = v[j][k]; T++; v[j][k] = T; A[T] = 6; B[T][0] = T - 2; B[T][1] = c; T++; A[T] = 8; B[T][0] = T - 3; B[T][1] = c; T++; A[T] = 14; B[T][0] = T - 1; B[T][1] = T - 3; c = T++; } } } for (int i = 0; i < 26; i++) { for (int j = 0; j < 16; j++) { vector<int> g(26); for (int k = 0; k < 26; k++) { g[k] = T; A[T] = 8; B[T][0] = v[k][j]; B[T][1] = 418 + 26 * i + k; T++; } A[T] = 14; B[T][0] = g[0]; B[T][1] = g[1]; T++; for (int k = 2; k < 26; k++) { A[T] = 14; B[T][0] = T - 1; B[T][1] = g[k]; T++; } ans[i][j] = T - 1; } } return T; }

Compilation message (stderr)

abc.cpp: In function 'int circuit(int, int, int*, int (*)[2], int (*)[16])':
abc.cpp:82:9: warning: unused variable 'N' [-Wunused-variable]
   82 |     int N = 26;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...