# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1099783 | 2024-10-12T05:16:30 Z | model_code | 나일강 (IOI24_nile) | C++17 | 2000 ms | 5580 KB |
// time_limit/bakry_q1_fixed.cpp #include <bits/stdc++.h> using namespace std ; vector<long long>calculate_costs(vector<int>W, vector<int>A, vector<int>B, vector<int>E) { vector< array<int , 3> >ord; int n = W.size(), q = E.size(); for(int i = 0; i < n; ++i) ord.push_back({W[i], A[i], B[i]}); sort(ord.begin(), ord.end()); for(int i = 0; i < n; ++i) W[i] = ord[i][0], A[i] = ord[i][1], B[i] = ord[i][2]; vector<long long>v; for(int curq = 0; curq < E.size(); ++curq) { int d = E[curq]; vector<long long>dp(n+2); dp[0] = A[0]; for(int i = 1; i < n; ++i) { dp[i] = dp[i-1] + A[i]; //take i-1 if(W[i] - W[i-1] <= d) { if(i == 1) dp[i] = min(dp[i], 1ll * B[i] + B[i-1]); else dp[i] = min(dp[i], B[i] + B[i-1] + dp[i-2]); } //take i-2 if(i-2 >= 0 && W[i] - W[i-2] <= d) { if(i == 2) dp[i] = min(dp[i], 1ll * B[i] + B[i-2] + A[i-1]); else dp[i] = min(dp[i], 1ll * B[i] + B[i-2] + A[i-1] + dp[i-3]); //fix overflow } } v.push_back(dp[n-1]); } return v; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 4812 KB | Output is correct |
2 | Correct | 25 ms | 4808 KB | Output is correct |
3 | Correct | 25 ms | 4812 KB | Output is correct |
4 | Correct | 25 ms | 4816 KB | Output is correct |
5 | Correct | 25 ms | 4812 KB | Output is correct |
6 | Correct | 24 ms | 4808 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 4816 KB | Output is correct |
2 | Correct | 26 ms | 4808 KB | Output is correct |
3 | Correct | 27 ms | 4820 KB | Output is correct |
4 | Correct | 28 ms | 4868 KB | Output is correct |
5 | Correct | 30 ms | 4820 KB | Output is correct |
6 | Correct | 29 ms | 4812 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 2 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 34 ms | 4812 KB | Output is correct |
8 | Correct | 25 ms | 4808 KB | Output is correct |
9 | Correct | 25 ms | 4812 KB | Output is correct |
10 | Correct | 25 ms | 4816 KB | Output is correct |
11 | Correct | 25 ms | 4812 KB | Output is correct |
12 | Correct | 24 ms | 4808 KB | Output is correct |
13 | Correct | 26 ms | 4816 KB | Output is correct |
14 | Correct | 26 ms | 4808 KB | Output is correct |
15 | Correct | 27 ms | 4820 KB | Output is correct |
16 | Correct | 28 ms | 4868 KB | Output is correct |
17 | Correct | 30 ms | 4820 KB | Output is correct |
18 | Correct | 29 ms | 4812 KB | Output is correct |
19 | Correct | 1 ms | 344 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 2 ms | 348 KB | Output is correct |
23 | Correct | 1 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 35 ms | 4828 KB | Output is correct |
26 | Correct | 37 ms | 4812 KB | Output is correct |
27 | Correct | 36 ms | 4812 KB | Output is correct |
28 | Correct | 38 ms | 4808 KB | Output is correct |
29 | Correct | 35 ms | 4816 KB | Output is correct |
30 | Correct | 36 ms | 4852 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 4816 KB | Output is correct |
2 | Correct | 26 ms | 4808 KB | Output is correct |
3 | Correct | 27 ms | 4820 KB | Output is correct |
4 | Correct | 28 ms | 4868 KB | Output is correct |
5 | Correct | 30 ms | 4820 KB | Output is correct |
6 | Correct | 29 ms | 4812 KB | Output is correct |
7 | Execution timed out | 2061 ms | 5580 KB | Time limit exceeded |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 34 ms | 4812 KB | Output is correct |
9 | Correct | 25 ms | 4808 KB | Output is correct |
10 | Correct | 25 ms | 4812 KB | Output is correct |
11 | Correct | 25 ms | 4816 KB | Output is correct |
12 | Correct | 25 ms | 4812 KB | Output is correct |
13 | Correct | 24 ms | 4808 KB | Output is correct |
14 | Correct | 26 ms | 4816 KB | Output is correct |
15 | Correct | 26 ms | 4808 KB | Output is correct |
16 | Correct | 27 ms | 4820 KB | Output is correct |
17 | Correct | 28 ms | 4868 KB | Output is correct |
18 | Correct | 30 ms | 4820 KB | Output is correct |
19 | Correct | 29 ms | 4812 KB | Output is correct |
20 | Correct | 1 ms | 344 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
23 | Correct | 2 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 35 ms | 4828 KB | Output is correct |
27 | Correct | 37 ms | 4812 KB | Output is correct |
28 | Correct | 36 ms | 4812 KB | Output is correct |
29 | Correct | 38 ms | 4808 KB | Output is correct |
30 | Correct | 35 ms | 4816 KB | Output is correct |
31 | Correct | 36 ms | 4852 KB | Output is correct |
32 | Execution timed out | 2061 ms | 5580 KB | Time limit exceeded |
33 | Halted | 0 ms | 0 KB | - |