Submission #1028722

# Submission time Handle Problem Language Result Execution time Memory
1028722 2024-07-20T07:35:54 Z DeltaStruct 산악 구조대 (JOI13_mountain) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
/*
vector<vector<int>> high; vector<pair<int,int>> ans;
int Measure(int RM,int CM){ return high[RM-1][CM-1]; }
void Pinpoint(int RP,int CP){ ans.emplace_back(RP,CP); }
void Rescue(int R,int C,int MR,int MC,int X);
int main(){
  int q; cin >> q; while(q--){
    int R,C,MR,MC,X; cin >> R >> C >> MR >> MC >> X;
    high.resize(R);
    for (auto& a:high){
      a.resize(C); for (int& b:a) cin >> b;
    }
    Rescue(R,C,MR,MC,X);
  }
  for (auto [a,b]:ans) cout << a << ' ' << b << endl;
}
//*/
 
void Rescue(int R,int C,int MR,int MC,int X){
  --MR;
  int x = 0,y = MC-1;
  while(x!=MR+1&&y!=-1){
    int r = Measure(x+1,y+1);
    if (r==X){
      Pinpoint(x+1,y+1);
      return;
    }
    if (r<X) ++x;
    else --y;
  }
  x = 0,y = MC-1;
  while(x!=MR+1&&y!=C){
    int r = Measure(x+1,y+1);
    if (r==X){
      Pinpoint(x+1,y+1);
      return;
    }
    if (r<X) ++x;
    else ++y;
  }
  x = R-1,y = MC-1;
  while(x!=MR+1&&y!=-1){
    int r = Measure(x+1,y+1);
    if (r==X){
      Pinpoint(x+1,y+1);
      return;
    }
    if (r<X) --x;
    else --y;
  }
  x = R-1,y = MC-1;
  while(x!=MR-1&&y!=C){
    int r = Measure(x+1,y+1);
    if (r==X){
      Pinpoint(x+1,y+1);
      return;
    }
    if (r<X) --x;
    else ++y;
  }
}

Compilation message

mountain.cpp: In function 'void Rescue(int, int, int, int, int)':
mountain.cpp:25:13: error: 'Measure' was not declared in this scope
   25 |     int r = Measure(x+1,y+1);
      |             ^~~~~~~
mountain.cpp:27:7: error: 'Pinpoint' was not declared in this scope
   27 |       Pinpoint(x+1,y+1);
      |       ^~~~~~~~
mountain.cpp:35:13: error: 'Measure' was not declared in this scope
   35 |     int r = Measure(x+1,y+1);
      |             ^~~~~~~
mountain.cpp:37:7: error: 'Pinpoint' was not declared in this scope
   37 |       Pinpoint(x+1,y+1);
      |       ^~~~~~~~
mountain.cpp:45:13: error: 'Measure' was not declared in this scope
   45 |     int r = Measure(x+1,y+1);
      |             ^~~~~~~
mountain.cpp:47:7: error: 'Pinpoint' was not declared in this scope
   47 |       Pinpoint(x+1,y+1);
      |       ^~~~~~~~
mountain.cpp:55:13: error: 'Measure' was not declared in this scope
   55 |     int r = Measure(x+1,y+1);
      |             ^~~~~~~
mountain.cpp:57:7: error: 'Pinpoint' was not declared in this scope
   57 |       Pinpoint(x+1,y+1);
      |       ^~~~~~~~