# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31957 | huynd2001 | 라멘 (JOI14_ramen) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "grader.h"
#include <bits/stdc++.h>
// int it2[4007],it1[4007];
int a[4007];
void Ramen(int n) {
for(int i=1;i<=n;i++) a[i]=i-1;
int tg;
for(int i=1;i<=n;i+=2)
{
if(i<n)
{
if(Compare(a[i],a[i+1])==1) tg=a[i+1],a[i+1]=a[i],a[i]=tg;
}
}
int ma=-1,mi=-1;
for(int i=1;i<=n;i+=2)
{
if(ma==-1) ma=a[i]; else if(Compare(ma,a[i])==1) ma=a[i];
}
for(int i=2;i<=n;i+=2)
{
if(mi==-1) mi=a[i]; else if(Compare(mi,a[i])==-1) mi=a[i];
}
if(n%2==1)
{
if(Compare(ma,a[n])==1) ma=a[n];
if(Compare(mi,a[n])==-1) mi=a[n];
}
Answer(ma,mi);
}