# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
18883 |
2016-02-16T10:22:52 Z |
chan492811 |
라멘 (JOI14_ramen) |
C++ |
|
0 ms |
1128 KB |
#include "ramen.h"
#include <algorithm>
using namespace std;
int arr[500],max_arr[500],min_arr[500],max1,min1;
int n;
void Ramen(int N) {
int i;
for(i=0;i<N;i++) arr[i]=i;
for(i=0;i<N-1;i+=2){
if(i+1<N && Compare(i,i+1)==1) max_arr[i/2]=i,min_arr[i/2]=i+1;
else max_arr[i/2]=i+1,min_arr[i/2]=i;
}
n=N/2;
max1=max_arr[0]; min1=min_arr[0];
for(i=1;i<n;i++){
if(max1!=max_arr[i] && Compare(max1,max_arr[i])==-1) swap(max1,max_arr[i]);
if(min1!=min_arr[i] && Compare(min1,min_arr[i])==1) swap(min1,min_arr[i]);
}
if(N%2==1){
if(max1!=arr[N-1] && Compare(max1,arr[N-1])==-1) swap(max1,arr[N-1]);
if(min1!=arr[N-1] && Compare(min1,arr[N-1])==1) swap(min1,arr[N-1]);
}
Answer(min1,max1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1128 KB |
Output is correct |
2 |
Correct |
0 ms |
1128 KB |
Output is correct |
3 |
Correct |
0 ms |
1128 KB |
Output is correct |
4 |
Correct |
0 ms |
1128 KB |
Output is correct |
5 |
Correct |
0 ms |
1128 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1128 KB |
Output is correct |
2 |
Correct |
0 ms |
1128 KB |
Output is correct |
3 |
Correct |
0 ms |
1128 KB |
Output is correct |
4 |
Correct |
0 ms |
1128 KB |
Output is correct |
5 |
Correct |
0 ms |
1128 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1128 KB |
Output is correct |
2 |
Correct |
0 ms |
1128 KB |
Output is correct |
3 |
Correct |
0 ms |
1128 KB |
Output is correct |
4 |
Correct |
0 ms |
1128 KB |
Output is correct |
5 |
Correct |
0 ms |
1128 KB |
Output is correct |