# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1102292 |
2024-10-18T01:53:11 Z |
ro9669 |
Nile (IOI24_nile) |
C++17 |
|
2000 ms |
4944 KB |
#include <bits/stdc++.h>
#define fi first
#define se second
#define all(v) v.begin() , v.end()
#define sz(v) int(v.size())
#define unq(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#include "nile.h"
using namespace std;
typedef long long ll;
typedef pair<int , int> ii;
typedef pair<long long , int> lli;
const int maxN = int(2e5)+7;
ll dp[maxN];
vector<int> w , a , b , e , id;
vector<ll> res;
vector<long long> calculate_costs(vector<int> _w , vector<int> _a , vector<int> _b , vector<int> _e){
w = _w; a = _a; b = _b; e = _e;
int n = sz(w);
id.resize(n);
for (int i = 0 ; i < n ; i++) id[i] = i;
sort(all(id) , [](int x , int y){
return w[x] < w[y];
});
for (int d : e){
dp[0] = 0;
for (int i = 0 ; i < n ; i++){
ll s = 0;
int x = INT_MAX;
dp[i + 1] = ll(1e18);
for (int j = i ; j >= 0 ; j--){
s += b[id[j]];
x = min(x , a[id[j]] - b[id[j]]);
if (w[id[i]] - w[id[j]] <= d){
if ((i - j)&1){
dp[i + 1] = min(dp[i + 1] , dp[j] + s);
}
else{
dp[i + 1] = min(dp[i + 1] , dp[j] + s + 1ll * x);
}
}
else{
break;
}
}
}
res.push_back(dp[n]);
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
336 KB |
Output is correct |
2 |
Correct |
20 ms |
504 KB |
Output is correct |
3 |
Correct |
19 ms |
336 KB |
Output is correct |
4 |
Correct |
19 ms |
336 KB |
Output is correct |
5 |
Correct |
19 ms |
336 KB |
Output is correct |
6 |
Correct |
19 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2068 ms |
4944 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2058 ms |
4376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
336 KB |
Output is correct |
2 |
Correct |
20 ms |
504 KB |
Output is correct |
3 |
Correct |
19 ms |
336 KB |
Output is correct |
4 |
Correct |
19 ms |
336 KB |
Output is correct |
5 |
Correct |
19 ms |
336 KB |
Output is correct |
6 |
Correct |
19 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
336 KB |
Output is correct |
8 |
Correct |
5 ms |
336 KB |
Output is correct |
9 |
Correct |
5 ms |
336 KB |
Output is correct |
10 |
Correct |
5 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
336 KB |
Output is correct |
12 |
Correct |
5 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
336 KB |
Output is correct |
2 |
Correct |
20 ms |
504 KB |
Output is correct |
3 |
Correct |
19 ms |
336 KB |
Output is correct |
4 |
Correct |
19 ms |
336 KB |
Output is correct |
5 |
Correct |
19 ms |
336 KB |
Output is correct |
6 |
Correct |
19 ms |
336 KB |
Output is correct |
7 |
Execution timed out |
2068 ms |
4944 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2058 ms |
4376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
24 ms |
336 KB |
Output is correct |
3 |
Correct |
20 ms |
504 KB |
Output is correct |
4 |
Correct |
19 ms |
336 KB |
Output is correct |
5 |
Correct |
19 ms |
336 KB |
Output is correct |
6 |
Correct |
19 ms |
336 KB |
Output is correct |
7 |
Correct |
19 ms |
336 KB |
Output is correct |
8 |
Execution timed out |
2068 ms |
4944 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |