Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
48191 小号 【AB-1】游戏 C++ 解答错误 60 0 MS 252 KB 901 2022-04-10 15:57:51

Tests(6/10):


#include <bits/stdc++.h> using namespace std; int minn,maxn,n,now,opt=1,Max,Min,f=1; vector<int>a(105,0); inline void A() { maxn=0x7ffffff; for(int i=0; i<now-1; i++) if(max(a[i],a[i+1])<maxn) maxn=max(a[i],a[i+1]),Max=a[i]>a[i+1]?i:i+1; a.erase(a.begin()+Max); } inline void B() { maxn=-1; for(int i=0; i<now-1; i++) if(min(a[i],a[i+1])>minn) minn=min(a[i],a[i+1]),Min=a[i]<a[i+1]?i:i+1; a.erase(a.begin()+Min); } void solve() { scanf("%d", &n); for(int i(0); i<n; i++) scanf("%d", &a[i]); for(int i(0); i<n; i++) if(a[i] != 0) f = 0; now = n; while(now > 1) { if(opt == 1) A(); else B(); opt == 1 ? opt = 0 : opt = 1, now--; Max = Min = 0; } if(f == 1) puts("0"); else printf("%d\n", a[0]); } int main() { // freopen("game.in","r",stdin); //freopen("game.out","w",stdout); solve(); return 0; }


测评信息: