Submission #1005272

# Submission time Handle Problem Language Result Execution time Memory
1005272 2024-06-22T09:32:35 Z ErJ Measures (CEOI22_measures) C++17
0 / 100
88 ms 12088 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long double
#define vi vector<ll>
#define pp pair<ll, ll>
#define vp vector<pp>
#define vvi vector<vi>
#define inf 1000000000000000
#define rep(i,n) for(int i = 0; i < n; i++)

int main(){
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    int n, m;
    ll d;
    cin >> n >> m >> d;
    d *= 2;
    vi A(m);
    rep(i,m) {
        cin >> A[i];
        A[i] *= 2;
    }
    vp dp(m);
    dp[0] = {0, A[0]};
    for(int i = 1; i < m; i++){
        ll pos = A[i] + dp[i - 1].first;
        pos = min(pos, dp[i - 1].second + d);
        ll plus = (dp[i-1].second + d - pos) / 2;
        dp[i] = {dp[i-1].first + plus, pos + plus};
    }
    rep(i, dp.size()){
        cout << dp[i].first / 2 << " ";
    }
    cout << endl;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:11:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long double, long double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 | #define rep(i,n) for(int i = 0; i < n; i++)
......
   33 |     rep(i, dp.size()){
      |         ~~~~~~~~~~~~               
Main.cpp:33:5: note: in expansion of macro 'rep'
   33 |     rep(i, dp.size()){
      |     ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 12088 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 12088 KB Output isn't correct
2 Halted 0 ms 0 KB -