Submission #723349

# Submission time Handle Problem Language Result Execution time Memory
723349 2023-04-13T15:57:15 Z Richem Measures (CEOI22_measures) C++14
10 / 100
1500 ms 3624 KB
#include <iostream>
#include <vector>
#include <algorithm>
#define int long long
using namespace std;

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

signed 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; fin < pos.size(); fin++) {
                    total = max(total, (fin - deb) * distMin - pos[fin] + pos[deb]);
               }
          }

          cout << total/2;
          if(total % 2 == 1) {
               cout << ".5";
          }
          cout << " ";
     }

     
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:29:32: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |           for(int deb = 0; deb < pos.size(); deb++) {
      |                            ~~~~^~~~~~~~~~~~
Main.cpp:30:39: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |                for(int fin = deb; fin < pos.size(); fin++) {
      |                                   ~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 22 ms 212 KB Output is correct
2 Correct 22 ms 212 KB Output is correct
3 Correct 23 ms 212 KB Output is correct
4 Correct 22 ms 212 KB Output is correct
5 Correct 22 ms 212 KB Output is correct
6 Correct 22 ms 212 KB Output is correct
7 Correct 22 ms 212 KB Output is correct
8 Correct 23 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 212 KB Output is correct
2 Correct 22 ms 212 KB Output is correct
3 Correct 23 ms 212 KB Output is correct
4 Correct 22 ms 212 KB Output is correct
5 Correct 22 ms 212 KB Output is correct
6 Correct 22 ms 212 KB Output is correct
7 Correct 22 ms 212 KB Output is correct
8 Correct 23 ms 212 KB Output is correct
9 Execution timed out 1571 ms 3624 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1571 ms 448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1571 ms 448 KB Time limit exceeded
2 Halted 0 ms 0 KB -