답안 #542784

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
542784 2022-03-28T03:51:43 Z adamjinwei 라멘 (JOI14_ramen) C++14
100 / 100
1 ms 312 KB
#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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 308 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 312 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 308 KB Output is correct