제출 #1354468

#제출 시각아이디문제언어결과실행 시간메모리
1354468blackscreen1Casino (JOI26_casino)C++20
100 / 100
248 ms840 KiB
#include "Azzurro.h"
#include <bits//stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_multiset;
#define ll long long
#define iloop(m, h) for (auto i = m; i != h; i += (m < h ? 1 : -1))
#define jloop(m, h) for (auto j = m; j != h; j += (m < h ? 1 : -1))
#define kloop(m, h) for (auto k = m; k != h; k += (m < h ? 1 : -1))
#define lloop(m, h) for (auto l = m; l != h; l += (m < h ? 1 : -1))
#define pll pair<ll, ll>
#define INF 1000000000000000
#define MOD1 1000000007
#define MOD2 998244353
#define MOD3 1000000009
namespace {
    
}

vector<vector<int>> Azzurro(int N, int L, string S) {
	int n = N, m = L;
	bool a[51], tar, tot;
	memset(a, 0, sizeof(a));
	iloop(0, m) a[i] = S[i] - 'A';
    vector<vector<int>> x(n, vector<int>(n, 0));
    x[0][0] = a[0];
    x[n-1][n-1] = a[1];
    iloop(0, 49) {
		x[i/7][1 + (i%7)] = a[i+2];
	}
	iloop(1, 8) {
		tar = tot = 0;
		for (int j = i-1; j >= 0; j -= 2) tar ^= x[j][i-j];
		for (int j = i-1; j >= 0; j--) tot ^= x[j][i-j];
		// tot ^ f ^ 1 = tar => f = tar ^ tot ^ 1
		x[i][0] = tar ^ tot ^ 1;
	}
	iloop(1, 7) {
		tar = tot = 0;
		for (int j = 6; j >= i; j -= 2) tar ^= x[j][7+i-j];
		for (int j = 6; j >= i; j--) tot ^= x[j][7+i-j];
		// tot ^ f ^ 1 = tar => f = tar ^ tot ^ 1
		x[7][i] = tar ^ tot ^ 1;
	}
	return x;
}
#include "Bordeaux.h"
#include <bits//stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_multiset;
#define ll long long
#define iloop(m, h) for (auto i = m; i != h; i += (m < h ? 1 : -1))
#define jloop(m, h) for (auto j = m; j != h; j += (m < h ? 1 : -1))
#define kloop(m, h) for (auto k = m; k != h; k += (m < h ? 1 : -1))
#define lloop(m, h) for (auto l = m; l != h; l += (m < h ? 1 : -1))
#define pll pair<ll, ll>
#define INF 1000000000000000
#define MOD1 1000000007
#define MOD2 998244353
#define MOD3 1000000009
namespace {

}

string Bordeaux(int N, int L, vector<vector<int>> T) {
    int n = N, m = L;
    bool ans[51], tar, tot;
    bool x[8][8];
    iloop(0, n) jloop(0, n) x[i][j] = T[i][j];
    ans[0] = T[0][0]^1;
    ans[1] = T[7][7]^1;
    pll cpo = {0, 0};
    iloop(1, 8) {
		tar = tot = 0;
		for (int j = i-1; j >= 0; j -= 2) tar ^= x[j][i-j];
		for (int j = i-1; j >= 0; j--) tot ^= x[j][i-j];
		tot ^= x[i][0];
		if (tar == tot) {
			// even col
			if (cpo.second%2 == 0) cpo.first++;
			else cpo.second++;
		}
		else {
			if (cpo.second%2 == 1) cpo.first++;
			else cpo.second++;
		}
		x[cpo.first][cpo.second] ^= 1;
	}
	iloop(1, 7) {
		tar = tot = 0;
		for (int j = 6; j >= i; j -= 2) tar ^= x[j][7+i-j];
		for (int j = 6; j >= i; j--) tot ^= x[j][7+i-j];
		tot ^= x[7][i];
		if (tar == tot) {
			// odd row
			if (cpo.first%2 == 0) cpo.first++;
			else cpo.second++;
		}
		else {
			if (cpo.first%2 == 1) cpo.first++;
			else cpo.second++;
		}
		x[cpo.first][cpo.second] ^= 1;
	}
	iloop(0, 7) jloop(0, 7) ans[i*7+j+2] = x[i][j+1];
	string res = "";
	iloop(0, m) res += (ans[i] ? "B" : "A");
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...