0
已解决
阿巴
资深守护
资深守护
#include<iostream>
#include<algorithm>
using namespace std;
int n;
int a[1005];
int b[1005];
int l1,l2,r1,r2;
int win,lose;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n;i++){
cin>>b[i];
}
sort(a+1,a+1+n);
sort(b+1,b+1+n);
l1=l2=1;
r1=r2=n;
while(n--){
if(a[r1]>b[r2]){
win++;
r1--,r2--;
}else if(a[r1]<b[r2]){
lose++;
l1++,r2--;
}else{
if(a[l1]>b[l2]){
win++;
l1++,l2++;
}else if(a[l1]<b[l2]){
lose++;
l1++,r2--;
}else{
if(a[l1]<b[r2]){
lose++;
}
l1++,r2--;
}
}
}
cout<<(win-lose)*50;
return 0;
}
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
int g[1005][1005];
bool vis[1005];
int n,m,st;
queue<int> q;
void bfs(int st){
q.push(st);
vis[st]=true;
while(!q.empty()){
int t=q.front();
q.pop();
cout<<t<<' ';
for(int i=1;i<=n;i++){
if(!vis[i]&&g[t][i]){
q.push(i);
vis[i]=true;
}
}
}
}
int a,b;
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
cin>>n>>m;
for(int i=1;i<=m;i++){
cin>>a>>b;
g[a][b]=g[b][a]=1;
}
cin>>st;
bfs(st);
//fclose(stdin);
//fclose(stdout);
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int x,n,m;
int a[40005],b[40005],c[40005],d[40005],e[40005],f[40005];
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
cin>>n>>m;
for(int i=1;i<=m;i++){
cin>>f[i];
e[f[i]]++;
}
for(int i=1;i*9+1<=n;i++){
x=0;
for(int j=n-9*i-1;j>=1;j--){
x+=e[j+8*i+1]*e[j+9*i+1];
a[j]+=e[j+2*i]*x;
b[j+2*i]+=e[j]*x;
}
x=0;
for(int j=1;j<=n-9*i-1;j++){
x+=e[j]*e[j+2*i];
c[j+8*i+1]+=e[j+9*i+1]*x;
d[j+9*i+1]+=e[j+8*i+1]*x;
}
}
for(int i=1;i<=m;i++){
cout<<a[f[i]]<<' '<<b[f[i]]<<' '<<c[f[i]]<<' '<<d[f[i]]<<endl;
}
//fclose(stdin);
//fclose(stdout);
return 0;
}
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
struct point{
int x,y;
}p[100005],s1,s2;
int dis(point a,point b){
return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
bool cmp(point a,point b){
return dis(a,s1)>dis(b,s1);
}
int n,ans;
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
cin>>s1.x>>s1.y>>s2.x>>s2.y;
cin>>n;
for(int i=1;i<=n;i++){
cin>>p[i].x>>p[i].y;
}
sort(p+1,p+n+1,cmp);
ans=dis(p[1],s1);
int dis1,dis2=0;
for(int i=1;i<=n;i++){
dis1=dis(p[i+1],s1);
dis2=max(dis2,dis(p[i],s2));
ans=min(ans,dis1+dis2);
}
cout<<ans;
//fclose(stdin);
//fclose(stdout);
return 0;
}
亿些AC代码题号自己猜
阿巴在2021-07-14 15:24:08追加了内容
顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶
0
0
0
0
0
0