Submission #979196

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9791962024-05-10 11:18:42chautanphatToll (BOI17_toll)C++14
49 / 100
3056 ms25668 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 5e4;
struct query
{
int a, b, id, ans;
} queries[N];
int k, n, m, o, cost[N][5][5];
void dnc(int l, int r, int level = 0)
{
if (l == r) return;
int mid = (l+r)/2, L[n/k+1][k][k], R[n/k+1][k][k];
for (int i = l; i <= r; i++)
for (int a = 0; a < k; a++)
for (int b = 0; b < k; b++)
L[i][a][b] = R[i][a][b] = 1e9;
for (int a = 0; a < k; a++)
L[mid][a][a] = 0;
for (int i = mid-1; i >= l; i--)
for (int a = 0; a < k; a++)
for (int b = 0; b < k; b++)
for (int c = 0; c < k; c++)
L[i][a][c] = min(L[i][a][c], L[i+1][b][c]+cost[i][a][b]);
for (int a = 0; a < k; a++)
for (int b = 0; b < k; b++)
R[mid+1][a][b] = cost[mid][a][b];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...