Submission #34916

#TimeUsernameProblemLanguageResultExecution timeMemory
34916Dat160601산악 구조대 (JOI13_mountain)C++14
100 / 100
21 ms768 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; #define get Measure int val[207][207]; int ansx=1,ansy=1,fx,fy; int dx[]={+1,-1,0,0}; int dy[]={0,0,+1,-1}; int n,m,x; void rev(int lx,int ly,int rx,int ry,int type){ int diradd=0,dirsub=0,curx,cury; if(type==1){ curx=fx; cury=1; diradd=2; dirsub=1; } else if(type==2){ curx=1; cury=fy; diradd=0; dirsub=2; } else if(type==3){ curx=n; cury=fy; diradd=1; dirsub=3; } else{ curx=fx; cury=m; diradd=3; dirsub=0; } while(curx>=lx && cury>=ly && curx<=rx && cury<=ry){ int val=get(curx,cury); if(val==x){ Pinpoint(curx,cury); } else if(val>x){ curx+=dx[dirsub]; cury+=dy[dirsub]; } else{ curx+=dx[diradd]; cury+=dy[diradd]; } } } void Rescue(int R, int C, int RS, int CS, int X) { n=R; m=C; fx=RS; fy=CS; x=X; rev(1,1,RS,CS,1); rev(1,CS,RS,C,2); rev(RS,1,R,CS,3); rev(RS,CS,R,C,4); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...