ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#205484 | #3658. 删数游戏 | nullptr_qwq | 100 | 379ms | 1536kb | C++11 | 1.2kb | 2024-07-07 10:51:01 | 2024-07-07 13:18:42 |
answer
// 私は猫です
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define inf 1000000000
#define infll 1000000000000000000ll
#define pii pair<int,int>
#define rep(i,a,b,c) for(int i=(a);i<=(b);i+=(c))
#define per(i,a,b,c) for(int i=(a);i>=(b);i-=(c))
#define F(i,a,b) for(int i=(a);i<=(b);i++)
#define dF(i,a,b) for(int i=(a);i>=(b);i--)
#define cmh(sjy) while(sjy--)
#define lowbit(x) (x&(-x))
#define HH printf("\n")
#define eb emplace_back
#define poly vector<int>
using namespace std;
ll read(){
ll x=0,f=1;char c=getchar();
while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
while(c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
return x*f;
}
const int mod=998244353,maxn=500005;
int a[maxn],n;
void solve(){
n=read();
F(i,1,n)a[i]=read();
if(n==1)return printf("%d\n",a[1]),void();
if(!(n&1)){
int mid=n>>1;
if(a[mid]>a[mid+1])printf("%d\n",a[mid]);
else printf("%d\n",a[mid+1]);
}else{
int mid=(n+1)>>1,x=a[mid-1],y=a[mid],z=a[mid+1];
printf("%d\n",max(min(y,z),min(x,y)));
}
}
signed main(){
int sjy=read();
cmh(sjy) solve();
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1148kb
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: 1144kb
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: 1152kb
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: 1148kb
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: 1ms
memory: 1152kb
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: 1536kb
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: 71ms
memory: 1536kb
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: 87ms
memory: 1536kb
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: 70ms
memory: 1532kb
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: 76ms
memory: 1532kb
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