QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#691909 | #6341. The Last Battle | L_Hospital_ | 0 | 0ms | 0kb | C++17 | 3.9kb | 2024-10-31 13:23:19 | 2024-10-31 13:23:20 |
Anna
#include "Anna.h"
#include <string>
#include<bits/stdc++.h>
# define ll long long
# define rep(i, j, k) for (int i = j; i <= k; ++i)
using namespace std;
namespace {
ll ccr[8][8] =
{{8336472289217LL, 5639512599365LL, 1871250638342LL, 3390137130908LL, 2530027537138LL, 6552170723915LL, 3251759294492LL, 929957346565LL},
{25314763727LL, 2970367782506LL, 5527222402534LL, 6577898502454LL, 7127768016113LL, 3901949843252LL, 5636633740636LL, 6616692904317LL},
{7681352977774LL, 2375001204905LL, 4929867600779LL, 4862126206117LL, 8167356340727LL, 3035625863743LL, 6559553015134LL, 1935233326026LL},
{5707803600531LL, 6199538358365LL, 734043647614LL, 2266684804241LL, 5137174576748LL, 3594890660019LL, 500607681489LL, 687940303769LL},
{511884368862LL, 1438606257434LL, 7514839894893LL, 8340731692060LL, 1780971378244LL, 3093181020765LL, 4116667040631LL, 2716731664696LL},
{1248747142959LL, 6235375997772LL, 6957362059910LL, 2323727036899LL, 2396710924683LL, 5070921600379LL, 205564431433LL, 6467932111513LL},
{3371733935LL, 961720284132LL, 2176602768852LL, 2820141481226LL, 233272507539LL, 1660705470819LL, 5377457925919LL, 7456736482082LL},
{3908948650271LL, 8665163992602LL, 6067865243888LL, 2568877634971LL, 8603921027952LL, 2818931663736LL, 4006172116513LL, 3714897363758LL}};
}
void Anna(int X, int Y, int N, std::string S) {
ll now = 0;
for (int i = N - 1; i >= 0; --i) now = 2 * now + (S[i] == 'B');
rep(i, 0, 7) rep(j, 0, 7) if (i != X && j != Y) Paint(i, j, (__builtin_popcountll(ccr[i][j] & now) + (ccr[(i + 4) % 8][(j + 4) % 8] & 1)) % 2 == 0 ? 0 : 1);
}
Bruno
#include "Bruno.h"
#include <vector>
#include <string>
#include<bits/stdc++.h>
# define ll long long
# define rep(i, j, k) for (int i = j; i <= k; ++i)
using namespace std;
namespace {
ll ccr[8][8] =
{{8336472289217LL, 5639512599365LL, 1871250638342LL, 3390137130908LL, 2530027537138LL, 6552170723915LL, 3251759294492LL, 929957346565LL},
{25314763727LL, 2970367782506LL, 5527222402534LL, 6577898502454LL, 7127768016113LL, 3901949843252LL, 5636633740636LL, 6616692904317LL},
{7681352977774LL, 2375001204905LL, 4929867600779LL, 4862126206117LL, 8167356340727LL, 3035625863743LL, 6559553015134LL, 1935233326026LL},
{5707803600531LL, 6199538358365LL, 734043647614LL, 2266684804241LL, 5137174576748LL, 3594890660019LL, 500607681489LL, 687940303769LL},
{511884368862LL, 1438606257434LL, 7514839894893LL, 8340731692060LL, 1780971378244LL, 3093181020765LL, 4116667040631LL, 2716731664696LL},
{1248747142959LL, 6235375997772LL, 6957362059910LL, 2323727036899LL, 2396710924683LL, 5070921600379LL, 205564431433LL, 6467932111513LL},
{3371733935LL, 961720284132LL, 2176602768852LL, 2820141481226LL, 233272507539LL, 1660705470819LL, 5377457925919LL, 7456736482082LL},
{3908948650271LL, 8665163992602LL, 6067865243888LL, 2568877634971LL, 8603921027952LL, 2818931663736LL, 4006172116513LL, 3714897363758LL}};
ll b[8][8];
ll kkr[44];
}
std::string Bruno(int N, std::vector<std::vector<int>> T) {
rep(i, 0, 7) rep(j, 0, 7) b[i][j] = (T[i][j] ^ (ccr[(i + 4) % 8][(j + 4) % 8] & 1)), b[i][j] <<= 43, b[i][j] += ccr[i][j];
rep(i, 0, 7) rep(j, 0, 7)
{
memset(kkr, 0, sizeof(kkr));
bool ok = true;
rep(k, 0, 7) if (ok) rep(l, 0, 7) if (ok) if (k != i && j != l)
{
// cerr << k << ' ' << l << endl;
ll now = b[k][l], pos = -1;
for (int p = N - 1; p >= 0; --p) if (now & (1LL << p))
{
if (kkr[p]) now ^= kkr[p]; else if (pos == -1) pos = p;
}
if (pos == -1 && now) {ok = false; break;}
if (pos == -1) continue;
kkr[pos] = now;
rep(p, pos + 1, N - 1) if (kkr[p] & (1LL << pos)) kkr[p] ^= kkr[pos];
}
if (ok)
{
string s = "";
rep(i, 0, N - 1) s += ((kkr[i] >> 43) ? 'B' : 'A');
return s;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Stage 2: Program Bruno Time Limit Exceeded
Manager to Anna
20000 1 7 1 A 2 3 1 A 0 1 1 A 1 1 1 A 7 4 1 A 2 3 1 A 0 3 1 B 0 7 1 A 4 2 1 B 5 4 1 A 6 0 1 B 7 3 1 A 0 7 1 A 2 3 1 A 1 6 1 A 5 2 1 B 2 7 1 B 6 3 1 A 3 3 1 A 1 7 1 A 2 3 1 A 1 2 1 A 5 3 1 A 3 5 1 A 4 3 1 A 2 3 1 A 4 6 1 B 7 3 1 B 2 3 1 A 4 4 1 A 7 3 1 A 4 5 1 B 0 7 1 A 0 3 1 B 2 0 1 B 4 1 1 A 6 0 1 ...
Anna to Manager
0110001111010000101000101110100110011000110111110 0110010111100100110010101100100100011001110111101 1111001110100001010010011100101100010001110111101 0100010110100001010010011100101100010001110111101 0110010111100111100000010001010110010010001100111 0110010111100100110010101100100100011001110111101 ...
Manager to Bruno
20000 1 0110001110010100111010000010100001011101100110001100011101111100 1 0111001011101001000011000011100101011100100110001100011101111101 1 1101011111111001101010000110100100011100110110001100011101111101 1 0110001000000001101010000010100100011100110110001000011100111101 1 011010101111100111100000...