제출 #1239628

#제출 시각아이디문제언어결과실행 시간메모리
1239628Ghulam_Junaid식물 비교 (IOI20_plants)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "plants.h" // #include "grader.cpp" using namespace std; const int N = 4e5 + 100; int nn, K, par[N]; vector<int> R; void init(int kk, vector<int> rr) { nn = r.size(), K = kk, R = rr; par[2 * nn - 1] = 2 * nn; for (int i = 2 * nn - 2; i >= 0; i --){ if ((r[i % nn] == r[(i + 1) % nn])) par[i] = par[i + 1]; else par[i] = i + 1; } } int compare_plants(int x, int y) { if (y <= par[x]){ if (r[x]) return -1; return 1; } if (x + n <= par[y]){ if (r[y]) return 1; return -1; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:11:10: error: 'r' was not declared in this scope
   11 |     nn = r.size(), K = kk, R = rr;
      |          ^
plants.cpp: In function 'int compare_plants(int, int)':
plants.cpp:23:13: error: 'r' was not declared in this scope
   23 |         if (r[x]) return -1;
      |             ^
plants.cpp:26:13: error: 'n' was not declared in this scope
   26 |     if (x + n <= par[y]){
      |             ^
plants.cpp:27:13: error: 'r' was not declared in this scope
   27 |         if (r[y]) return 1;
      |             ^