Submission #723335

#TimeUsernameProblemLanguageResultExecution timeMemory
723335RichemMeasures (CEOI22_measures)C++14
0 / 100
1573 ms424 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

const int MAX_NOMBRE = 1000;

int nbDebut, nbAjout, distMin;
vector<int> pos;

int main() {
     cin >> nbDebut >> nbAjout >> distMin;

     for(int i = 0; i < nbDebut; i++) {
          int cur;
          cin >> cur;
          pos.push_back(cur);
     }
     
     for(int req = 0; req < nbAjout; req++) {
          int nouv;
          cin >> nouv;

          pos.push_back(nouv);

          sort(pos.begin(), pos.end());

          int total = 0;

          for(int deb = 0; deb < pos.size(); deb++) {
               for(int fin = deb+1; fin < pos.size(); fin++) {
                    total = max(total, (fin - deb) * distMin - pos[fin] + pos[deb]);
               }
          }

          cout << total/2.0 << " ";
     }

     
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:30:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |           for(int deb = 0; deb < pos.size(); deb++) {
      |                            ~~~~^~~~~~~~~~~~
Main.cpp:31:41: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |                for(int fin = deb+1; fin < pos.size(); fin++) {
      |                                     ~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...