Sigils of Elohim
题目大意
见游戏链接https://store.steampowered.com/app/321480/。
分析
代码如下
#include <bits/stdc++.h>
using namespace std; #define INIT() ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define Rep(i,n) for (int i = 0; i < (n); ++i)
#define For(i,s,t) for (int i = (s); i <= (t); ++i)
#define rFor(i,t,s) for (int i = (t); i >= (s); --i)
#define ForLL(i, s, t) for (LL i = LL(s); i <= LL(t); ++i)
#define rForLL(i, t, s) for (LL i = LL(t); i >= LL(s); --i)
#define foreach(i,c) for (__typeof(c.begin()) i = c.begin(); i != c.end(); ++i)
#define rforeach(i,c) for (__typeof(c.rbegin()) i = c.rbegin(); i != c.rend(); ++i) #define pr(x) cout << #x << " = " << x << " "
#define prln(x) cout << #x << " = " << x << endl #define LOWBIT(x) ((x)&(-x)) #define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())
#define UNIQUE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define REMOVE(x, c) x.erase(remove(x.begin(), x.end(), c), x.end()); // 删去 x 中所有 c
#define TOLOWER(x) transform(x.begin(), x.end(), x.begin(),::tolower);
#define TOUPPER(x) transform(x.begin(), x.end(), x.begin(),::toupper); #define ms0(a) memset(a,0,sizeof(a))
#define msI(a) memset(a,0x7f,sizeof(a))
#define msM(a) memset(a,-1,sizeof(a)) #define MP make_pair
#define PB push_back
#define ft first
#define sd second template<typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
in >> p.first >> p.second;
return in;
} template<typename T>
istream &operator>>(istream &in, vector<T> &v) {
for (auto &x: v)
in >> x;
return in;
} template<typename T>
ostream &operator<<(ostream &out, vector<T> &v) {
Rep(i, v.size()) out << v[i] << " \n"[i == v.size()];
return out;
} template<typename T1, typename T2>
ostream &operator<<(ostream &out, const std::pair<T1, T2> &p) {
out << "[" << p.first << ", " << p.second << "]" << "\n";
return out;
} inline int gc(){
static const int BUF = 1e7;
static char buf[BUF], *bg = buf + BUF, *ed = bg; if(bg == ed) fread(bg = buf, , BUF, stdin);
return *bg++;
} inline int ri(){
int x = , f = , c = gc();
for(; c<||c>; f = c=='-'?-:f, c=gc());
for(; c>&&c<; x = x* + c - , c=gc());
return x*f;
} template<class T>
inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
} inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
} //min <= aim <= max
template<typename T>
inline bool BETWEEN(const T aim, const T min, const T max) {
return min <= aim && aim <= max;
} typedef long long LL;
typedef unsigned long long uLL;
typedef pair< double, double > PDD;
typedef pair< int, int > PII;
typedef pair< int, PII > PIPII;
typedef pair< string, int > PSI;
typedef pair< int, PSI > PIPSI;
typedef set< int > SI;
typedef set< PII > SPII;
typedef vector< int > VI;
typedef vector< double > VD;
typedef vector< VI > VVI;
typedef vector< SI > VSI;
typedef vector< PII > VPII;
typedef map< int, int > MII;
typedef map< int, string > MIS;
typedef map< int, PII > MIPII;
typedef map< PII, int > MPIII;
typedef map< string, int > MSI;
typedef map< string, string > MSS;
typedef map< PII, string > MPIIS;
typedef map< PII, PII > MPIIPII;
typedef multimap< int, int > MMII;
typedef multimap< string, int > MMSI;
//typedef unordered_map< int, int > uMII;
typedef pair< LL, LL > PLL;
typedef vector< LL > VL;
typedef vector< VL > VVL;
typedef priority_queue< int > PQIMax;
typedef priority_queue< int, VI, greater< int > > PQIMin;
const double EPS = 1e-;
const LL inf = 0x7fffffff;
const LL infLL = 0x7fffffffffffffffLL;
const LL mod = 1e9 + ;
const int maxN = 1e5 + ;
const LL ONE = ;
const LL evenBits = 0xaaaaaaaaaaaaaaaa;
const LL oddBits = 0x5555555555555555; struct Point{
int X, Y; Point() {}
Point(int x, int y) : X(x), Y(y) {} Point operator+ (const Point &x) const {
Point ret;
ret.X = X + x.X;
ret.Y = Y + x.Y;
return ret;
} Point operator- (const Point &x) const {
Point ret;
ret.X = X - x.X;
ret.Y = Y - x.Y;
return ret;
}
}; vector< vector< vector< Point > > > type = {
// type #1
// ***
// *
{
{Point(, ), Point(, ), Point(, ), Point(, )},
{Point(, ), Point(, ), Point(, ), Point(, )},
{Point(, ), Point(, ), Point(, ), Point(-, )},
{Point(, ), Point(, ), Point(, ), Point(, )}
},
// type #2
// ***
// *
{
{Point(, ), Point(, ), Point(, ), Point(, )},
{Point(, ), Point(, ), Point(, ), Point(, )},
{Point(, ), Point(, ), Point(, ), Point(, )},
{Point(, ), Point(, ), Point(-, ), Point(-, )}
},
// type #3
// **
// **
{
{Point(, ), Point(, ), Point(-, ), Point(-, )},
{Point(, ), Point(, ), Point(, ), Point(, )}
},
// type #4
// **
// **
{
{Point(, ), Point(, ), Point(, ), Point(, )},
{Point(, ), Point(, ), Point(, ), Point(-, )}
},
// type #5
// ****
{
{Point(, ), Point(, ), Point(, ), Point(, )},
{Point(, ), Point(, ), Point(, ), Point(, )}
},
// type #6
// **
// **
{
{Point(, ), Point(, ), Point(, ), Point(, )}
},
// type #7
// *
// ***
{
{Point(, ), Point(, ), Point(, ), Point(-, )},
{Point(, ), Point(, ), Point(, ), Point(, )},
{Point(, ), Point(, ), Point(, ), Point(, )},
{Point(, ), Point(, ), Point(-, ), Point(, )}
}
}; int m, n;
int board[][];
MII types;
int cnt; void init() {
Rep(i, type.size()) {
vector< vector< Point > > tmp;
Rep(j, type[i].size()) {
vector< Point > t;
Rep(k, type[i][j].size()) {
if(k == ) continue;
Rep(h, type[i][j].size()) t.PB(type[i][j][h] - type[i][j][k]);
tmp.PB(t);
t.clear();
}
}
foreach(j, tmp) type[i].PB(*j);
tmp.clear();
} /*
Point s(2, 2);
Rep(i, type.size()) {
Rep(j, type[i].size()) {
int b[6][6];
ms0(b);
Rep(k, type[i][j].size()) {
Point tmp = s + type[i][j][k];
b[tmp.X][tmp.Y] = i + 1;
} For(tx, 0, 5) {
For(ty, 0, 5) cout << b[tx][ty];
cout << endl;
}
cout << "**************************************\n";
}
}
*/
} bool check(int x, int y, int i, int j) {
Point s(x, y);
Rep(k, type[i][j].size()) {
Point tmp = s + type[i][j][k];
if(!BETWEEN(tmp.X, , m) || !BETWEEN(tmp.Y, , n) || board[tmp.X][tmp.Y]) return false;
}
return true;
} void print(){
For(i, , m) {
For(j, , n) cout << board[i][j];
cout << endl;
}
cout << "**************************************\n";
} inline void dfs(int x, int y) {
Point s(x, y); Rep(i, type.size()) {
if(!types[i + ]) continue;
Rep(j, type[i].size()) {
if(!check(x, y, i, j)) continue; Rep(k, type[i][j].size()) {
Point tmp = s + type[i][j][k];
board[tmp.X][tmp.Y] = i + ;
}
--types[i + ];
cnt += ; if(cnt == m * n) {
print();
return;
} For(tx, , m) {
For(ty, , n) {
if(!board[tx][ty]) {
dfs(tx, ty);
tx = m;
break;
}
}
} cnt -= ;
++types[i + ];
Rep(k, type[i][j].size()) {
Point tmp = s + type[i][j][k];
board[tmp.X][tmp.Y] = ;
}
}
}
} int main(){
//freopen("MyOutput.txt","w",stdout);
//freopen("input.txt","r",stdin);
//INIT();
init(); cin >> m >> n; // 棋盘规格
For(i, , ) cin >> types[i]; // 每种积木的数量 dfs(, );
return ;
}
Sigils of Elohim的更多相关文章
- JavaScript 中的尾调用
尾调用(Tail Call) 尾调用是函数式编程里比较重要的一个概念,它的意思是在函数的执行过程中,如果最后一个动作是一个函数的调用,即这个调用的返回值被当前函数直接返回,则称为尾调用,如下所示: f ...
- elixir 入门笔记
安装 MAC 平台用 brew 安装 brew update brew install elixir 如果没有 erlang 环境,上面的命令会自定安装 erlang 的环境. 基本数据类型 iex& ...
- Perl monks 的 快速回复
on Jun 20, 2019 at 11:39 UTC ( #11101620=perlquestion: print w/replies, xml ) Need Help?? jimyokl ha ...
随机推荐
- 「NOI2018」屠龙勇士 解题报告
「NOI2018」屠龙勇士 首先对于每个龙用哪个剑砍,我们可以用set随便模拟一下得到. 然后求出拿这个剑砍这条龙的答案 \[ atk_ix-p_iy=a_i \] 其中\(atk_i\)是砍第\(i ...
- Service4
DNS解析的作用• 为什么需要DNS系统– www.baidu.com 与 119.75.217.56,哪个更好记?– 互联网中的114查号台/导航员 • DNS服务器的功能– 正向解析:根据注册的域 ...
- [bzoj2752]高速公路 题解(线段树)
2752: [HAOI2012]高速公路(road) Time Limit: 20 Sec Memory Limit: 128 MBSubmit: 2102 Solved: 887[Submit] ...
- 【Java基础知识】JNI入门
1.问题:javah or javac -h 在配置好java的环境变量后,java和javac都是可以用的,但是用javah就会出现问题. 会报错误 Unable to locate an exe ...
- 3、Cookie与Session之间有哪些区别或者是优缺点?
Cookie与Session之间有哪些区别或者是优缺点? 知道了Cookie与Session,我们来做一些简单的总结: 1.Cookie可以存储在浏览器或者本地,session只能存在服务器 ...
- mtk_Call setting(SS)
1.SSDS: 2.PDN type 3.server回error之后的处理通过UT接口设置SS之后,网络有时候会回error,有些运营商会根据这些error来决定是否要CSFB, CSFB的条件如下 ...
- linux 上挂载硬盘或者读取u盘数据
查看服务器上有哪些设备 df -hl查询挂载 硬盘后或者插上u盘后sda 的变化,新增的就是我们添加上的. fdisk -ls /dev/sda
- [已解决]报错JSONDecodeError
报错: 解决:
- C-Ubuntu中MySQL出现ERROR1698(28000):Access denied for user root@localhost错误解决方法
卸载原先的MySQL,重新安装过程中没有提示设置密码, 当键入命令:mysql -uroot -p; 不知密码是什么,输入主机的密码以及不输入密码,回车后都出现标题错误. 寻找多篇相关博文,验证如下博 ...
- fabs() abs()
fabs() 面向实数取绝对值 abs() 返回int