AC日记——Dynamic Problem Scoring codeforces 807d
思路:
水题;
代码:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; #define maxn 130 int n,ai[maxn][],ac[],cnt,all,last1,last2; double map[][]; inline void in(int &now)
{
int if_z=;now=;
char Cget=getchar();
while(Cget>''||Cget<'')
{
if(Cget=='-') if_z=-;
Cget=getchar();
}
while(Cget>=''&&Cget<='')
{
now=now*+Cget-'';
Cget=getchar();
}
now*=if_z;
} int point(int a,int s,int t)
{
if(t==-) return ;
int res=;
double p=(double)a/(double)s;
if(p>0.5&&p<=) res+=-*t;
else if(p>0.25&&p<=0.5) res+=-*t;
else if(p>0.125&&p<=0.25) res+=-t*;
else if(p>0.0625&&p<=0.125) res+=-t*;
else if(p>0.03125&&p<=0.0625) res+=-t*;
else if(p>&&p<=0.03125) res+=-t*;
return res;
} int main()
{
in(n);
for(int i=;i<=n;i++)
{
for(int j=;j<=;j++)
{
in(ai[i][j]);
if(ai[i][j]!=-) ac[j]++;
}
}
for(int i=;i<=;i++)
{
last1+=point(ac[i],n,ai[][i]);
last2+=point(ac[i],n,ai[][i]);
}
cnt=n;
if(last1>last2)
{
printf("");
return ;
}
for(int j=;j<=;j++)
{
cnt++;
int sco1=,sco2=;
bool if_[];
for(int i=;i<=;i++)
{
if(ai[][i]==-&&ai[][i]==-) continue;
int k1=point(ac[i]+,cnt,ai[][i]);
int k2=point(ac[i],cnt,ai[][i]);
int g1=point(ac[i]+,cnt,ai[][i]);
int g2=point(ac[i],cnt,ai[][i]);
if(ai[][i]==-)
{
sco2+=g2;
continue;
}
if(ai[][i]==-)
{
sco1+=k2;
continue;
}
if(ai[][i]<ai[][i])
{
sco1+=k2;
sco2+=g2;
}
else
{
ac[i]++;
sco1+=k1;
sco2+=g1;
}
}
last1=sco1,last2=sco2;
if(last1>last2)
{
cout<<cnt-n;
return ;
}
}
cout<<-;
return ;
}
AC日记——Dynamic Problem Scoring codeforces 807d的更多相关文章
- Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) D - Dynamic Problem Scoring
地址:http://codeforces.com/contest/807/problem/D 题目: D. Dynamic Problem Scoring time limit per test 2 ...
- Codeforces Round #412 Div. 2 补题 D. Dynamic Problem Scoring
D. Dynamic Problem Scoring time limit per test 2 seconds memory limit per test 256 megabytes input s ...
- 【codeforces 807D】Dynamic Problem Scoring
[题目链接]:http://codeforces.com/contest/807/problem/D [题意] 给出n个人的比赛信息; 5道题 每道题,或是没被解决->用-1表示; 或者给出解题 ...
- codeforces 807 D. Dynamic Problem Scoring(贪心+思维)
题目链接:http://codeforces.com/contest/807/problem/D 题意:对于动态计分的 Codeforces Round ,已知每题的 score 是根据 Round ...
- AC日记——Dynamic Ranking 洛谷 P2617
Dynamic Ranking 思路: 可持久化树状数组: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 1 ...
- AC日记——Sign on Fence Codeforces 484e
E. Sign on Fence time limit per test 4 seconds memory limit per test 256 megabytes input standard in ...
- AC日记——Andryusha and Socks Codeforces 780a
A. Andryusha and Socks time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- AC日记——Sagheer, the Hausmeister codeforces 812b
812B - Sagheer, the Hausmeister 思路: 搜索: 代码: #include <cstdio> #include <cstring> #includ ...
- AC日记——Sagheer and Crossroads codeforces 812a
812A - Sagheer and Crossroads 思路: 模拟: 代码: #include <cstdio> #include <cstring> #include ...
随机推荐
- Activiti工作流(三)——流程变量
流程变量可以是流程中一系列参数,比如办理人(Assignee),消息(message)等.这些流程变量使得activiti能够应用于更为复杂的业务中,使得流程变得更加灵活可控. 场景(一) 图一:没有 ...
- C#重载和重写
Overload:重载就是在同一个类中,方法名相同,参数列表不同.参数列表不同包括:参数的个数不同,参数类型不同. using System; using System.Collections.Gen ...
- Luogu2662 牛场围栏(最短路)
小凯的疑惑升级版的升级版.答案若存在不会超过30002-3000,暴力dp似乎勉强可以过.当然这不优美. 注意到如果能拼出长度为l的围栏,就一定能拼出长度为l+kx的围栏,其中x为最短的(或任意一个) ...
- BZOJ2001 [Hnoi2010]City 城市建设 【CDQ分治 + kruskal】
题目链接 BZOJ2001 题解 CDQ分治神题... 难想难写.. 比较朴素的思想是对于每个询问都求一遍\(BST\),这样做显然会爆 考虑一下时间都浪费在了什么地方 我们每次求\(BST\)实际上 ...
- Spring源码解析-事件
Spring事件的组件 主要是3个组件: 1.ApplicationEvent 事件 2.ApplicationListener 监听器,对事件进行监听 3.ApplicationEventMul ...
- [poj 2104]主席树+静态区间第k大
题目链接:http://poj.org/problem?id=2104 主席树入门题目,主席树其实就是可持久化权值线段树,rt[i]维护了前i个数中第i大(小)的数出现次数的信息,通过查询两棵树的差即 ...
- scala(一种静态语言)
语法: 关键字 val(表示:值) 不可变 ex: val a:Int=1 或者 val a=1(会自动识别类型,无基本类与包装类之分) 输出:a:Int=1 关键字var ex: var a ...
- Linux Uptime 命令,让你知道你的系统运行了多久
对于一些人来说系统运行了多久是无关紧要的,但是对于服务器管理员来说,这是相当重要的信息.服务器在运行重要应用的时候,必须尽量保证长时间的稳定运行,有时候甚至要求零宕机.那么我们怎么才能知道服务器运行了 ...
- MAVEN 编译打包测试 指定本地jar
转载自:http://penuel.iteye.com/blog/1766102 maven对于互联网开发,进行版本管理有着不可或缺的作用; 而经常开发的程序猿直接联调或者依赖未上线或deploy的 ...
- Centos7下redis设置密码、开放远程访问权限
redis的安装与启动可参考前一篇文章:http://www.cnblogs.com/zuidongfeng/p/8032505.html redis安装成功后,默认是没有设置密码的启动redis-c ...