Submission #328584

#TimeUsernameProblemLanguageResultExecution timeMemory
328584seedkinMagic Dowsing (FXCUP3_magic)C11
0 / 100
0 ms364 KiB
#include "dowsing.h" void FindTreasure(int N) { int find = 0; int findX[10]; int findY[10]; int targetX = 0; int targetY = 0; int half = (N+1) / 2; for(int i = half; i <= N; i++) { int r = Detect(i, i - half + 1); if(r) { findX[find] = i; findY[find] = i - half + 1; r++; } r = Detect(i - half + 1, i); if(r) { findX[find] = i - half + 1;; findY[find] = i; r++; } } if(find == 0) { int r = 0; for(int i = 0; i < half - 2; i++) { r = Detect(i+1, i+1); if(r) { targetX = i+1; targetY = i+1; break; } } if(N % 2 && r == 0) { r = Detect(half-1, half-1); if(r) { targetX = half-1; targetY = half-1; } } if( r == 0) { if(N % 2) { targetX = half; targetY = half; } else { targetX = half-1; targetY = half-1; } } r = Detect(targetX+1, targetY); if(r) { Report(targetY >= half ? targetY - half + 1 : half + targetY - 1, targetY); } else { Report(targetX, targetX >= half ? targetX - half + 1 : half + targetX - 1); } } else if ( find == 1 ) { } else if ( find == 2 ) { int r = Detect(findX[0], findY[1]); if(r == 0) { Report(findX[0], findY[1]); } else { Report(findX[1], findY[0]); } return; } else if ( find == 3 ) { } else if ( find == 4 ) { Report(half, half); return; } }
#Verdict Execution timeMemoryGrader output
Fetching results...