답안 #948943

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
948943 2024-03-18T16:52:41 Z IBory 라멘 (JOI14_ramen) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
#include "ramen.h"
using namespace std;

void Ramen(int N) {
	if (N == 1) {
		Answer(0, 0);
		return;
	}

	vector<int> L, R;
	for (int i = 0; i < N - 1; i += 2) {
		int n = Compare(i, i + 1);
		(n ? R : L).push_back(i + 1);
		(n ? L : R).push_back(i);
	}
	if (N & 1) L.push_back(N - 1), R.push_back(N - 1);

	int a = L[0], b = R[0];
	for (int i = 1; i < L.size(); ++i) if (Compare(a, L[i])) a = L[i];
	for (int i = 1; i < R.size(); ++i) if (Compare(R[i], b)) b = R[i];
	Answer(a, b);
}

Compilation message

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:20:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  for (int i = 1; i < L.size(); ++i) if (Compare(a, L[i])) a = L[i];
      |                  ~~^~~~~~~~~~
ramen.cpp:21:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for (int i = 1; i < R.size(); ++i) if (Compare(R[i], b)) b = R[i];
      |                  ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 348 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 348 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 348 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -