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 ...
随机推荐
- AOP基础
[Why AOP ?] 1.代码混乱:越来越多的非业务需求(日志和验证等)加入后,原有的业务方法急剧膨胀.每个方法在处理核心逻辑的同时还必须兼顾其他多个关注点. 2.代码分散:以日志需求为例,知识为了 ...
- poj 2420 模拟退火法基础
/* 题意:给n个电脑,求一个点到这n个电脑的距离和最小. 模拟退火法:和poj1379的方法类似 因为坐标范围是0-10000 不妨把它看成是10000*10000的正方形来做 */ #includ ...
- 好不容易帮同事写的一个awk,要记下来
给昌哥写的过滤的东东. 是实现了,但感觉丑,不规范. 记得下先. 原始数据格式: -- :: [ pool--thread-: ] - [ DEBUG ] origin match ::, user: ...
- Ubuntu中LightDM是什么(转)
LightDM(Light Display Manager)是一个全新的轻量级Linux桌面显示管理器,而传统的Ubuntu是使用GNOME桌面标准的GDM. LightDM是一个跨桌面显示管理器,其 ...
- map, string 强大的STL
hdu 1247 Hat's Words Input Standard input consists of a number of lowercase words, one per line, in ...
- 第16章 ASP.NET MVC 日志篇
本章主要介绍MVC中内置的错误处理.日志以及用来提升性能的监控工具 一.错误处理 当该网站忙于处理HTTP请求时,很多内容都会出错.幸运的是,MVC让错误处理工作变得相对简单了很多,因为MVC应用是运 ...
- 使用openstack的虚拟机模版注意事项
openstack虚拟机模版(flavor)是一个非常奇怪的设计.讲讲我測试时遇到的问题,尽管说在project应用中虚拟机模版在開始时就定制好.后期可能做改动,可是改动时一定要注意,有以下几种情况: ...
- Python基础教程之第5章 条件, 循环和其它语句
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 #Chapter 5 条件, 循环 ...
- tiny4412 裸机程序 一、说明【转】
本文转载自:http://blog.csdn.net/eshing/article/details/37109115 首先.我想说明为什么我写这个文档?我自己想学点东西,过于求成,又过于自信,直接买了 ...
- [模板]FWT
写起来和fft很像,这里放个板子. 代码: #include<iostream> #include<cstdio> #include<cmath> #include ...