社区讨论
求调()孩子们这个比NOIP2025难
P1650田忌赛马参与者 1已保存回复 0
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @mjgz6nch
- 此快照首次捕获于
- 2025/12/22 17:50 3 个月前
- 此快照最后确认于
- 2025/12/24 22:30 2 个月前
CPP
#include<bits/stdc++.h>
#define int __int128
#define pc putchar
using namespace std;
namespace IO{
inline int rd(){
int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){
if(c=='-'){
f=-1;
}
c=getchar();
}
while(c>='0'&&c<='9'){
x=(x<<1)+(x<<3)+(c^48);
c=getchar();
}
return x*f;
}
inline void wt(int x){
if(x<0){
x=-x;
pc('-');
}
if(x>9){
wt(x/10);
pc(x%10+'0');
}
else{
pc(x+'0');
}
return ;
}
}
using namespace IO;
namespace Main{
const int N=2010;
int n,res;
int s[N];
bool st[N];
priority_queue<int,vector<int>,less<int>> q;
inline void main(){
n=rd();
for(int i=1;i<=n;i++){
s[i]=rd();
}
for(int i=1;i<=n;i++){
q.push(rd());
}
sort(s+1,s+n+1);
for(int i=1;i<=n;i++){
auto t=q.top();
q.pop();
int tr=91;
for(int j=1;j<=n;j++){
if(st[j]){
continue;
}
if(s[j]>t){
tr=11;
st[j]=1;
res+=200;
break;
}
else if(s[j]<t&&tr>0){
tr=-j;
}
else if(s[j]==t&&tr>0){
tr=100+j;
}
}
if(tr>100){
st[tr-100]=1;
}
else if(tr<0){
res-=200;
st[-tr]=1;
}
}
wt(res);
return ;
}
}
signed main(){
Main::main();
return 0;
}
/*
3
92 83 71
95 87 74
200
*/
回复
共 0 条回复,欢迎继续交流。
正在加载回复...