#include "ramen.h"
#include <algorithm>
using namespace std;
typedef pair <int,int> ppair;
pair <int,int> t1;
pair <int,int> t2;
ppair MinMax(int left, int right)
{
int i, mid, MIN, MAX;
if(left==right)
return make_pair(left,right);
else if(left+1==right)
{
if(Compare(left,right)==-1)
return make_pair(left,right);
else
return make_pair(right,left);
}
else
{
mid=(left+right)/2;
t1=MinMax(left,mid);
t2=MinMax(mid+1,right);
if(Compare(t1.first,t2.first)==-1)
MIN=t1.first;
else
MIN=t2.first;
if(Compare(t1.second,t2.second)==-1)
MAX=t2.second;
else
MAX=t1.second;
return make_pair(MIN,MAX);
}
}
void Ramen(int N)
{
t1=MinMax(0,N-1);
Answer(t1.first,t1.second);
}
Compilation message
ramen.cpp: In function 'ppair MinMax(int, int)':
ramen.cpp:12:9: warning: unused variable 'i' [-Wunused-variable]
int i, mid, MIN, MAX;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1124 KB |
Output is correct |
2 |
Correct |
0 ms |
1124 KB |
Output is correct |
3 |
Incorrect |
0 ms |
1124 KB |
Wrong Answer [1] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1124 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1124 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |