CF1121A Technogoblet of Fire 题解
题面。
AC,但是不知道为什么 UKE。这哪里是编程题,简直就是阅读理解。
思路
输入的 \(n\),\(m\),\(k\) 分别表示学生数,学校数,阿卡迪想要的天选之子的数量(虽然我不知道为啥会翻译成天选之子)。
注意了,原文中一句话
Unfortunately, not all of them are the strongest in their schools。
这句话的意思应该翻译成:“不幸的是,并不是所有学生都是他们的学校里最强的”,而不是“不幸的是,并不是所有的学校都是最强的”。这里真的很影响对题意的理解。
接下来的 \(a\),\(b\) 数组都很好解释。来看 \(c\) 数组。\(c\) 数组表示阿卡迪想抽中的学生。而我们知道科技火焰杯(其实就是题目翻译)只会选择最强的,那么只需要让阿卡迪想抽中的学生是哪个学校最强的就好了。
对于一个已经是哪个学校最强的学生,无需新增学校名,否则就新增一所学校名即可。
代码
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<ctime>
#include<cstring>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<sstream>
#include<cassert>
#include<stdio.h>
#define ll long long
#define inf 0x3f3f3f3f
#define fr(i , a , b) for(ll i = a ; i <= b ; ++i)
#define fo(i , a , b) for(ll i = a ; i >= b ; --i)
using namespace std;
inline char gchar()
{
static char buf[1000000] , *p1 = buf , *p2 = buf;
return p1 == p2 && (p2 = (p1 = buf) + fread(buf , 1 , 1000000 , stdin) , p1 == p2) ? EOF : *p1++;
}
inline ll read()
{
ll x = 0 , f = 1;
char ch = getchar();
while(ch < '0' || ch > '9')
{
if(ch == '-')
{
f = -1;
}
ch = getchar();
}
while(ch >= '0' && ch <= '9')
{
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x * f;
}
ll n , m , k;
ll a[101] , b[101] , c;
ll maxn[101] , sum;
signed main()
{
memset(maxn , -1 , sizeof(maxn));
n = read();
m = read();
k = read();
fr(i , 1 , n)
{
a[i] = read();
}
fr(i , 1 , n)
{
b[i] = read();
maxn[b[i]] = max(maxn[b[i]] , a[i]);
}
fr(i , 1 , k)
{
c = read();
if(maxn[b[c]] != a[c])
{
sum++;
}
}
printf("%lld" , sum);
system("pause");
return 0;
}
- 一个好的指挥官不会背叛他的军队,无论代价是什么。
- 一个更好的指挥官知道当他想背叛他的军队时,什么时候应该伪装。
- 一个最好的指挥官精明地确立自己的绝对领导,并引领着人民走向更好的未来。