Submission #975584

# Submission time Handle Problem Language Result Execution time Memory
975584 2024-05-05T14:00:19 Z Circling Measures (CEOI22_measures) C++17
59 / 100
173 ms 5468 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";
        }
        return 0;
    }
    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:55:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |         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 3 ms 348 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 348 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 3 ms 348 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 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 116 ms 2776 KB Output is correct
10 Correct 161 ms 2520 KB Output is correct
11 Correct 38 ms 2600 KB Output is correct
12 Correct 173 ms 2520 KB Output is correct
13 Correct 48 ms 2520 KB Output is correct
14 Correct 105 ms 2660 KB Output is correct
15 Correct 100 ms 2516 KB Output is correct
16 Correct 50 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1364 KB Output is correct
2 Correct 32 ms 5184 KB Output is correct
3 Correct 41 ms 5356 KB Output is correct
4 Correct 28 ms 3164 KB Output is correct
5 Correct 29 ms 4432 KB Output is correct
6 Correct 28 ms 3412 KB Output is correct
7 Correct 31 ms 4436 KB Output is correct
8 Correct 28 ms 3204 KB Output is correct
9 Correct 30 ms 3312 KB Output is correct
10 Correct 34 ms 5468 KB Output is correct
11 Correct 32 ms 3776 KB Output is correct
12 Correct 30 ms 4856 KB Output is correct
13 Correct 31 ms 3116 KB Output is correct
14 Correct 31 ms 4944 KB Output is correct
15 Correct 30 ms 4956 KB Output is correct
16 Correct 26 ms 2640 KB Output is correct
17 Correct 28 ms 4440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1364 KB Output is correct
2 Correct 32 ms 5184 KB Output is correct
3 Correct 41 ms 5356 KB Output is correct
4 Correct 28 ms 3164 KB Output is correct
5 Correct 29 ms 4432 KB Output is correct
6 Correct 28 ms 3412 KB Output is correct
7 Correct 31 ms 4436 KB Output is correct
8 Correct 28 ms 3204 KB Output is correct
9 Correct 30 ms 3312 KB Output is correct
10 Correct 34 ms 5468 KB Output is correct
11 Correct 32 ms 3776 KB Output is correct
12 Correct 30 ms 4856 KB Output is correct
13 Correct 31 ms 3116 KB Output is correct
14 Correct 31 ms 4944 KB Output is correct
15 Correct 30 ms 4956 KB Output is correct
16 Correct 26 ms 2640 KB Output is correct
17 Correct 28 ms 4440 KB Output is correct
18 Incorrect 35 ms 4432 KB Output isn't correct
19 Halted 0 ms 0 KB -