UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#205480#3658. 删数游戏OccDreamer100399ms1912kbC++112.1kb2024-07-07 09:14:492024-07-07 13:18:11

answer

//Mashiroqwq
#include<bits/stdc++.h>

#define vc vector
#define db double
#define fi first
#define se second
#define ll long long
#define mk make_pair
#define pb push_back
#define RI register int
#define PI pair<int,int>
#define ull unsigned long long
#define err cerr << "   -_-   " << endl
#define debug cerr << " ------------------- " << endl

#define input(x) freopen(#x".in","r",stdin)
#define output(x) freopen(#x".out","w",stdout)

#define NO puts("No")
#define YES puts("Yes")

//#define OccDreamer
//#define int long long

using namespace std;

namespace IO{
	inline int read(){
		int X=0, W=0; char ch=getchar();
		while(!isdigit(ch)) W|=ch=='-', ch=getchar();
		while(isdigit(ch)) X=(X<<1)+(X<<3)+(ch^48), ch=getchar();
		return W?-X:X;
	}
	inline void write(int x){
		if(x<0) x=-x, putchar('-');
		if(x>9) write(x/10);
		putchar(x%10+'0');
	}
	inline void sprint(int x){write(x), putchar(32);}
	inline void eprint(int x){write(x), putchar(10);}
}using namespace IO;

const int MAXN = 1e5+5;
const int mod = 998244353;

int n;
int a[MAXN], b[MAXN], c[MAXN];

bool f[1003][1003];
bool vis[1003][1003];

inline bool dfs(int l, int r){
	if(l==r) return c[l];
	if(vis[l][r]) return f[l][r];
	vis[l][r]=1; int o=l-1+n-r;
	if(o&1){
		if(dfs(l+1,r)==0 || dfs(l,r-1)==0) f[l][r]=0;
		else f[l][r]=1;	
	}
	else{
		if(dfs(l+1,r)==1 || dfs(l,r-1)==1) f[l][r]=1;
		else f[l][r]=0;	
	}
	return f[l][r];
}

inline bool check(int lim){
	for(int i=1;i<=n;++i) c[i]=a[i]>=lim, cout << c[i] << ' ';
	cout << endl;
	memset(vis,0,sizeof vis); bool res=dfs(1,n);
	for(int i=2;i<=n;++i, cout << endl)
		for(int j=1, k=i;k<=n;++j, ++k) cout << f[j][k] << ' ';
	cout << endl;
	return res;
}

inline void solve(){
	n=read();	
	for(int i=1;i<=n;++i) a[i]=read(), b[i]=a[i];
	if(n==1) return eprint(a[1]), void();
	if(n%2==0) eprint(max(a[n/2],a[n/2+1]));
	else eprint(max(min(a[n/2],a[n/2+1]),min(a[n/2+1],a[n/2+2])));
}

signed main(){
	int t=read();
	while(t--) solve();
	return 0;
}



















































详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1132kb

input:

10
3
613758771 356937637 286925413
3
309635201 4119573 12672577
3
908539837 376256867 673742215
3
25...

output:

356937637
4119573
376256867
29280187
378806137
500071651
148732984
491253760
231506155
208737943

result:

ok 10 lines

Test #2:

score: 10
Accepted
time: 0ms
memory: 1136kb

input:

10
3
10931386 117297147 159933961
3
90337741 212594593 98873674
3
129454241 303988881 730905561
3
75...

output:

117297147
98873674
303988881
15612529
356387186
550811017
407438865
51789077
107735813
151748426

result:

ok 10 lines

Test #3:

score: 10
Accepted
time: 1ms
memory: 1140kb

input:

10
1000
167905485 208763751 138626601 932784449 228519721 282400288 132186355 15872271 92282711 1325...

output:

403988845
457552801
388265001
10811020
705772900
114763687
659759507
307132303
354245321
52388641

result:

ok 10 lines

Test #4:

score: 10
Accepted
time: 0ms
memory: 1140kb

input:

10
1000
106935067 125402369 613861873 127608150 118554097 28464487 542845281 156683332 14063068 3248...

output:

141900130
846636441
649729872
24210741
613578049
243179119
546303628
238813241
105984529
610132501

result:

ok 10 lines

Test #5:

score: 10
Accepted
time: 2ms
memory: 1140kb

input:

10
1000
411526119 637006177 911588822 496496161 61356302 111514144 542096029 760634253 672439501 662...

output:

461178612
567420205
376347565
196693046
209902232
329106989
136551481
962827830
235347389
593955181

result:

ok 10 lines

Test #6:

score: 10
Accepted
time: 73ms
memory: 1912kb

input:

10
100000
718749825 746785710 27749441 41444821 259131727 172557178 793955441 99599666 163197987 188...

output:

297493249
413115093
708045870
716500401
175485168
799161715
700496161
460682083
241487782
70418526

result:

ok 10 lines

Test #7:

score: 10
Accepted
time: 77ms
memory: 1912kb

input:

10
100000
27978370 4374151 754505581 132813041 320978233 345428200 623829321 71676746 291401501 1585...

output:

104182345
309479031
328440619
146794570
265110993
411769891
633244971
501695415
196061569
544061920

result:

ok 10 lines

Test #8:

score: 10
Accepted
time: 77ms
memory: 1912kb

input:

10
100000
798861877 388220845 79152789 386994909 245031499 68960243 96481409 432630870 15115816 8533...

output:

195962218
260552755
911776641
402660721
119793143
274866561
314728574
503302149
753573121
792835121

result:

ok 10 lines

Test #9:

score: 10
Accepted
time: 89ms
memory: 1908kb

input:

10
100000
499504565 41637903 385913456 724832195 97810294 237878941 44757307 19358717 822946397 6529...

output:

300631009
536510449
579244986
735966766
125851446
712283829
113242101
622967187
165130096
203337377

result:

ok 10 lines

Test #10:

score: 10
Accepted
time: 80ms
memory: 1908kb

input:

10
100000
30813538 582753601 68526921 602383881 25599691 58344973 337240 254442202 56661307 10202082...

output:

387102581
429962248
434239070
27726119
309516446
534466201
454709979
519867587
336570310
80091964

result:

ok 10 lines