codeforces Gym 100971 A、B、C、F、G、K、L
2018-01-22 21:39
429 查看
A题 直接把问号全部变为陆地如果所有陆地连通 那么再逐个把刚才变成陆地的问号变为水如果依旧连通有多种解
为什么我的代码跑不过去,和网上的题解思路一模一样!!??
View Code
为什么我的代码跑不过去,和网上的题解思路一模一样!!??
#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
相关文章推荐
- codeforces gym 100971 K Palindromization 思路
- Codeforces gym 100971 D. Laying Cables 单调栈
- codeforces Gym 100735 D、E、G、H、I
- Codeforces gym 100685 E
- [物理 杂题] Codeforces Gym 101190 NEERC 16 J. Jenga Boom
- [杂题 交互] Codeforces Gym 101190 NEERC 16 I. Indiana Jones and the Uniform Cave
- codeforces gym 100286 H - Hell on the Markets (贪心算法)
- CodeForcesGym 100502E Opening Ceremony
- Codeforces Gym 100625G Getting Through
- codeforces Gym - 101485 A (2015-2016 Northwestern European Regional Contest (NWERC 2015))
- Codeforces Gym 100269F Flight Boarding Optimization 树状数组维护dp
- Codeforces Gym 100623I Problem I. Important Wires
- Codeforces Gym 100015F Fighting for Triangles 状压DP
- Codeforces Gym 100531J Joy of Flight 变换坐标系
- Codeforces GYM 100753J: Souvenirs 题解
- Codeforces Gym 100187E E. Two Labyrinths bfs
- Codeforces Gym 101190 NEERC 16 .D Delight for a Cat (上下界的费用流)
- Codeforces Gym 100269K Kids in a Friendly Class 构造题
- Codeforces Gym 100418B 暴力
- Codeforces Gym 100286F Problem F. Fibonacci System 数位DP