Submission #24901

#TimeUsernameProblemLanguageResultExecution timeMemory
24901youngyojun산악 구조대 (JOI13_mountain)C++11
20 / 100
14 ms872 KiB
#include "grader.h" #include <stdio.h> int AnsX, AnsY, X; bool f1(const int& x1, const int& x2, const int& y1, const int& y2) { if(x1 > x2 || y1 > y2) return false; if((x2-x1+1) * (y2-y1+1) <= 3) { for(int x = x1; x <= x2; x++) for(int y = y1; y <= y2; y++) if(X == Measure(x, y)) { AnsX = x; AnsY = y; return true; } return false; } const int midX = (x1+x2)>>1, midY = (y1+y2)>>1; const int ret = Measure(midX, midY); if(ret == X) { AnsX = midX; AnsY = midY; return true; } if(ret < X) return f1(x1, x2, midY+1, y2) || f1(midX+1, x2, y1, midY); return f1(x1, midX-1, y1, y2) || f1(midX, x2, y1, midY-1); } bool f2(const int& x1, const int& x2, const int& y1, const int& y2) { if(x1 > x2 || y1 > y2) return false; if((x2-x1+1) * (y2-y1+1) <= 3) { for(int x = x1; x <= x2; x++) for(int y = y1; y <= y2; y++) if(X == Measure(x, y)) { AnsX = x; AnsY = y; return true; } return false; } const int midX = (x1+x2)>>1, midY = (y1+y2)>>1; const int ret = Measure(midX, midY); if(ret == X) { AnsX = midX; AnsY = midY; return true; } if(ret < X) return f2(x1, x2, y1, midY-1) || f2(midX+1, x2, midY, y2); return f2(x1, midX-1, y1, y2) || f2(midX, x2, midY+1, y2); } bool f3(const int& x1, const int& x2, const int& y1, const int& y2) { if(x1 > x2 || y1 > y2) return false; if((x2-x1+1) * (y2-y1+1) <= 3) { for(int x = x1; x <= x2; x++) for(int y = y1; y <= y2; y++) if(X == Measure(x, y)) { AnsX = x; AnsY = y; return true; } return false; } const int midX = (x1+x2)>>1, midY = (y1+y2)>>1; const int ret = Measure(midX, midY); if(ret == X) { AnsX = midX; AnsY = midY; return true; } if(ret < X) return f3(x1, x2, midY+1, y2) || f3(x1, midX-1, y1, midY); return f3(x1, x2, y1, midY-1) || f3(midX+1, x2, midY, y2); } bool f4(const int& x1, const int& x2, const int& y1, const int& y2) { if(x1 > x2 || y1 > y2) return false; if((x2-x1+1) * (y2-y1+1) <= 3) { for(int x = x1; x <= x2; x++) for(int y = y1; y <= y2; y++) if(X == Measure(x, y)) { AnsX = x; AnsY = y; return true; } return false; } const int midX = (x1+x2)>>1, midY = (y1+y2)>>1; const int ret = Measure(midX, midY); if(ret == X) { AnsX = midX; AnsY = midY; return true; } if(ret < X) return f4(x1, x2, y1, midY-1) || f4(x1, midX-1, midY, y2); return f4(x1, x2, midY+1, y2) || f4(midX+1, x2, y1, midY); } void Rescue(int R, int C, int RS, int CS, int _X) { X = _X; if(!(f1(1, RS, 1, CS) || f2(1, RS, CS+1, C) || f3(RS+1, R, 1, CS) || f4(RS+1, R, CS+1, C))) { while(1) puts("FUCK!"); } Pinpoint(AnsX, AnsY); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...