Submission #62935

#TimeUsernameProblemLanguageResultExecution timeMemory
62935sean617라멘 (JOI14_ramen)C++98
100 / 100
4 ms656 KiB
#include "ramen.h" #include<vector> #include<iostream> using namespace std; vector<int> mn, mx; void Ramen(int N) { int i, n = N, t, t1, t2, ans1, ans2; for (i = 0; i < n - (n % 2); i += 2) { t = Compare(i, i + 1); t1 = i; t2 = i + 1; if (t == 1) swap(t1, t2); mn.push_back(t1); mx.push_back(t2); } if (n % 2 == 1) { mn.push_back(n - 1); mx.push_back(n - 1); } ans2 = mn[0]; for (i = 1; i < mn.size(); i++) { if (Compare(ans2, mn[i]) == 1) ans2 = mn[i]; } ans1 = mx[0]; for (i = 1; i < mx.size(); i++) { if (Compare(ans1, mx[i]) == -1) ans1 = mx[i]; } Answer(ans2, ans1); }

Compilation message (stderr)

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:21:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 1; i < mn.size(); i++) {
              ~~^~~~~~~~~~~
ramen.cpp:25:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 1; i < mx.size(); i++) {
              ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...