Codeforces Gym 100610 Problem H. Horrible Truth 瞎搞
Problem H. Horrible Truth
Time Limit: 1 Sec
Memory Limit: 256 MB
题目连接
http://codeforces.com/gym/100610
Description
In a Famous TV Show “Find Out” there are n characters and only one Horrible Truth. To make the series breathtaking all way long, the screenplay writer decided that every episode should show exactly one important event. There are three types of the important events in this series: • character A finds out the Truth; • character A finds out that the other character B knows the Truth; • character A finds out that the other character B doesn’t know the Truth. Initially, nobody knows the Truth. All events must be correct, and every fact found out must be true. If some character finds out some fact, she cannot find it out once again. Moreover, to give the audience some sense of action, the writer does not want an episode to show the important event of the same type as in the previous episode. Your task is to determine the maximal possible number of episodes in the series and to create an example of a screenplay plan.
Input
The only line of the input contains a single integer n — the number of characters in the TV show (1 ≤ n ≤ 100).
Output
In the first line of the output file output a single integer k — the maximal possible number of episodes in the series. Then write k lines, each containing a description of an episode. For the episode in which character A (characters are numbered 1 through n) finds out the Truth, write the line “A 0”. For an episode in which character A finds out that character B knows the Truth, write the line “A B”. Similarly, for an episode in which character A finds out that character B doesn’t know the Truth, write the line “A -B”. If there are several plans providing the maximal possible number of episodes, output any one of them.
Sample Input
3
Sample Output
13 2 -1 1 0 2 1 1 -2 3 1 3 -2 2 0 1 2 1 -3 3 2 2 -3 3 0 1 3
HINT
题意
无良电视剧公司要来拍电视剧了
每集演一个故事,分别是叫做A知道,B知道A知道,B知道A不知道
要求每个人都不能在两集内做同样的事情
不能连续两集都是知道,或者知道别人知道,或者知道别人不知道
要求你合乎逻辑的情况下,最多演多少集
题解:
观察样例可以,第一回合嘲讽一下别人,第二回合就让人知道,然后就来回知道别人知道和知道别人不知道这样就好了……
瞎搞……
代码:
//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <bitset>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 110000
#define mod 1001
#define eps 1e-9
#define pi 3.1415926
int Num;
//const int inf=0x7fffffff; //§ß§é§à§é¨f§³
const ll inf=;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************* map< pair<int,int> ,int> H;
vector<pair<int,int> > V;
int main()
{ // horrible.out
freopen("horrible.in","r",stdin);
freopen("horrible.out","w",stdout);
int n=read();
int tot=;
if(n==)
{
printf("1\n");
printf("1 0\n");
return ;
}
V.push_back(make_pair(,-));
for(int i=;i<=n;i++)
{
V.push_back(make_pair(i,));
int ttt = ;
int flag = ; while(flag)
{
flag=;
ttt++;
if(ttt%==)
{
flag=;
for(int ii=;ii<=n;ii++)
{
if(i==ii)
continue;
if(H[make_pair(ii,i)])
continue;
H[make_pair(ii,i)]=;
V.push_back(make_pair(ii,i));
flag=;
break;
}
}
else
{
flag=;
for(int jj=i+;jj<=n;jj++)
{
for(int ii=;ii<=n;ii++)
{
if(ii==jj)
continue;
if(H[make_pair(ii,-jj)])
continue;
H[make_pair(ii,-jj)]=;
V.push_back(make_pair(ii,-jj));
flag=;
break;
}
if(flag)
break;
}
}
}
}
printf("%d\n",V.size());
for(int i=;i<V.size();i++)
printf("%d %d\n",V[i].first,V[i].second); }
Codeforces Gym 100610 Problem H. Horrible Truth 瞎搞的更多相关文章
- Codeforces Gym 100610 Problem A. Alien Communication Masterclass 构造
Problem A. Alien Communication Masterclass Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codefo ...
- Codeforces Gym 100610 Problem K. Kitchen Robot 状压DP
Problem K. Kitchen Robot Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10061 ...
- Codeforces Gym 100610 Problem E. Explicit Formula 水题
Problem E. Explicit Formula Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...
- Codeforces Gym 100342H Problem H. Hard Test 构造题,卡迪杰斯特拉
Problem H. Hard TestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/at ...
- Gym 100531H Problem H. Hiking in the Hills 二分
Problem H. Hiking in the Hills 题目连接: http://codeforces.com/gym/100531/attachments Description Helen ...
- codeforces Gym 100187L L. Ministry of Truth 水题
L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...
- Codeforces Gym 100342J Problem J. Triatrip 求三元环的数量 bitset
Problem J. Triatrip Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/at ...
- Codeforces Gym 100342C Problem C. Painting Cottages 转化题意
Problem C. Painting CottagesTime Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...
- Codeforces Gym 100342C Problem C. Painting Cottages 暴力
Problem C. Painting CottagesTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/1 ...
随机推荐
- LwIP源代码文件目录解析
1 -- LwIP源代码文件目录 root@motadou:/home/motadou/lwip/lwip-1.4.1# tree . ├── CHANGELOG ├── COPYING ├── do ...
- 【转】如何用WINDBG分析64位机上32位程序的DUMP文件
将dump拖入到windbg中后,在command输入栏输入 .load wow64exts 回车 !sw 回车,就将windbg的dump,从64位模式切换到了32位模式,否则看到的call sta ...
- 无人机DLG生产作业流程
参考文章 无人机(AVIAN)低空摄影测量作业流程 无人机低空遥感测绘作业流程及主要质量控制点 微型无人机低空摄影测量系 无人机航空摄影测量系统引进与发展 基于复杂地形的无人机航摄系统1∶500 DL ...
- Storm-6 Storm的并行度、Grouping策略以及消息可靠处理机制简介
概念: 配置并行度 动态的改变并行度 流分组策略----Stream Grouping 消息的可靠处理机制 概念: Workers (JVMs): 在一个节点上可以运行一个或多个独立的JVM 进程.一 ...
- 《Python CookBook2》 第一章 文本 - 过滤字符串中不属于指定集合的字符 && 检查一个字符串是文本还是二进制
过滤字符串中不属于指定集合的字符 任务: 给定一个需要保留的字符串的集合,构建一个过滤函数,并可将其应用于任何字符串s,函数返回一个s的拷贝,该拷贝只包含指定字符集合中的元素. 解决方案: impor ...
- PHP的MySQL扩展:PHP访问MySQL的常用扩展函数
来源:http://www.ido321.com/1024.html 一.PHP连接数据库及基本操作 MySQL采用的是’客户机/服务器’架构.使用PHP安装的MySQL扩展函数,和直接使用客户端软件 ...
- bzoj 2049 [Sdoi2008]Cave 洞穴勘测(LCT)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=2049 [题意] 给定森林,可能有连边或断边的操作,回答若干个连通性的询问. [思路] ...
- 自学Hadoop(一)
主要是在自学一些根据以下两份文档来自己摸索.第二份文档是最后的时候,碰到一个问题的搜到的,因为觉得不错.所以放在这里.如果只是想要能跑起来的话,直接跟着这篇文章做.就可以.hadoop版本为2 ...
- JavaEE5 Tutorial_Servlet
Web资源:web组件,静态web文件如图片 Web程序:可发布的Web资源集合 Web程序根目录下有个web-inf文件夹,如果只有jsp和静态资源,里面可以没有web.xml 根目录下可以直接 ...
- 微信分享,使用js,分享给朋友,朋友圈,QQ微博
<script> var imgUrl = "http://www.baidu.com/img/bdlogo.gif"; var lineLink = "ht ...