제출 #635784

#제출 시각아이디문제언어결과실행 시간메모리
635784activedeltorre송신탑 (IOI22_towers)C++17
컴파일 에러
0 ms0 KiB
#include "towers.h" #include <iostream> #include <vector> using namespace std; int n,cent; int h[200005]; init(int N_, vector<int>H_) { int n=N_; int i; for(i=1;i<=n;i++) { H_[i]=h[i-1]; if(h[i]==n) { cent=i; } } } max_towers(int L,int R,int D) { if(L<=cent && R>=cent && max(h[L],h[R])+D<=n) { return 2; } else { return 1; } }

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

towers.cpp:7:1: error: ISO C++ forbids declaration of 'init' with no type [-fpermissive]
    7 | init(int N_, vector<int>H_)
      | ^~~~
towers.cpp:7:1: error: ambiguating new declaration of 'int init(int, std::vector<int>)'
In file included from towers.cpp:1:
towers.h:3:6: note: old declaration 'void init(int, std::vector<int>)'
    3 | void init(int N, std::vector<int> H);
      |      ^~~~
towers.cpp: In function 'int init(int, std::vector<int>)':
towers.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
towers.cpp: At global scope:
towers.cpp:20:1: error: ISO C++ forbids declaration of 'max_towers' with no type [-fpermissive]
   20 | max_towers(int L,int R,int D)
      | ^~~~~~~~~~