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 ...
随机推荐
- Hadoop 使用FileSystem API 读取数据
代码: package com.hadoop; import java.io.IOException; import java.io.InputStream; import java.net.URI; ...
- DirectX And Com
Windows游戏编程读书笔记(5)——初识DirectX和COM 一.COM 1.什么是COM对象 一个COM对象事实上是一个或一套实现了大量接口的C++类 2.COM的优点 不用重新编译你的程序就 ...
- [转]从命令行往 iOS 设备上安装程序
link:http://www.stewgleadow.com/blog/2011/11/05/installing-ios-apps-on-the-device-from-the-command-l ...
- Getting Started with Core Data
Getting Started with Core Data Getting Started with Core Data Coreframework支持创建对象模型封装你的应用数据和逻辑满足MVC设 ...
- IOS学习之路十八(通过 NSURLConnection 发送 HTTP 各种请求)
你想通过 Http 协议向服务器发送一个 Get 的包装请求,并在这个请求中添加了一些请 求参数. 向远程服务器发送一个 GET 请求,然后解析返回的数据.通常一个 GET 请求是添加了 一些参数的, ...
- iOS 动画类型 笔记
#pragma mark Core Animation - (IBAction)buttonPressed1:(id)sender { UIButton *button = (UIButton *)s ...
- 把项目做成jar包
方法一.在eclipse3.1中把项目做成jar包步骤. 打包前的工作. 在项目下创建一个文件夹,名为META-INF,再在其下创建文件MANIFEST.MF 编辑的内容如下: Manifest-Ve ...
- Oracle日志文件的管理与查看
--Oracle日志文件管理与查看 select * from v$sql (#查看最近所作的操作) --select * fromv $sqlarea(#查看最近所作的操作) -- 1.查询系统使用 ...
- spring实现数据库读写分离
现在大型的电子商务系统,在数据库层面大都采用读写分离技术,就是一个Master数据库,多个Slave数据库.Master库负责数据更新和实时数据查询,Slave库当然负责非实时数据查询.因为在实际的应 ...
- MySQL的一些基本查询,创建存储过程等
常用的查询条件有1.比较:=,<,>,<=,>=,!=,<>,!>,!< 2.确定范围:between and,not bet ...