CF831C Jury Marks
思路:
关键在于“插入”一个得分之后,其他所有得分也随之确定了。
实现:
#include <iostream>
#include <cstdio>
#include <set>
using namespace std;
const int MAXN = ;
int a[MAXN], b[MAXN], sum[MAXN];
int main()
{
int k, n;
set<int> ans;
cin >> k >> n;
for (int i = ; i <= k; i++)
{
cin >> a[i];
sum[i] = sum[i - ] + a[i];
}
for (int i = ; i <= n; i++) cin >> b[i];
for (int i = ; i <= k; i++)
{
set<int> s;
for (int j = ; j <= k; j++)
{
if (i == j) continue;
s.insert(b[] - (sum[i] - sum[j]));
}
bool flg = true;
for (int j = ; j <= n; j++)
{
if (!s.count(b[j])) { flg = false; break; }
}
if (flg) ans.insert(b[] - sum[i]);
}
cout << ans.size() << endl;
return ;
}
CF831C Jury Marks的更多相关文章
- Codeforces831C Jury Marks
C. Jury Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...
- C. Jury Marks
C. Jury Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...
- C. Jury Marks 思维
C. Jury Marks 这个题目虽然是只有1600,但是还是挺思维的. 有点难想. 应该可以比较快的推出的是这个肯定和前缀和有关, x x+a1 x+a1+a2 x+a1+a2+a3... x+s ...
- C. Jury Marks 思维题
http://codeforces.com/contest/831/problem/C 做的时候想不到,来了个暴力. 对于每个b[i],枚举每一个a[i],就有1个可能的情况. 然后用vector存起 ...
- 【Codeforces Round #424 (Div. 2) C】Jury Marks
[Link]:http://codeforces.com/contest/831/problem/C [Description] 有一个人参加一个比赛; 他一开始有一个初始分数x; 有k个评委要依次对 ...
- #424 Div2 Problem C Jury Marks (二分 && 暴力 && std::unique && 思维)
题目链接 :http://codeforces.com/contest/831/problem/C 题意 :选手有一个初始积分,接下来有k个裁判为他加分或减分(时间顺序给出),然后告诉你n(1< ...
- CF-831C
C. Jury Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)
http://codeforces.com/contest/831 A. Unimodal Array time limit per test 1 second memory limit per te ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) A 水 B stl C stl D 暴力 E 树状数组
A. Unimodal Array time limit per test 1 second memory limit per test 256 megabytes input standard in ...
随机推荐
- 【ZJOI2017 Round2练习&BZOJ4827】D1T3 gift(FFT)
题意: 思路:可以看出题目所要最小化的是这样一个形式: 拆出每一项之后发现会变化的项只有sigma a[i]*b[i+t]与c^2,c*(a[i]-b[i]) c可以在外层枚举,剩下的只有sigma ...
- JAVA NIO 之 Selector 组件
NIO 重要功能就是实现多路复用.Selector是SelectableChannel对象的多路复用器.一些基础知识: 选择器(Selector):选择器类管理着一个被注册的通道集合的信息和它们的就绪 ...
- ArcGIS 10.1 for Server安装教程系列—— Linux下的单机安装
http://www.oschina.net/question/565065_81231 因为Linux具有稳定,功能强大等特性,因此常常被用来做为企业内部的服务器,我们的很多用户也是将Ar ...
- 1.4-动态路由协议OSPF③
OSPF的路由汇总 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 用默认的网络地址 因为 无论在何种路 ...
- [Vue @Component] Write Vue Functional Components Inline
Vue's functional components are small and flexible enough to be declared inside of .vue file next to ...
- CAS—改动默认登录页
1. 部署CAS-Server 本文以cas-server-3.4.11-release.zip为例.解压提取cas-server-3.4.11/modules/cas-server-webapp- ...
- hdu 2255奔小康赚大钱 KM算法模板
题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=2255 一,KM算法:(借助这个题写一下个人对km的理解与km模板) KM算法主要是用来求解图的最优匹 ...
- HDU 1421 搬寝室 (线性dp 贪心预处理)
搬寝室 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submis ...
- LeetCode 970. Powerful Integers (强整数)
题目标签:HashMap 题目让我们找出所有独一的powerful integers 小于bound的情况下. 把 x^i 看作 a:把 y^j 看作b, 代入for loop,把所有的情况都遍历一遍 ...
- Delphi中ARC内存管理的方向
随着即将发布的10.3版本,RAD Studio R&D和PM团队正在制作Delphi在内存管理方面的新方向. 几年前,当Embarcadero开始为Windows以外的平台构建新的Delph ...