답안 #789517

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
789517 2023-07-21T13:01:41 Z NothingXD 라멘 (JOI14_ramen) C++17
100 / 100
1 ms 304 KB
#include "ramen.h"
#include <bits/stdc++.h>

using namespace std;

void debug_out() {cerr << endl;}

template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
	cerr << H << ' ';
	debug_out(T...);
}

#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)

void Ramen(int N) {
	vector<int> mns;
	vector<int> mxs;
	N--;
	for (int i = 0; i < N; i += 2){
		int tmp = Compare(i, i+1);
		if (tmp == 1){
			mns.push_back(i+1);
			mxs.push_back(i);
		}
		else{
			mns.push_back(i);
			mxs.push_back(i+1);
		}
	}
	N++;
	if (N & 1){
		mns.push_back(N-1);
		mxs.push_back(N-1);
	}
	int mn = mns[0];
	for (int i = 1; i < mns.size(); i++){
		int tmp = Compare(mn, mns[i]);
		if (tmp == 1) mn = mns[i];
	}
	int mx = mxs[0];
	for (int i = 1; i < mxs.size(); i++){
		int tmp = Compare(mx, mxs[i]);
		if (tmp == -1) mx = mxs[i];
	}
	Answer(mn, mx);
}

Compilation message

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:37:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for (int i = 1; i < mns.size(); i++){
      |                  ~~^~~~~~~~~~~~
ramen.cpp:42:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |  for (int i = 1; i < mxs.size(); i++){
      |                  ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 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 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct