# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1099785 |
2024-10-12T05:16:53 Z |
model_code |
Nile (IOI24_nile) |
C++17 |
|
2000 ms |
3160 KB |
// time_limit/hazem_qn-factorial.cpp
#include "bits/stdc++.h"
#include "nile.h"
using namespace std;
const long long INF = 1e14;
vector<long long> calculate_costs(vector<int> W, vector<int> A, vector<int> B, vector<int> E) {
int n = W.size();
int q = E.size();
auto solve = [&](int d){
long long tot = INF;
vector <int> p(n);
iota(p.begin() ,p.end() ,0);
do{
long long cur = (n % 2) * A[p.back()];
for(int i = 0; i + 1 < n; i += 2){
int j = p[i], k = p[i + 1];
cur += (abs(W[j] - W[k]) <= d? B[j] + B[k] : A[j] + A[k]);
}
tot = min(tot, cur);
} while(next_permutation(p.begin() ,p.end()));
return tot;
};
vector<long long> R(q);
for(int i = 0; i < q; i++)
R[i] = solve(E[i]);
return R;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2058 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2063 ms |
3156 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2039 ms |
3160 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2058 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2058 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2039 ms |
3160 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
2058 ms |
348 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |