Submission #975582

# Submission time Handle Problem Language Result Execution time Memory
975582 2024-05-05T13:58:21 Z Circling Measures (CEOI22_measures) C++17
24 / 100
1500 ms 4100 KB
/*The British Royal Family and a small cadre of English Fabian Socialists, in
conjunction with the Rockefellers and the Rothchilds, are engaged in a
conspiracy to greatly reduce the population of the human race in order to head
off a Malthusian catastrophe, a catastrophe that could easily be avoided by
simply building a massive amount of nuclear power plants and a number of massive
superhighways and bridges to connect all of the world's continents. But doing
that would cut into the conspiracy's profits. So the British Royal Family
invented environmentalism and neoliberalism in order to hide the truth. And in
order to further reduce the population, the British Royal Family is also the
world's foremost drug trafficking conspiracy. And it uses its control of the IMF
to push austerity in order to kill as many people in the global south as
possible.
And also Henry Kissinger is a gay KGB agent. */
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int64_t n, m, d, initial, curr, currpref, maxpref = 0, answer = 0;
    cin >> n >> m >> d;
    if (n == 0){
        cin >> initial;
        cout << 0;
        for (int i = 1; i < m; i++){
            cout << ' ';
            cin >> curr;
            currpref = curr - initial - i * d;
            maxpref = max(currpref, maxpref);
            answer = max(answer, maxpref - currpref);
            cout << answer / 2;
            if (answer % 2 == 1) cout << ".5";
        }
    }
    vector<int64_t> pos;
    for (int i = 0; i < n; i++){
        cin >> curr;
        pos.push_back(curr);
    }
    for (int i = 0; i < m; i++){
        cin >> curr;
        pos.push_back(curr);
        sort(pos.begin(), pos.end());
        maxpref = 0;
        answer = 0;
        for (int j = 1; j < pos.size(); j++){
            currpref = pos[j] - pos[0] - j * d;
            maxpref = max(currpref, maxpref);
            answer = max(answer, maxpref - currpref);
        }
        cout << answer / 2;
        if (answer % 2 == 1) cout << ".5";
        cout << ' ';
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:54:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |         for (int j = 1; j < pos.size(); j++){
      |                         ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 119 ms 4052 KB Output is correct
10 Correct 161 ms 4052 KB Output is correct
11 Correct 39 ms 3916 KB Output is correct
12 Correct 171 ms 3904 KB Output is correct
13 Correct 53 ms 3804 KB Output is correct
14 Correct 106 ms 3864 KB Output is correct
15 Correct 101 ms 3540 KB Output is correct
16 Correct 51 ms 4056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1558 ms 4100 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1558 ms 4100 KB Time limit exceeded
2 Halted 0 ms 0 KB -