제출 #815430

#제출 시각아이디문제언어결과실행 시간메모리
815430vjudge1식물 비교 (IOI20_plants)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> using namespace std; int n, h; void init(int k, vector<int> r) { n = r.size(); h = k; } int compare plants(int x, int y) { int z = 0, i; if (h == 2) { for (i = x; i < y; i++) { if (r[i] == 1) z--; else z++; } if (z == y - x) return 1; if (z == x - y) return -1; z = 0; for (i = y; i < x + n; i++) { if (r[i % n] == 1) z--; else z++; } if (z == y - x) return 1; if (z == x - y) return -1; return 0; } return z; }

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

plants.cpp:10:13: error: expected initializer before 'plants'
   10 | int compare plants(int x, int y)
      |             ^~~~~~