思路:

关键在于“插入”一个得分之后,其他所有得分也随之确定了。

实现:

 #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的更多相关文章

  1. Codeforces831C Jury Marks

    C. Jury Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  2. C. Jury Marks

    C. Jury Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  3. C. Jury Marks 思维

    C. Jury Marks 这个题目虽然是只有1600,但是还是挺思维的. 有点难想. 应该可以比较快的推出的是这个肯定和前缀和有关, x x+a1 x+a1+a2 x+a1+a2+a3... x+s ...

  4. C. Jury Marks 思维题

    http://codeforces.com/contest/831/problem/C 做的时候想不到,来了个暴力. 对于每个b[i],枚举每一个a[i],就有1个可能的情况. 然后用vector存起 ...

  5. 【Codeforces Round #424 (Div. 2) C】Jury Marks

    [Link]:http://codeforces.com/contest/831/problem/C [Description] 有一个人参加一个比赛; 他一开始有一个初始分数x; 有k个评委要依次对 ...

  6. #424 Div2 Problem C Jury Marks (二分 && 暴力 && std::unique && 思维)

    题目链接 :http://codeforces.com/contest/831/problem/C 题意 :选手有一个初始积分,接下来有k个裁判为他加分或减分(时间顺序给出),然后告诉你n(1< ...

  7. CF-831C

    C. Jury Marks time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. Git--删除远程仓库文件但不删除本地仓库资源

    我们在使用idea开发的过程中经常会出现新建项目的时候直接把xxx.iml文件也添加到了git trace 当然这并不会出现什么问题,问题是当我们把xxx.iml文件push到我们github上之后, ...

  2. Java Web学习总结(29)——Java Web中的Filter和Interceptor比较

    1. 背景 在设计web应用的时候,用户登录/注册是必不可少的功能,对用户登录信息进行验证的方法也是多种多样,大致可以认为如下模式:前端验证+后台验证.根据笔者的经验,一般会在前端进行一些例如是否输入 ...

  3. CodeForcesGym 100753A A Journey to Greece

    A Journey to Greece Time Limit: 5000ms Memory Limit: 262144KB This problem will be judged on CodeFor ...

  4. 为 Windows Phone 8.1 app 解决“The type does not support direct content.”的问题

    我在 VS 14 CTP 中新建了一个空的 app store 项目名叫 PlayWithXaml ,项目的 MainPage.xaml 文件改为了以下内容: <Page x:Class=&qu ...

  5. MYSQL中有关数据库的简单操作

    #创建数据库CREATE DATABASE day01; #查询所有数据库SHOW DATABASES; #查看某个数据库定义信息SHOW CREATE DATABASE day01; #查询正在使用 ...

  6. springMVC 返回中文字符串时乱码

    转载自:https://blog.csdn.net/yaov_yy/article/details/51819567

  7. sql sever 等待事件

    http://blog.csdn.net/dba_huangzj/article/details/7607844

  8. word分节时,如何让每一节的首页置为奇数页

    具体操作,可参考如下图片所示的步骤: 打印时的效果: 备注:目录页为第二小节首页(文档的第二页),整个文档的首页为封面第一页. 打印时,会在首页后自动插入一张空白页:也会在正文(第三页,第三节)前,目 ...

  9. spring boot日期转换

    spring boot 作为微服务简易架构.拥有其自身的特点.快速搭建架构 简单 快捷.这里我只是简单的介绍下我遇到的其中的  两个问题.第一前台页面传递的时间类型 无法自动映射到Java的 Date ...

  10. Canopy算法计算聚类的簇数

    Kmeans算是是聚类中的经典算法.步骤例如以下: 选择K个点作为初始质心 repeat 将每一个点指派到近期的质心,形成K个簇 又一次计算每一个簇的质心 until 簇不发生变化或达到最大迭代次数 ...