Submission #1092281

# Submission time Handle Problem Language Result Execution time Memory
1092281 2024-09-23T16:58:35 Z PagodePaiva Snowball (JOI21_ho_t2) C++17
0 / 100
2 ms 348 KB
#include<bits/stdc++.h>
#define int long long

using namespace std;

const int N = 2010;
int r[N],l[N];
int p[N];
int32_t main(){
    int n, q;
    cin >> n;
    cin >> q;
    for(int i = 1;i <= n;i++){
        cin >> p[i];
        l[i] = r[i] = p[i];
    }
    r[0] = -(1LL << 63);
    l[n+1] = (1LL << 63);
    while(q--){
        int x;
        cin >> x;
        for(int i = 1;i <= n;i++){
            p[i] += x;
            if(x > 0) r[i] = min(p[i], l[i+1]);
            else l[i] = max(p[i], r[i-1]);
        }
    }
    for(int i = 1;i <= n;i++) cout << r[i] - l[i] << '\n';
}

Compilation message

Main.cpp: In function 'int32_t main()':
Main.cpp:17:12: warning: integer overflow in expression of type 'long long int' results in '-9223372036854775808' [-Woverflow]
   17 |     r[0] = -(1LL << 63);
      |            ^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -