# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1169412 | SmuggingSpun | Fish 3 (JOI24_fish3) | C++20 | 1040 ms | 89036 KiB |
#include<bits/stdc++.h>
#define taskname "A"
using namespace std;
typedef long long ll;
template<class T>void minimize(T& a, T b){
if(a > b){
a = b;
}
}
const int lim = 3e5 + 5;
const ll INF = 1e18;
int n, q;
ll d, c[lim];
namespace sub1{
void solve(){
for(int _ = 0; _ < q; _++){
int l, r;
cin >> l >> r;
ll mn = INF, ans = 0;
for(int i = r; i >= l; i--){
minimize(mn, c[i]);
if((c[i] - mn) % d != 0 && (mn -= d - (c[i] - mn) % d) < 0){
ans = -1;
break;
}
ans += (c[i] - mn) / d;
}
cout << ans << "\n";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |