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 ...
随机推荐
- Shiro学习(17)OAuth2集成
目前很多开放平台如新浪微博开放平台都在使用提供开放API接口供开发者使用,随之带来了第三方应用要到开放平台进行授权的问题,OAuth就是干这个的,OAuth2是OAuth协议的下一个版本,相比OAut ...
- Android中怎么破解游戏之修改金币数
我们在玩游戏的时候总是会遇到一些东东需要进行购买的,但是我们可能又舍不得花钱,那么我们该怎么办呢?那就是用游戏外挂吧!我们这里说的是Android中的游戏,在网上搜索一下移动端游戏外挂,可能会找到一款 ...
- kafka为什么快?
为什么Kafka那么快 原创 2016-07-18 fireflyc 写程序的康德 网上有很多Kafka的测试文章,测试结果通常都是"吊打"其他MQ.感慨它的牛B之余我觉得必要仔细 ...
- php中正则表达式总结(不容错过)
php中正则表达式总结(不容错过) 一.总结 一句话总结: 无论js,php,java,python里面中的正则都是差不多一样的,所以用点脑子 用到正则的地方很多,比如 nginx的配置文件 1.ph ...
- 其它课程中的python---5、Pandas处理数据和读取数据
其它课程中的python---5.Pandas处理数据和读取数据 一.总结 一句话总结: 记常用和特例:慢慢慢慢的就熟了,不用太着急,慢慢来 库的使用都很简单:就是库的常用函数就这几个,后面用的时候学 ...
- thinkphp+layui多图上传(1)thinkphp5+layui实现多图上传保存到数据库,可以实现图片自由排序,自由删除。
公共css代码 <style> .layui-upload-img { width: 90px; height: 90px; margin: 0; } .pic-more { width: ...
- 使用poi实现生成excel文件
import java.util.ArrayList; import javax.servlet.ServletOutputStream; import org.apache.poi.hssf.use ...
- PostgreSQL——服务器基本设置与操作
一.编译安装: 环境准备: GNU make 版本 >=3.8 (make --version) ISO/ANSI C 编译器,至少須兼容 C89 标准,GCC 或 intel 編译器等均可 g ...
- UTF-8 - ASCII 兼容的多字节 Unicode 编码
描述 The Unicode 字符集使用的是 16 位(双字节)码.最普遍的 Unicode 编码方法( UCS-2) 由一个 16 位双字序列组成.这样的字符串中包括了的一些如‘\0’或‘/’这样的 ...
- Nginx网站部署
Nginx网站服务部署 常用的网站服务软件 处理静态资源的服务: apache软件:https://apache.org/ nginx软件:https://nginx.org/ 处理动态资源的服务: ...