Submission #62984

# Submission time Handle Problem Language Result Execution time Memory
62984 2018-07-31T05:44:26 Z sean617 라멘 (JOI14_ramen) C++
100 / 100
3 ms 656 KB
#include "ramen.h"
#include <vector>
using namespace std;

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

Compilation message

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:20:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 1; i < mn.size(); i++) if (Compare(mni, mn[i]) == 1) mni = mn[i];
              ~~^~~~~~~~~~~
ramen.cpp:21:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 1; i < mx.size(); i++) if (Compare(mxi, mx[i]) == -1) mxi = mx[i];
              ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 516 KB Output is correct
3 Correct 0 ms 516 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 2 ms 516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 516 KB Output is correct
2 Correct 2 ms 520 KB Output is correct
3 Correct 2 ms 572 KB Output is correct
4 Correct 3 ms 624 KB Output is correct
5 Correct 3 ms 656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 656 KB Output is correct
2 Correct 3 ms 656 KB Output is correct
3 Correct 2 ms 656 KB Output is correct
4 Correct 3 ms 656 KB Output is correct
5 Correct 3 ms 656 KB Output is correct