Submission #172319

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1723192020-01-01 07:44:08ho94949유괴 2 (JOI17_abduction2)C++17
27 / 100
199 ms65028 KiB
#include<bits/stdc++.h>
using namespace std;
enum {UP, LEFT, DOWN, RIGHT};
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int MAXN = 2020;
int H, W, Q;
int A[MAXN], B[MAXN];
int dp[MAXN][MAXN][4];
bool ins(int x, int y){ return 0<=x&&x<H&&0<=y&&y<W; }
int solve(int x, int y, int d)
{
if(dp[x][y][d] != -1) return dp[x][y][d];
int nx = x+dx[d], ny = y+dy[d];
if(!ins(nx, ny)) return dp[x][y][d] = 0;
if(d==UP||d==DOWN)
{
if(A[nx]<B[ny]) return dp[x][y][d] = 1+solve(nx, ny, d);
else return dp[x][y][d] = 1+max(solve(nx, ny, LEFT), solve(nx, ny, RIGHT));
}
else
{
if(B[ny]<A[nx]) return dp[x][y][d] = 1+solve(nx, ny, d);
else return dp[x][y][d] = 1+max(solve(nx, ny, UP), solve(nx, ny, DOWN));
}
}
int main()
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

abduction2.cpp: In function 'int main()':
abduction2.cpp:33:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &H, &W, &Q);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
abduction2.cpp:35:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", A+i);
         ~~~~~^~~~~~~~~~~
abduction2.cpp:37:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", B+i);
         ~~~~~^~~~~~~~~~~
abduction2.cpp:40:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int S, T; scanf("%d%d", &S, &T); --S; --T;
                   ~~~~~^~~~~~~~~~~~~~~~
#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...