您的位置:首页 > 其它

codeforces Gym 100971 A、B、C、F、G、K、L

2018-01-22 21:39 429 查看
A题 直接把问号全部变为陆地如果所有陆地连通 那么再逐个把刚才变成陆地的问号变为水如果依旧连通有多种解

为什么我的代码跑不过去,和网上的题解思路一模一样!!??

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <vector>
using namespace std;
const int maxn= 2e5+10;
const int maxm= 1e4+10;
const int inf = 0x3f3f3f3f;
typedef long long ll;
int n;
int a[maxn],b[maxn];
int main()
{
while(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+n+1);
sort(b+1,b+n+1);
int maxa=0,maxb=0,mina,minb,p=0;
for(int i=1,j=1;i<=n;)
{
if(a[i]>b[j])
{
maxa++;
i++;
j++;
}
else
{
i++;
}
}
minb=n-maxa;
for(int i=1,j=1;i<=n;)
{
if(b[i]>a[j])
{
maxb++;
i++;
j++;
}
else
{
i++;
}
}
mina=n-maxb;
//        cout<<maxa<<" "<<mina<<endl;
//        cout<<maxb<<" "<<minb<<endl;
if(maxa>n/2)
{
if(maxb>n/2)
printf("Both\n");
else
printf("First\n");
}
else
{
if(maxb>n/2)
printf("Second\n");
else
printf("None\n");
}
}
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: