이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
#define author tolbi
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define rev(x) reverse(x.begin(), x.end())
#define tol(bi) (1LL<<((int)(bi)))
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
const int MOD = 1e9+7;
const int INF = 1e18;
#include "wombats.h"
int h[5000][200];
int v[5000][200];
int n,m;
vector<vector<vector<int>>> dp;
void calc(int las){
priority_queue<pair<int,pair<int,int>>,vector<pair<int,pair<int,int>>>,greater<pair<int,pair<int,int>>>> pq;
pq.push({0,{n-1,las}});
while (pq.size()){
int x = pq.top().second.first;
int y = pq.top().second.second;
int w = pq.top().first;
pq.pop();
if (dp[las][x][y]!=-1) continue;
dp[las][x][y]=w;
if (x>0 && dp[las][x-1][y]==-1){
pq.push({w+v[x-1][y],{x-1,y}});
}
if (y>0 && dp[las][x][y-1]==-1){
pq.push({w+h[x][y-1],{x,y-1}});
}
if (y<m-1 && dp[las][x][y+1]==-1){
pq.push({w+h[x][y],{x,y+1}});
}
}
}
void init(int R, int C, int H[5000][200], int V[5000][200]) {
for (int i = 0; i < R; i++){
for (int j = 0; j < C; j++){
h[i][j]=H[i][j];
v[i][j]=V[i][j];
}
}
n=R,m=C;
dp.resize(m,vector<vector<int>>(n,vector<int>(m,-1)));
for (int i = 0; i < m; ++i)
{
calc(i);
}
}
void changeH(int P, int Q, int W){
h[P][Q]=W;
dp.clear();
dp.resize(m,vector<vector<int>>(n,vector<int>(m,-1)));
for (int i = 0; i < m; ++i)
{
calc(i);
}
}
void changeV(int P, int Q, int W) {
v[P][Q]=W;
dp.clear();
dp.resize(m,vector<vector<int>>(n,vector<int>(m,-1)));
for (int i = 0; i < m; ++i)
{
calc(i);
}
}
int escape(int V1, int V2) {
return dp[V2][0][V1];
}
컴파일 시 표준 에러 (stderr) 메시지
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:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
1 | #pragma optimize("Bismillahirrahmanirrahim")
|
wombats.cpp:22:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
22 | const int INF = 1e18;
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |