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 <bits/stdc++.h>
#include "ramen.h"
#define inf 1000000007
#define mod 1000000007
// #define int long long
// #pragma GCC optimize("Ofast","inline","-ffast-math")
// #pragma GCC target("avx,sse2,sse3,sse4,mmx")
using namespace std;
template <typename T> void read(T &x){
x=0;char ch=getchar();int fh=1;
while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
x*=fh;
}
template <typename T> void write(T x) {
if (x<0) x=-x,putchar('-');
if (x>9) write(x/10);
putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
write(x);
puts("");
}
int n;
int mx[405],mn[405];
void Ramen(int N)
{
n=N;
for(int i=0;i+1<n;i+=2)
{
int ret=Compare(i,i+1);
if(ret==1) mx[i/2]=i,mn[i/2]=i+1;
else mx[i/2]=i+1,mn[i/2]=i;
}
if(n&1) mx[n/2]=mn[n/2]=n-1;
int mx0=mx[0],mn0=mn[0];
for(int i=1;i<=(n-1)/2;++i)
{
int ret=Compare(mx0,mx[i]);
if(ret==-1) mx0=mx[i];
ret=Compare(mn0,mn[i]);
if(ret==1) mn0=mn[i];
}
Answer(mn0,mx0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |