简单题。

统计一下懂每种语言的人分别有几个,然后$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的更多相关文章

  1. CodeForces 670C Cinema(排序,离散化)

    C. Cinema time limit per test 2 seconds memory limit per test 256 megabytes input standard input out ...

  2. Cinema CodeForces - 670C (离散+排序)

    Moscow is hosting a major international conference, which is attended by n scientists from different ...

  3. 【Codeforces 670C】 Cinema

    [题目链接] http://codeforces.com/contest/670/problem/C [算法] 离散化 [代码] #include<bits/stdc++.h> using ...

  4. codeforces A. Cinema Line 解题报告

    题目链接:http://codeforces.com/problemset/problem/349/A 题目意思:题目不难理解,从一开始什么钱都没有的情况下,要向每一个人售票,每张票价格是25卢布,这 ...

  5. Codeforces 234D Cinema

    这题做的我好苦啊,编码调试整整搞了一个多小时,而且调到天昏地暗才调出来.. 回归正题,这题是一道本人做过的比较烦,比较无聊的题之一.题意是一个人,在m个影星里有k个喜欢的影星,然后给出n场电影,每场电 ...

  6. CF 670C Cinema(算竞进阶习题)

    离散化+排序 离散化统计人数就好,本来不难,但是测试点太丧心病狂了...CF还是大哥啊 #include <bits/stdc++.h> #define INF 0x3f3f3f3f us ...

  7. Codeforces Round #350 (Div. 2)解题报告

    codeforces 670A. Holidays 题目链接: http://codeforces.com/contest/670/problem/A 题意: A. Holidays On the p ...

  8. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  9. Codeforces Round #350 (Div. 2) C. Cinema 水题

    C. Cinema 题目连接: http://www.codeforces.com/contest/670/problem/C Description Moscow is hosting a majo ...

随机推荐

  1. 【又长见识了】函数传参,params参数,ref和out参数详解

    一.原来函数这样传参 先看一个函数和函数调用. static void Main(string[] args) { ; Test(num);//局部变量在使用之前赋值 //Test(10); //直接 ...

  2. linux 安装svn,并设置钩子来同步更新

    linux安装svn下载 http://subversion.tigris.org/downloads/subversion-1.6.6.tar.gz 和 http://subversion.tigr ...

  3. C# 添加敏感词

    public class CheckStreamReader { //使用的数据: private static HashSet<string> hash = new HashSet< ...

  4. 免费UI框架推荐--Charisma UI

    基于Jquery.Bootstrap的后台管理免费UI框架推荐--Charisma UI 在项目设计和开发工作中,做过一些后台管理系统的设计和开发,用的很多都是比较传统的UI框架. 老是走在这个圈子里 ...

  5. 鸟哥的LINUX私房菜基础篇第三版 阅读笔记 三 Linux磁盘与文件系统管理

    一.认识EXT2文件系统:     a.硬盘的组成:转动小马达+存储的磁盘+读写的机械臂     b.磁盘的一些概念              扇区为最小的物理储存单位,每个扇区为512B       ...

  6. xml数据解析

    xml数据解析 在iPhone开发中,XML的解析有很多选择,iOS SDK提供了NSXMLParser和libxml2两个类库,另外还有很多第三方类库可选,例如TBXML.TouchXML.Kiss ...

  7. 成都传智播客JDBC视频及讲师介绍

    成都传智播客java讲师,也许,你跟他很熟,你或者听过他的课,或者跟他争论过什么,又或者你们在一起共事,再者你们只是偶尔擦肩而过.在小编的印象中郭老师完全没有架子,和他相处会让你觉得不是面对一个老师, ...

  8. C++ 头文件系列(deque)

    简介 deque是double ended queue(即双端队列)的简称. 就像C++中的大部分容器的一样,deque具有以下属性: 顺序的(sequence) 动态增长的(dynamic grow ...

  9. Java 编译打包命令

    背景 编译 打包 解压 运行 参考 背景 我们有的时候总是要使用将自己写的工程编译成 class 文件,同时打包成 jar,虽然有各种工具可以帮助我们,但是毕竟掌握使用 java 本来的命令去做这些更 ...

  10. [ios2]componentsSeparatedByCharactersInSet使用方法

    NSString*str =@"A~B^C"; NSArray*arr =[str componentsSeparatedByCharactersInSet:           ...