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 ...
随机推荐
- android左右滑动加载分页以及动态加载数据
android UI 往右滑动,滑动到最后一页就自动加载数据并显示 如图: package cn.anycall.ju; import java.util.ArrayList; import java ...
- codeforces 690C3 Brain Network
simple:并查集一下 #include <vector> #include <iostream> #include <queue> #include <c ...
- lightoj 1022
直接算即可,特别要注意精度 #include<cstdio> #include<cmath> int main(){ int t, CASE(0); double r; sca ...
- Ubuntu下命令行cd进不了/home/用户目录
输入命令:cd /home/usr后和刚刚进入终端一样,其实已经进入了usr中,终端默认用usr用户登录,输入ls就可以查看usr目录下的文件
- Socket异步发送的同步控制
在网络通信中,我们使用Socket异步发送数据,但在客户端,往往是需要等待服务器的返回结果后(握手过程)再往下执行,这就涉及到同步控制了,在多次的实现中,使用AutoResetEvent,实现不,即有 ...
- bzoj 1798 [Ahoi2009]Seq 维护序列seq(线段树+传标)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=1798 [题意] 给定一个序列,要求提供区间乘/加,以及区间求和的操作 [思路] 线段树 ...
- 卸载 Cloudera Manager 5.1.x.和 相关软件【官网翻译】
问题导读: 1.不同的安装方式,卸载方法存在什么区别?2.不同的操作系统,卸载 Cloudera Manager Server and 数据库有什么区别? 重新安装不完整如果你来到这里,因为你的安装没 ...
- 第二百五十天 how can I 坚持
html排版,好烦心. 我以为我会哭,但是我没有.---<领悟> 确实是搞不懂自己,到底想要什么?弟弟最近也不知道咋的了,感觉有点不对劲呢. 最近雾霾好严重,希望我们的后代不会知道雾霾是什 ...
- 【转】Maven实战(四)---多模块项目---JBOSS部署问题
原文出自于:http://blog.csdn.net/liutengteng130/article/details/41622681 感谢! 这几天在搭框架中仅仅是JBOSS就遇到了很多问题 ...
- DataSnap与FireDAC三层
相交资料: http://blog.csdn.net/shuaihj/article/details/6129131http://www.cnblogs.com/hnxxcxg/p/4007876.h ...