CodeForces 670C Cinema
简单题。
统计一下懂每种语言的人分别有几个,然后$O(n)$扫一遍电影就可以得到答案了。
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-;
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
char c=getchar(); x=;
while(!isdigit(c)) c=getchar();
while(isdigit(c)) {x=x*+c-''; c=getchar();}
} const int maxn=;
int a[maxn],b[maxn],c[maxn],n,q;
map<int,int>m; int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++) {int x; scanf("%d",&x),m[x]++; }
scanf("%d",&q);
for(int i=;i<=q;i++) scanf("%d",&b[i]);
for(int i=;i<=q;i++) scanf("%d",&c[i]);
for(int i=;i<=q;i++) b[i]=m[b[i]],c[i]=m[c[i]]; int mx=;
for(int i=;i<=q;i++) mx=max(mx,b[i]);
int ans=;
for(int i=;i<=q;i++)
{
if(b[i]!=mx) continue;
if(c[i]<c[ans]) continue;
ans=i;
}
printf("%d\n",ans);
return ;
}
CodeForces 670C Cinema的更多相关文章
- CodeForces 670C Cinema(排序,离散化)
C. Cinema time limit per test 2 seconds memory limit per test 256 megabytes input standard input out ...
- Cinema CodeForces - 670C (离散+排序)
Moscow is hosting a major international conference, which is attended by n scientists from different ...
- 【Codeforces 670C】 Cinema
[题目链接] http://codeforces.com/contest/670/problem/C [算法] 离散化 [代码] #include<bits/stdc++.h> using ...
- codeforces A. Cinema Line 解题报告
题目链接:http://codeforces.com/problemset/problem/349/A 题目意思:题目不难理解,从一开始什么钱都没有的情况下,要向每一个人售票,每张票价格是25卢布,这 ...
- Codeforces 234D Cinema
这题做的我好苦啊,编码调试整整搞了一个多小时,而且调到天昏地暗才调出来.. 回归正题,这题是一道本人做过的比较烦,比较无聊的题之一.题意是一个人,在m个影星里有k个喜欢的影星,然后给出n场电影,每场电 ...
- CF 670C Cinema(算竞进阶习题)
离散化+排序 离散化统计人数就好,本来不难,但是测试点太丧心病狂了...CF还是大哥啊 #include <bits/stdc++.h> #define INF 0x3f3f3f3f us ...
- Codeforces Round #350 (Div. 2)解题报告
codeforces 670A. Holidays 题目链接: http://codeforces.com/contest/670/problem/A 题意: A. Holidays On the p ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- Codeforces Round #350 (Div. 2) C. Cinema 水题
C. Cinema 题目连接: http://www.codeforces.com/contest/670/problem/C Description Moscow is hosting a majo ...
随机推荐
- 【IOS开发】UItextfield输入电话号码,自动调整格式
UItextfield中实现输入电话号码,自动按位置在加“—”效果.效果图如下. 核心代码: -(BOOL)textField:(UITextField *)textField shouldChang ...
- Apache HttpServer Installing the apache2.2 service <OS 5>拒绝访问. :Failed to open the WinNT service manager
Installing the apache2.2 service<OS 5>拒绝访问. :Failed to open the WinNT service manager 只需要于管理员 ...
- hdu 2159
二维背包,dp[i][j]表示忍耐度为i,且还可以杀j个怪时能获得的最大经验值 dp[i][j]=max(dp[i][j],dp[i-r[k]][j-1]+e[k]),r[k]为杀死第k种怪掉的忍耐度 ...
- Lazy Scheduler
Lazy Scheduler:我的轻量级任务调度框架 一.背景 工作中经常涉及任务调度,一直都是采用while(true) => if hitted DO => Thread.Slee ...
- WPF 自定义 MessageBox (相对完善版)
WPF 自定义 MessageBox (相对完善版) 基于WPF的自定义 MessageBox. 众所周知WPF界面美观.大多数WPF元素都可以简单的修改其样式,从而达到程序的风格统一.可是当 ...
- VC中如何设置菜单项的触发状态?
MFC中初始菜单栏如下: 当工程未新建,或者未打开时,后面的观测菜单设置为灰色,不可触发. 当新建工程或者打开工程后,菜单变回可触发状况. 观测菜单如下: 下面以轴力观测菜单为例 轴力初始测量菜单 ...
- VC 编程ANSI环境下读写Unicode文件
没有注意到文件编码的不同会产生这么多的问题,在动手以前查询了很多资料,在本博客中收藏了不少先辈的成果,在这里一并表示致敬! 关于ANSI和Unicode编码的原理在这里也不说了,主要讲下如 ...
- flowplayer视频播放插件
flowplayer视频播放插件 最近项目中需要添加播放视频的功能,视频文件是flv格式的.在网上找了一些jQuery视频播放插件,还是觉得“flowplayer”要好一些.特将使用方法记录一下. f ...
- NCache:最新发布的.NET平台分布式缓存系统
NCache:最新发布的.NET平台分布式缓存系统在等待Microsoft完成Velocity这个.NET平台下的分布式内存缓存系统的过程中,现在让我们将目光暂时投向其他已经有所建树的软件开发商.Al ...
- squid和varnish的小结
squid和varnish的小结 http://blog.haohtml.com/ 上周初步接触linux下的这2个反向缓存软件,都实验了一下,貌似squid还是比较顺利的,varnish则碰 ...