Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Codeforces Round #543 (Div. 2, based on Technocup 2019 Final Round) A. Technogoblet of Fire(思维)

Codeforces Round #543 (Div. 2, based on Technocup 2019 Final Round) A. Technogoblet of Fire(思维)

作者头像
Ch_Zaqdt
发布于 2019-03-15 09:14:19
发布于 2019-03-15 09:14:19
48100
代码可运行
举报
文章被收录于专栏:Zaqdt_ACMZaqdt_ACM
运行总次数:0
代码可运行

题目链接:https://codeforces.com/contest/1121/problem/A

       题意是有n个学生,m所学校,输入n个学生的能力值,然后又输入了这n个学生的学校,现在要参加一个比赛,每个学校只派出一个能力值最高的学生参加,然后输入了k个学生编号,现在可以虚构一些学校,让这k个学生都能参加比赛,问最少需要虚构多少个学校。

       思路就是如果当前这个学生不是他的学校里能力值最高的就需要虚构一个学校


AC代码:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n,m,k;
int a[105],b[105];
map<int,int> ma;

int main()
{
  cin>>n>>m>>k;
  for(int i=1;i<=n;i++){
    cin>>a[i];
  }
  for(int i=1;i<=n;i++){
    cin>>b[i];
    ma[b[i]] = max(ma[b[i]], a[i]);
  }
  int ans = 0;
  for(int i=0;i<k;i++){
    int xx;
    cin>>xx;
    if(ma[b[xx]] != a[xx])ans++;
  }
  cout<<ans<<endl;
  return 0;
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019年03月04日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
Codeforces Round #543 (Div. 2, based on Technocup 2019 Final Round) B. Mike and Children(思维)
题目链接:https://codeforces.com/contest/1121/problem/B
Ch_Zaqdt
2019/03/15
3980
补题A-D Codeforces Round 961 (Div. 2)
枚举每个可能T与每个S是否有交集,时间复杂度是 2^c\cdot n ,时间复杂度会爆炸。
WuShF
2025/03/08
1170
补题A-D Codeforces Round 961 (Div. 2)
Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)(A.思维题,B.思维题)
A. Vicious Keyboard time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Tonio has a keyboard with only two letters, "V" and "K". One day, he has typed out a string s with only these two letters. He
Angel_Kitty
2018/04/08
7790
Codeforces Round #544 (Div. 3) D. Zero Quantity Maximization(思维)
题目链接:http://codeforces.com/contest/1133/problem/D
Ch_Zaqdt
2019/03/15
4000
补题A-E Codeforces Round 953 (Div. 2)
假设每个点都投资1元,对于a[i],投资1元的期望收益是a[i]/n,总的期望收益是sum(a)/n。
WuShF
2025/02/26
1241
补题A-E Codeforces Round 953 (Div. 2)
Codeforces Round #539 (Div. 2) A. Sasha and His Trip(思维)
题目链接:https://codeforces.com/contest/1113/problem/A
Ch_Zaqdt
2019/03/06
4810
Codeforces Round #395 (Div. 2)(A.思维,B,水)
A. Taymyr is calling you time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Comrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls from Taymyr from Ilia-alpinist. Ili
Angel_Kitty
2018/04/08
7840
Educational Codeforces Round 59 (Rated for Div. 2) C. Brutality(思维)
题目链接:http://codeforces.com/contest/1107/problem/C
Ch_Zaqdt
2019/03/05
3990
Codeforces Round #503 (by SIS, Div. 2) C. Elections(思维)
题目链接:https://codeforces.com/contest/1020/problem/C
Ch_Zaqdt
2019/03/04
4130
Codeforces Round #540 (Div. 3) B. Tanya and Candies(思维)
版权声明:欢迎转载,若转载,请标明出处,如有错误,请指点,也欢迎大佬们给出优化方法 https://blog.csdn.net/Charles_Zaqdt/article/details/87774079
Ch_Zaqdt
2019/03/14
4310
Codeforces Round #512 Div. 2 A,B,C Vasya and Golden Ticket
题目链接:http://codeforces.com/contest/1058/problem/A
Ch_Zaqdt
2019/01/11
5600
Codeforces Round #541 (Div. 2) B. Draw!(思维)
题目链接:https://codeforces.com/contest/1131/problem/B
Ch_Zaqdt
2019/03/06
4080
Codeforces Round #408 (Div. 2)(A.水,B,模拟)
A. Buying A House time limit per test:2 seconds memory limit per test:256 megabytes input:standard i
Angel_Kitty
2018/04/08
7080
Codeforces Round #408 (Div. 2)(A.水,B,模拟)
Codeforces Round #410 (Div. 2)(A,字符串,水坑,B,暴力枚举,C,思维题,D,区间贪心)
A. Mike and palindrome time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Mike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string
Angel_Kitty
2018/04/08
1.1K0
Codeforces Round #410 (Div. 2)(A,字符串,水坑,B,暴力枚举,C,思维题,D,区间贪心)
Codeforces Round #531 (Div. 3) C. Doors Breaking and Repairing(思维)
题目链接:http://codeforces.com/contest/1102/problem/C
Ch_Zaqdt
2019/01/11
4640
Codeforces Round #531 (Div. 3) E. Monotonic Renumeration(思维+差分数组)
题目链接:http://codeforces.com/contest/1102/problem/E
Ch_Zaqdt
2019/01/11
5960
Educational Codeforces Round 55 (Rated for Div. 2) C. Multi-Subject Competition(思维)
题目链接:http://codeforces.com/contest/1082/problem/C
Ch_Zaqdt
2019/01/10
5270
Codeforces Round #541 (Div. 2) C. Birthday(思维)
题目链接:https://codeforces.com/contest/1131/problem/C
Ch_Zaqdt
2019/03/06
4020
Educational Codeforces Round 60 (Rated for Div. 2) B. Emotes(思维)
版权声明:欢迎转载,若转载,请标明出处,如有错误,请指点,也欢迎大佬们给出优化方法 https://blog.csdn.net/Charles_Zaqdt/article/details/87669588
Ch_Zaqdt
2019/03/13
3980
Codeforces Round #527 (Div. 3) A. Uniform String(水题)
题目链接:http://codeforces.com/contest/1092/problem/A
Ch_Zaqdt
2019/01/10
4310
推荐阅读
相关推荐
Codeforces Round #543 (Div. 2, based on Technocup 2019 Final Round) B. Mike and Children(思维)
更多 >
领券
一站式MCP教程库,解锁AI应用新玩法
涵盖代码开发、场景应用、自动测试全流程,助你从零构建专属AI助手
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验