답안 #31958

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
31958 2017-09-19T12:00:37 Z huynd2001 라멘 (JOI14_ramen) C++14
80 / 100
0 ms 2036 KB
#include "ramen.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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2036 KB Output is correct
2 Incorrect 0 ms 2036 KB Wrong Answer [1]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2036 KB Output is correct
2 Correct 0 ms 2036 KB Output is correct
3 Correct 0 ms 2036 KB Output is correct
4 Correct 0 ms 2036 KB Output is correct
5 Correct 0 ms 2036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2036 KB Output is correct
2 Correct 0 ms 2036 KB Output is correct
3 Correct 0 ms 2036 KB Output is correct
4 Correct 0 ms 2036 KB Output is correct
5 Correct 0 ms 2036 KB Output is correct