# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
305239 | pit4h | The Kingdom of JOIOI (JOI17_joioi) | C++14 | 4103 ms | 71488 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
using ll = int;
const ll INF = 1e9+1;
bool possible(vector<vector<ll>>& grid, ll M, ll L, ll R) {
int h = grid.size(), w = grid[0].size();
vector<vector<bool>> dp(h, vector<bool>(w+1));
dp[0][0] = 1;
for(int i=0; i<h; ++i) {
ll mx = L;
if(i!=0) {
dp[i][0] = dp[i-1][0];
}
for(int j=0; j<w; ++j) {
mx = max(mx, grid[i][j]);
if(i!=0) {
dp[i][j+1] = dp[i][j+1] | dp[i-1][j+1];
}
dp[i][j+1] = dp[i][j+1] | dp[i][j];
if(mx-L > M) dp[i][j+1] = 0;
}
ll mini = R;
for(int j=w; j>=0; --j) {
if(R-mini > M) dp[i][j] = 0;
if(j-1>=0) mini = min(mini, grid[i][j-1]);
}
}
bool res = 0;
for(int i=0; i<w; ++i) {
if(dp[h-1][i+1]) res = 1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |