/**
____ ____ ____ __________________ ____ ____ ____
||I || ||c || ||e || || || ||M || ||a || ||n ||
||__|| ||__|| ||__|| ||________________|| ||__|| ||__|| ||__||
|/__\| |/__\| |/__\| |/________________\| |/__\| |/__\| |/__\|
*/
#include"wombats.h"
#include <set>
#include <iostream>
#include <chrono>
#include <vector>
#include <algorithm>
#include <cstdio>
#define maxn 5005
#define maxn2 205
#define maxlog 20
#define INF 1000000010
#define LINF 1000000000000000005
#define endl '\n'
#define pb(x) push_back(x)
#define X first
#define Y second
#define control cerr<<"passed"<<endl;
#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math")
#pragma GCC target("avx2")
using namespace std;
/**std::chrono::high_resolution_clock::time_point startT, currT;
constexpr double TIME_MULT = 1;
double timePassed()
{
using namespace std::chrono;
currT = high_resolution_clock::now();
double time = duration_cast<duration<double>>(currT - startT).count();
return time * TIME_MULT;
}*/
typedef pair <long long, int> pli;
int d[maxn];
int c, r;
int h[maxn][maxn2];
int v[maxn][maxn2];
int dp[maxn][maxn2];
void dijkstra(int node)
{
for(int i = 0; i < c; i++)
d[i] = 1e9;
d[node] = 0;
for(int j = 0; j < r; j++)
{
set <int> q;
for(int i = 0; i < c; i++)
if(d[i] != 1e9)
q.insert(i);
while(!q.size())
{
int e = *q.begin();
q.erase(q.begin());
if(e + 1 < c)
if(d[e + 1] > d[e] + h[j][e])
{
d[e + 1] = d[e] + h[j][e];
q.insert(e + 1);
}
if(e >= 1)
if(d[e - 1] > d[e] + h[j][e - 1])
{
d[e - 1] > d[e] + h[j][e - 1];
q.insert(e - 1);
}
}
if(j + 1 < r)
for(int i = 0; i < c; i++)
d[i] += v[i][j];
}
for(int i = 0; i < c; i++)
dp[node][i] = d[i];
}
void init(int R, int C, int H[5000][200], int V[5000][200])
{
r = R;
c = C;
for(int i = 0; i < r; i++)
for(int j = 0; j < c; j++)
{
if(j + 1 < c)
h[i][j] = H[i][j];
if(i + 1 < r)
v[i][j] = V[i][j];
}
for(int i = 0; i < c; i++)
dijkstra(i);
}
void changeH(int P , int Q , int W)
{
h[P][Q] = W;
for(int i = 0; i < c; i++)
dijkstra(i);
}
void changeV(int P , int Q , int W)
{
v[P][Q] = W;
for(int i = 0; i < c; i++)
dijkstra(i);
}
int escape(int V1 , int V2)
{
return dp[V1][V2];
}
/**int main()
{
#ifdef ONLINE_JUDGE /// promeni
freopen("input.in", "r", stdin);
freopen("taxi.out", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//startT = std::chrono::high_resolution_clock::now();
return 0;
}*/
Compilation message
grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
15 | int res;
| ^~~
wombats.cpp: In function 'void dijkstra(int)':
wombats.cpp:81:30: warning: statement has no effect [-Wunused-value]
81 | d[e - 1] > d[e] + h[j][e - 1];
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
86 ms |
12892 KB |
Output is correct |
2 |
Incorrect |
78 ms |
12904 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
Output is correct |
2 |
Correct |
1 ms |
4444 KB |
Output is correct |
3 |
Correct |
1 ms |
4444 KB |
Output is correct |
4 |
Incorrect |
2 ms |
8540 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3871 ms |
8712 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
272 ms |
18012 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3801 ms |
8712 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3839 ms |
8708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |