#include "ramen.h"
#include <algorithm>
using namespace std;
typedef pair <int,int> ppair;
ppair MinMax(int left, int right)
{
pair <int,int> t1;
pair <int,int> t2;
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)
{
pair <int,int> temp;
temp=MinMax(0,N-1);
Answer(temp.first,temp.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 |
Correct |
0 ms |
1124 KB |
Output is correct |
4 |
Correct |
0 ms |
1124 KB |
Output is correct |
5 |
Correct |
0 ms |
1124 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1124 KB |
Output is correct |
2 |
Correct |
0 ms |
1124 KB |
Output is correct |
3 |
Correct |
0 ms |
1124 KB |
Output is correct |
4 |
Correct |
0 ms |
1124 KB |
Output is correct |
5 |
Correct |
0 ms |
1124 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1124 KB |
Output is correct |
2 |
Incorrect |
0 ms |
1124 KB |
Wrong Answer [2] |
3 |
Halted |
0 ms |
0 KB |
- |