C17K:Lying Island】的更多相关文章

地址:http://poj.openjudge.cn/practice/C17K/ 题目: C17K:Lying Island 查看 提交 统计 提问 总时间限制:  2000ms 内存限制:  262144kB 描述 There are N people living on Lying Island. Some of them are good guys, while others are bad. It is known that good guys are always telling t…
链接 题意: 有n个人,每个人可能会说: 第x个人是好人/坏人 如果第x个人是好人/坏人,则第y个人是好人/坏人 思路: 状压dp,首先每个人所说的人只能是他前面10个人,所以对于第i个人记录下,他前面十个人的情况. 对于第i个人,如果他说的话一个状态不冲突,那么i可以由这个状态转移. 注意:对于“如果第x个人是好人,那么第y个人是坏人 “,那么x是好人,y是好人是不满足的.但是除了x是好人y是坏人这种情况满足,x是坏人,也是满足的.(一定要学好语文!) 代码 #include<cstdio>…
https://vjudge.net/contest/171652#problem/K [题意] 小岛上有n个人,有些是好人(一定是真话),有些是坏人(可能是真话也可能是假话),现在要判断最多有多少好人 每个人说话有四种形式: 1. Person i: Person x is a good guy. 2. Person i: Person x is a bad guy. 3. Person i: If person x is a good guy, person y is a good guy.…
思路: 题目链接http://poj.openjudge.cn/practice/C17K/ 状压dp.dp[i][j]表示第i - k人到第i人的状态为j的情况下前i人中最多有多少好人. 实现: #include <bits/stdc++.h> using namespace std; ][]; struct node { int type, id1, id2; bool f1, f2; }; node a[]; bool same(bool a, bool b) { return (a &…
  Island of Logic  The Island of Logic has three kinds of inhabitants: divine beings that always tell the truth, evil beings that always lie, and human beings that are truthful during the day and lie at night. Every inhabitant recognizes the type of…
题目链接:LightOJ 1418 Problem Description I have bought an island where I want to plant trees in rows and columns. So, the trees will form a rectangular grid and each of them can be thought of having integer coordinates by taking a suitable grid point as…
You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one isla…
https://leetcode.com/problems/island-perimeter/ 在一个N×N的矩阵中,N<100,1代表岛,0代表海,岛内没有海,求岛的周长 [[0,1,0,0], [1,1,1,0], [0,1,0,0], [1,1,0,0]] Answer: 16 Explanation: The perimeter is the 16 yellow stripes in the image below: 由正方形组成的不规则图形的周长和正方形个数有什么关系? 这个就是这题的…
#463. Island Perimeter You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and th…
原题链接在这里:https://leetcode.com/problems/island-perimeter/ 题目: You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is c…