제출 #429375

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

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

plants.cpp:2:2: error: invalid preprocessing directive #inlcude; did you mean #include?
    2 | #inlcude <vector>
      |  ^~~~~~~
      |  include
plants.cpp:3:2: error: invalid preprocessing directive #inlcude; did you mean #include?
    3 | #inlcude <iostream>
      |  ^~~~~~~
      |  include
plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:16:13: warning: statement has no effect [-Wunused-value]
   16 |   else l[i] - 1;
      |        ~~~~~^~~
plants.cpp: In function 'int compare_plants(int, int)':
plants.cpp:23:7: error: lvalue required as left operand of assignment
   23 |  if( y-x = l[y]-l[x])return 1;
      |      ~^~
plants.cpp:24:7: error: lvalue required as left operand of assignment
   24 |  if( y-x = -1 *(l[y]-l[x]))return -1;
      |      ~^~
plants.cpp:25:6: error: 'nn' was not declared in this scope; did you mean 'n'?
   25 |  if( nn-y + i = l[n]-l[y] + l[i])return 1;
      |      ^~
      |      n
plants.cpp:25:13: error: 'i' was not declared in this scope
   25 |  if( nn-y + i = l[n]-l[y] + l[i])return 1;
      |             ^
plants.cpp:26:6: error: 'nn' was not declared in this scope; did you mean 'n'?
   26 |  if( nn-y + i = -1*(l[n]-l[y] + l[i]))return -1;
      |      ^~
      |      n
plants.cpp:26:13: error: 'i' was not declared in this scope
   26 |  if( nn-y + i = -1*(l[n]-l[y] + l[i]))return -1;
      |             ^