QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#847820 | #9989. Harmful Machine Learning | The_Shadow_Dragon | WA | 93ms | 3680kb | C++14 | 975b | 2025-01-08 11:39:40 | 2025-01-08 11:39:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define sort stable_sort
#define endl '\n'
int a[200010];
priority_queue<int,vector<int>,less<int> >q1;
priority_queue<int,vector<int>,greater<int> >q2;
int main()
{
// #define Isaac
#ifdef Isaac
freopen("in.in","r",stdin);
freopen("out.out","w",stdout);
#endif
int t,n,x,i,j;
cin>>t;
for(j=1;j<=t;j++)
{
cin>>n>>x;
while(q1.empty()==0)
{
q1.pop();
}
while(q2.empty()==0)
{
q2.pop();
}
for(i=1;i<=n;i++)
{
cin>>a[i];
if(abs(i-x)<=1)
{
q1.push(a[i]);
}
else
{
q2.push(a[i]);
}
}
sort(a+1,a+1+n);
if(n<=4)
{
cout<<a[min(3,n)]<<endl;
}
else
{
if(q1.size()==2)
{
cout<<q2.top()<<endl;
}
else
{
if(q1.top()>q2.top())
{
q1.pop();
q1.push(q2.top());
}
cout<<q1.top()<<endl;
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3536kb
input:
4 3 2 1 2 3 13 4 1 1 4 5 1 4 1 9 1 9 8 1 0 4 2 1 10 100 1000 1 1 114514
output:
3 4 100 114514
result:
ok 4 lines
Test #2:
score: -100
Wrong Answer
time: 93ms
memory: 3680kb
input:
100000 1 1 1 5 4 1 0 0 0 0 5 4 0 1 1 0 1 2 2 1 1 1 1 1 4 3 0 0 0 1 1 1 0 2 1 1 0 2 2 0 1 3 3 0 0 1 3 1 1 0 0 1 1 1 2 1 0 1 5 4 0 1 1 1 1 1 1 1 5 5 0 0 0 1 0 2 1 1 0 4 4 1 0 0 1 3 2 0 0 1 5 3 1 1 1 0 1 3 3 0 0 1 2 2 1 1 4 1 1 1 0 1 4 1 0 0 1 1 1 1 0 5 4 1 0 1 0 0 4 3 0 0 1 1 1 1 1 3 3 0 1 1 5 4 1 0 0...
output:
1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0 0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 1 0 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 0 1 0 0 0 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 0 0 1 1 1 0 1 0 1 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 0 0 1 0 0 1 1 1 1 ...
result:
wrong answer 60th lines differ - expected: '1', found: '0'