답안 #723341

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
723341 2023-04-13T15:49:10 Z Richem Measures (CEOI22_measures) C++14
0 / 100
1500 ms 448 KB
#include <iostream>
#include <vector>
#include <algorithm>
#define int long long
using namespace std;

const int MAX_NOMBRE = 1000;

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

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

     
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:31: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]
   31 |           for(int deb = 0; deb < pos.size(); deb++) {
      |                            ~~~~^~~~~~~~~~~~
Main.cpp:32:41: 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]
   32 |                for(int fin = deb+1; fin < pos.size(); fin++) {
      |                                     ~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 212 KB Output is correct
2 Incorrect 23 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 212 KB Output is correct
2 Incorrect 23 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1554 ms 448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1554 ms 448 KB Time limit exceeded
2 Halted 0 ms 0 KB -