Submission #948951

# Submission time Handle Problem Language Result Execution time Memory
948951 2024-03-18T17:07:21 Z IBory 라멘 (JOI14_ramen) C++17
0 / 100
0 ms 348 KB
#include "ramen.h"
#include <bits/stdc++.h>
using namespace std;

void Ramen(int N) {
	Compare(-1, -1);
	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 == 1 ? R : L).push_back(i);
		(n == 1 ? 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]) == 1) a = L[i];
	for (int i = 1; i < R.size(); ++i) if (Compare(R[i], b) == 1) b = R[i];
	Answer(b, a);
	return;
}

Compilation message

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