QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#377835 | #2367. Hot Springs | Beatrix-0 | WA | 1ms | 3476kb | C++20 | 638b | 2024-04-05 18:34:16 | 2024-04-05 18:34:17 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std ;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n ; cin>> n ;
vector<int>v(n);
for ( int i = 0 ; i < n ; i++ )
{
cin>> v[i];
}
sort ( v.begin() , v.end());
int x = 1 ;
int l = 0 , r = n-1 ;
for ( int i = 0 ; i < n ; i++ )
{
if ( x % 2 != 0 )
{
cout << v[r] << ' ';
r--;
x = 2 ;
}
else
{
cout << v[l] << ' ';
l++;
x = 1 ;
}
}
return 0 ;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3476kb
input:
5 1 -1 2 -1 -1
output:
2 -1 1 -1 -1
result:
wrong answer Contestants list of integers did not satisfy the requirement.