제출 #1112420

#제출 시각아이디문제언어결과실행 시간메모리
1112420vjudge1Baloni (COCI15_baloni)C++17
0 / 100
2078 ms11540 KiB
#include <bits/stdc++.h> using namespace std; int mileh(int n, vector<int>& h) { int a = 0; while (!h.empty()) { int m = h[0]; a++; vector<int> nh; bool p = false; for (int i = 0; i < h.size(); i++) { if (h[i] == m && !p) { p = true; continue; } if (p && h[i] < m) { m = h[i]; } else if (h[i] >= m) { nh.push_back(h[i]); } } h = nh; } return a; } int main() { int n; cin >> n; vector<int> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } cout << mileh(n, h) << endl; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

baloni.cpp: In function 'int mileh(int, std::vector<int>&)':
baloni.cpp:15:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |         for (int i = 0; i < h.size(); i++) {
      |                         ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...