Submission #24890

#TimeUsernameProblemLanguageResultExecution timeMemory
24890kriii산악 구조대 (JOI13_mountain)C++14
100 / 100
18 ms896 KiB
#include "grader.h" void Rescue(int R, int C, int RS, int CS, int X) { for (int k=0;k<4;k++){ int x,y,dx1,dy1,dx2,dy2; if (k == 0){ x = RS; y = 1; dx1 = 0; dy1 = 1; dx2 = -1; dy2 = 0; } else if (k == 1){ x = 1; y = CS; dx1 = 1; dy1 = 0; dx2 = 0; dy2 = 1; } else if (k == 2){ x = RS; y = C; dx1 = 0; dy1 = -1; dx2 = 1; dy2 = 0; } else if (k == 3){ x = R; y = CS; dx1 = -1; dy1 = 0; dx2 = 0; dy2 = -1; } while (1){ if (k == 0){ if (x < 1 || y > CS) break; } else if (k == 1){ if (x > RS || y > C) break; } else if (k == 2){ if (x > R || y < CS) break; } else{ if (x < RS || y < 1) break; } int u = Measure(x,y); if (u == X){ Pinpoint(x,y); return; } if (u < X) x += dx1, y += dy1; else x += dx2, y += dy2; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...