Submission #1112506

#TimeUsernameProblemLanguageResultExecution timeMemory
1112506vjudge1Baloni (COCI15_baloni)C++17
0 / 100
2079 ms3664 KiB
#include <bits/stdc++.h> using namespace std; int main() { long long int s = 0, a; cin >> a; vector<int> d(a); for (long long int i = 0; i < a; i++) { cin >> d[i]; } while (true) { long long int maxi = -1, max = INT_MIN; for (long long int i = 0; i < d.size(); i++) { if (d[i] > max) { max = d[i]; maxi = i; } } if (maxi == -1) { break; } long long int ua = -1; for (long long int i = maxi; i < d.size() - 1; i++) { if (d[i] - 1 == d[i + 1]) { d.erase(d.begin() + i); ua = i; i--; } else { break; } } if (ua != -1 && ua < d.size()) { d.erase(d.begin() + ua); } s++; } cout << s; return 0; }

Compilation message (stderr)

baloni.cpp: In function 'int main()':
baloni.cpp:17:37: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for (long long int i = 0; i < d.size(); i++) {
      |                                   ~~^~~~~~~~~~
baloni.cpp:30:40: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         for (long long int i = maxi; i < d.size() - 1; i++) {
      |                                      ~~^~~~~~~~~~~~~~
baloni.cpp:40:28: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         if (ua != -1 && ua < d.size()) {
      |                         ~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...