Submission #789517

#TimeUsernameProblemLanguageResultExecution timeMemory
789517NothingXD라멘 (JOI14_ramen)C++17
100 / 100
1 ms304 KiB
#include "ramen.h" #include <bits/stdc++.h> using namespace std; void debug_out() {cerr << endl;} template<typename Head, typename... Tail> void debug_out(Head H, Tail... T){ cerr << H << ' '; debug_out(T...); } #define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__) void Ramen(int N) { vector<int> mns; vector<int> mxs; N--; for (int i = 0; i < N; i += 2){ int tmp = Compare(i, i+1); if (tmp == 1){ mns.push_back(i+1); mxs.push_back(i); } else{ mns.push_back(i); mxs.push_back(i+1); } } N++; if (N & 1){ mns.push_back(N-1); mxs.push_back(N-1); } int mn = mns[0]; for (int i = 1; i < mns.size(); i++){ int tmp = Compare(mn, mns[i]); if (tmp == 1) mn = mns[i]; } int mx = mxs[0]; for (int i = 1; i < mxs.size(); i++){ int tmp = Compare(mx, mxs[i]); if (tmp == -1) mx = mxs[i]; } Answer(mn, mx); }

Compilation message (stderr)

ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:37:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for (int i = 1; i < mns.size(); i++){
      |                  ~~^~~~~~~~~~~~
ramen.cpp:42:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |  for (int i = 1; i < mxs.size(); i++){
      |                  ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...