답안 #948954

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
948954 2024-03-18T17:25:10 Z IBory 라멘 (JOI14_ramen) C++17
100 / 100
1 ms 600 KB
#include "ramen.h"
#include <bits/stdc++.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; i += 2) {
		if (i + 1 == N) break;
		int n = Compare(i, i + 1);
		(n > 0 ? R : L).push_back(i);
		(n > 0 ? L : R).push_back(i + 1);
	}
	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]) > 0) a = L[i];
	for (int i = 1; i < R.size(); ++i) if (Compare(R[i], b) > 0) b = R[i];
	Answer(a, b);
}

Compilation message

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