链接:https://codeforces.com/gym/101606


A - Alien Sunset

暴力枚举小时即可。

#include<bits/stdc++.h>
using namespace std;
const int maxn=;
int n;
int h[maxn],r[maxn],s[maxn];
inline bool dark(int id,int time)
{
if(r[id]<s[id])
{
if(r[id]<time && time<s[id]) return ;
else return ;
}
if(r[id]>s[id])
{
if(s[id]<=time && time<=r[id]) return ;
else return ;
}
}
int main()
{
cin>>n;
int mx=;
for(int i=;i<=n;i++) cin>>h[i]>>r[i]>>s[i], mx=max(h[i],mx); for(int time=;time<mx*;time++)
{
bool ok=;
for(int i=;i<=n;i++) if(!dark(i,time%h[i])) ok=;
if(ok)
{
cout<<time<<endl;
return ;
}
}
cout<<"impossible"<<endl;
}

B - Breaking Biscuits - (Undone)


C - Cued In - [水]

#include<bits/stdc++.h>
using namespace std;
int n;
string s;
map<string,int> mp;
int main()
{
ios::sync_with_stdio();
cin.tie(), cout.tie(); mp["red"]=,
mp["yellow"]=,
mp["green"]=,
mp["brown"]=,
mp["blue"]=,
mp["pink"]=,
mp["black"]=; cin>>n;
int red=, sum=, mx=;
for(int i=;i<=n;i++)
{
cin>>s;
mx=max(mx,mp[s]);
if(s=="red") red++;
else sum+=mp[s];
} if(red==n) cout<<"1\n";
else if(red==) cout<<sum<<'\n';
else cout<<red*(mx+)+sum<<'\n';
}

D - Deranging Hat - (Undone)


E - Education - [贪心]

$O(n^2)$ 时间复杂度的贪心。

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define fi first
#define se second
const int maxn=5e3+; int n,m;
P s[maxn];
int ans[maxn]; struct F{
int id;
int capa,rent;
bool operator<(const F& o)
{
return capa>o.capa;
}
}f[maxn];
bool vis[maxn]; int main()
{
cin>>n>>m;
for(int i=;i<=n;i++) scanf("%d",&s[i].fi), s[i].se=i;
sort(s+,s+n+,greater<P>{}); //for(int i=1;i<=n;i++) printf("%d %d\n",s[i].fi,s[i].se); for(int i=;i<=m;i++) f[i].id=i;
for(int i=;i<=m;i++) scanf("%d",&f[i].capa);
for(int i=;i<=m;i++) scanf("%d",&f[i].rent);
sort(f+,f+m+); //for(int i=1;i<=m;i++) printf("%d: %d %d\n",f[i].id,f[i].capa,f[i].rent); memset(vis,,sizeof(vis));
memset(ans,,sizeof(ans));
for(int i=;i<=n;i++)
{
int mn=1e3+, mnid=;
for(int j=;j<=m && f[j].capa>=s[i].fi;j++)
{
if(vis[j]) continue;
if(f[j].rent<mn)
{
mn=f[j].rent;
mnid=j;
}
}
vis[mnid]=;
ans[s[i].se]=f[mnid].id;
}
bool ok=;
for(int i=;i<=n;i++) if(ans[i]==) ok=;
if(ok) for(int i=;i<=n;i++) printf("%d ",ans[i]);
else printf("impossible");
cout<<endl;
}

F - Flipping Coins - [概率DP]


H - Hiking - (Undone)


I - I Work All Day - (Undone)


J - Just A Minim - [水]

#include<bits/stdc++.h>
using namespace std;
int n;
double t[];
int main()
{
t[]=2.0;
t[]=1.0;
t[]=1.0/2.0;
t[]=1.0/4.0;
t[]=1.0/8.0;
t[]=1.0/16.0; cin>>n;
double res=0.0;
for(int i=,x;i<=n;i++)
{
scanf("%d",&x);
res+=t[x];
}
printf("%.7f\n",res);
}

L - Lizard Lounge - [计算几何+LIS]

Gym 101606 - A/B/C/D/E/F/G/H/I/J/K/L - (Undone)的更多相关文章

  1. codeforces gym 100952 A B C D E F G H I J

    gym 100952 A #include <iostream> #include<cstdio> #include<cmath> #include<cstr ...

  2. codeforces gym101243 A C D E F G H J

    gym101243 A #include<iostream> #include<cstdio> #include<cmath> #include<cstrin ...

  3. 2017-2018 ACM-ICPC, NEERC, Southern Subregional Contest A E F G H I K M

    // 深夜补水题,清早(雾)写水文 A. Automatic Door 题意 \(n(n\leq 1e9)\)个\(employee\)和\(m(m\leq 1e5)\)个\(client\)要进门, ...

  4. The 16th Zhejiang Provincial Collegiate Programming Contest Sponsored(E F G H I)

    http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=392 E:Sequence in the Pocket 思路:从 ...

  5. 2016CCPC长春 - B/D/F/H/I/J/K - (待补)

    目录: B - Fraction D - Triangle F - Harmonic Value Description H - Sequence I I - Sequence II B题:HDU 5 ...

  6. Codeforces 1214 F G H 补题记录

    翻开以前打的 #583,水平不够场上只过了五题.最近来补一下题,来记录我sb的调试过程. 估计我这个水平现场也过不了,因为前面的题已经zz调了好久-- F:就是给你环上一些点,两两配对求距离最小值. ...

  7. 2017 United Kingdom and Ireland Programming(Gym - 101606)

    题目很水.睡过了迟到了一个小时,到达战场一看,俩队友AC五个了.. 就只贴我补的几个吧. B - Breaking Biscuits Gym - 101606B 旋转卡壳模板题.然后敲错了. 代码是另 ...

  8. ThinkPHP内置函数详解D、F、S、C、L、A、I

    单字母函数D.F.S.C.L.A.I 他们都在ThinkPHP核心的ThinkPHP/Mode/Api/functions.php这个文件中定义. 下面我分别说明一下他们的功能: D() 加载Mode ...

  9. T​h​e​ ​v​a​l​u​e​ ​f​o​r​ ​t​h​e​ ​u​s​e​B​e​a​n​ ​c​l​a​s​s​ ​a​t​t​r​i​b​u​t​e​ ​i​s​ ​invalied

    JSP: T​h​e​ ​v​a​l​u​e​ ​f​o​r​ ​t​h​e​ ​u​s​e​B​e​a​n​ ​c​l​a​s​s​ ​a​t​t​r​i​b​u​t​e​ ​X​X​X​ ​i​s ...

随机推荐

  1. visual studio code运行时报错,Cannot find module 'webpack'

    前言 今天运行是visual studio code时,报了一个错误Cannot find module 'webpack' ,网上找了很多方法都没解决.下面一起来看看怎么解决 正文 报错: npm ...

  2. python的线程和进程

    1.线程的基本概念 概念 线程是进程中执行运算的最小单位,是进程中的一个实体,是被系统独立调度和分派的基本单位,线程自己不拥有系统资源,只拥有一点在运行中必不可少的资源,但它可与同属一个进程的其它线程 ...

  3. SpringBatch框架简介

    概观 轻量级,全面的批处理框架,旨在开发对企业系统日常运营至关重要的强大批处理应用程序. Spring Batch提供了可重复使用的功能,这些功能对于处理大量记录至关重要,包括记录/跟踪,事务管理,作 ...

  4. 330 div+css Experience

    今天学习的div,感觉对编辑html更为方便快捷,但还是需要多练,多熟悉一下思路和逻辑方式 越来越感觉,代码不是重要的,重要的是方向和思路,am的float clearfloat 及属性,还有over ...

  5. 更改 Ubuntu默认Python版本的问题

    一般Ubuntu默认版本为2.x,之前运行一些程序,将默认版本修改为3.5,现在想修改为2.7. 之前的方法有些忘记,现在重新记录一下: 1.查看你系统中有哪些Python的二进制文件可供使用, ls ...

  6. 排序算法以及其java实现

    一.术语了解 稳定:如果a原本在b前面,而a=b,排序之后a仍然在b的前面: 不稳定:如果a原本在b的前面,而a=b,排序之后a可能会出现在b的后面: 内排序:所有排序操作都在内存中完成: 外排序:由 ...

  7. mysql收集统计信息

    一.手动  执行Analyze table innodb和myisam存储引擎都可以通过执行“Analyze table tablename”来收集表的统计信息,除非执行计划不准确,否则不要轻易执行该 ...

  8. JS函数可以再添加属性(包括方法)

    1 前言 JS函数可以再添加属性(包括方法),这个有点有趣,记录一下. 2 代码 <!DOCTYPE html> <html> <head> <title&g ...

  9. Atcoder Grand Contest 032

    打的第一场Atcoder,已经知道会被虐得很惨,但没有想到竟然只做出一题-- 思维急需提升. A - Limited Insertion 这题还是很签到的. 感觉正着做不好做,我们反着来,把加数变为删 ...

  10. CSS使用小记

    1. 省略显示 max-width: 200px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; 固定宽度,nowra ...