EZ 2018 01 14 2018noip第四次膜你赛
这次惨烈的炸了个精光(只有20),然后对我的OI想法造成了巨大的转折。
(以上有点作,其实我只是再也不用vector存图了而已(用邻接表))
难度很不均匀,而且题型很狗(还有结论题???)
T1 坑人结论题,想出来100,没有就爆零
我和这道题杠了一个半小时,然后他们猥琐地告诉我结论——要么四边形要么不可能
反正我也不会证(雾)
找正方形的话枚举两个点,剩下的快排+二分或者hash。
可能是我的hash太丑了,被卡了
CODE
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long LL;
const LL N=,seed=,mod=;
LL x[N],y[N],n,i,j,t;
bool flag,f[mod+];
inline void read(LL &x)
{
x=; char ch=getchar(); LL flag=;
while (ch<''||ch>'') { if (ch=='-') flag=-; ch=getchar(); }
while (ch>=''&&ch<='') x=x*+ch-'',ch=getchar();
x*=flag;
}
inline LL hash(LL a,LL b)
{
LL res=;
if (a<) a=-a*;
if (b<) b=-b*;
while (a!=-) res=((res+a%)*seed)%mod,a=a?a/:-;
while (b!=-) res=((res+b%)*seed)%mod,b=b?b/:-;
return res;
}
int main()
{
freopen("geometry.in","r",stdin); freopen("geometry.out","w",stdout);
read(t);
while (t--)
{
read(n);
memset(f,,sizeof(f)); flag=;
for (i=;i<=n;++i)
read(x[i]),read(y[i]),f[hash(x[i],y[i])]=;
for (i=;i<n;++i)
if (flag)
for (j=i+;j<=n;++j)
{
if (f[hash(x[i]+y[j]-y[i],x[i]+y[i]-x[j])]&&f[hash(x[j]+y[j]-y[i],x[i]+y[j]-x[j])]) { puts(""); flag=; break; }
if (f[hash(x[i]-y[j]+y[i],-x[i]+y[i]+x[j])]&&f[hash(x[j]-y[j]+y[i],-x[i]+y[j]+x[j])]) { puts(""); flag=; break; }
}
if (flag) puts("-1");
}
return ;
}
T2 超难,难度已经高于NOIP一等(标算应该是容斥DP),弃坑
只会20分暴力:
枚举全排列(用STL),然后暴力判断是否可行。
然后我试图打表找规律,又浪费了一个小时。
20分CODE
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=,mod=1e9+;
int a[N],n,t,k,i,tot,ans;
inline int next(int a,int b)
{
if (abs(a-b)<=) return ;
if (a==&&b==n) return ;
if (a==n&&b==) return ;
return ;
}
int main()
{
freopen("counting.in","r",stdin); freopen("counting.out","w",stdout);
scanf("%d%d",&n,&k);
for (i=;i<=n;++i)
a[i]=i;
do
{
tot=;
for (i=;i<=n;++i)
if (next(a[i],i)) tot++;
if (tot>=k) ans++;
if (ans==mod) ans=;
} while (next_permutation(a+,a+n+));
printf("%d\n",ans);
return ;
}
T3 SB题,一道链表题(像我这种连邻接表都不会的人SB地敲了vector然后全部爆内存)
一个类似邻接表的东西,只是多了一个end[]来表示结尾的元素以方便连接
CODE
#include<cstdio>
#include<cstring>
using namespace std;
const int N=;
int a[N],head[N],end[N],next[N],i,j,n,m,q,x,y;
inline void read(int &x)
{
x=; char ch=getchar();
while (ch<''||ch>'') ch=getchar();
while (ch>=''&&ch<='') x=x*+ch-'',ch=getchar();
}
inline void write(int x)
{
if(x/) write(x/);
putchar(x%+'');
}
int main()
{
freopen("sequence.in","r",stdin); freopen("sequence.out","w",stdout);
read(n); read(m); read(q);
memset(head,-,sizeof(head));
memset(end,-,sizeof(end));
memset(next,-,sizeof(next));
for (i=;i<=n;++i)
{
read(a[i]);
if (head[a[i]]==-) head[a[i]]=end[a[i]]=i; else end[a[i]]=next[end[a[i]]]=i;
}
while (q--)
{
read(x); read(y);
if (head[x]==-||x==y) continue;
if (end[y]==-) head[y]=head[x]; else next[end[y]]=head[x];
end[y]=end[x];
head[x]=end[x]=-;
}
for (i=;i<=m;++i)
for (j=head[i];j!=-;j=next[j])
a[j]=i;
for (i=;i<=n;++i)
write(a[i]),putchar(' ');
return ;
}
EZ 2018 01 14 2018noip第四次膜你赛的更多相关文章
- EZ 2018 1 21 2018noip第五次膜你赛
这次分数普遍偏高,而且yu'ben'ao又AK了! 但是最后一题莫名爆0让我很感伤啊(搓了1个多小时的20分暴力)! 难度偏低,主要是T2没剪枝,炸了3个点. T1 这种SB题恐怕是千年难遇了,PJ- ...
- app后端设计(2)--xmpp的使用(2014.01.14更新)
在app中有时候是需要添加聊天服务,在这里谈谈曾经开发聊天服务的经验: (1)聊天服务端选的openfire,这是一个基于xmpp协议的聊天服务器(XMPP是一种基于XML的协议,它继承了在XML环境 ...
- 2018 HDU多校第四场赛后补题
2018 HDU多校第四场赛后补题 自己学校出的毒瘤场..吃枣药丸 hdu中的题号是6332 - 6343. K. Expression in Memories 题意: 判断一个简化版的算术表达式是否 ...
- Intel Artificial Intelligence Conference(2018.11.14)
时间:2018.11.14地点:北京国贸大酒店
- Trusted Cloud Summit(2018.08.14)
时间:2018.08.14地点:北京国际会议中心
- IDEA(2018.01)安装和破解
IDEA(2018.01)安装和破解 1.下载IDE https://www.jetbrains.com/idea/download/#section=windows 选择Ultimate版本 2.下 ...
- JZOJ 5812. 【NOIP提高A组模拟2018.8.14】 区间
5812. [NOIP提高A组模拟2018.8.14] 区间 (File IO): input:range.in output:range.out Time Limits: 1000 ms Memo ...
- 2018.10.19浪在ACM 集训队第一次测试赛
2018.10.19浪在ACM 集训队第一次测试赛 待参考资料: [1]:https://blog.csdn.net/XLno_name/article/details/78559973?utm_so ...
- 2018.12.30【NOIP提高组】模拟赛C组总结
2018.12.30[NOIP提高组]模拟赛C组总结 今天成功回归开始做比赛 感觉十分良(zhōng)好(chà). 统计数字(count.pas/c/cpp) 字符串的展开(expand.pas/c ...
随机推荐
- Vue 2.0 v-for 响应式key, index及item.id参数对v-bind:key值造成差异研究
Vue 2.0 v-for 响应式key, index及item.id参数对v-bind:key值造成差异研究 在github上阅览README.md以获得最佳阅读体验,点这里 v-for响应式key ...
- 64位的Sql Server使用OPENROWSET导入xlsx格式的excel数据的时候报错(转载)
In the old times while all the CPUs were 32bit, we were happily using JET OLEDB Provider reaching Ex ...
- META-INF下文件读取
protected String getProperty(String name) { String file = "/META-INF/jndi.properties&quo ...
- EntityFramework Code-First 简易教程(二)-------Code First约定
Code First 约定 在前一篇中,我们已经知道了EF Code-First怎样从模型类(domain classes)中创建数据库表,下面,我们开始学习默认的Code-First约定. 什么是约 ...
- MySQL数据库的安装与基本操作
实验要求: 1.安装mysql源码包,并做相关的配置和优化路径,启动服务. 步骤: 1)先查询MySQL软件的安装情况,如果有建议将其卸载, 2)安装光盘自带的ncurses-devel包. 3)My ...
- dns服务器测试工具
下载地址:https://www.eatm.app/wp-content/uploads/2018/08/eDnsTest.20180810.zip
- 深入浅出Windows命令——telnet
- Android权限申请完全解析(一):Android自带的权限申请
1.为什么要权限申请 6.0以上就需要了,别问为什么.(不是重点,自行搜索) 2.如何进行权限申请 Android自带的权限申请 EasyPermission权限申请 Ps:EasyPermissio ...
- Alpha事后诸葛亮(阳光普照队)
Alpha事后诸葛亮 设想和目标 1.实现文字识别,以用户喜欢的图片做背景将其保存,生成新的图片. 2.时间比较赶,主要是因为队员对于Android开发方面的了解不多,可以说是几乎没有,需要一步一步的 ...
- cocos2d-x2.2.3 Layer分析
<pre name="code" class="cpp">Layer CCLayerColor: 能够改变Layer的背景,能够设置大小 CCLay ...