제출 #516534

#제출 시각아이디문제언어결과실행 시간메모리
516534drkarlicio2107Xylophone (JOI18_xylophone)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "xylophone.h" using namespace std; int bio [5010]; int l [5010]; int moze (int x, int n){ if (bio[x] || x>n || x<1) return 0; return 1; } void solve (int n){ int lo=1; int hi=n; while (hi-lo>1){ //cout << lo << " " << hi; int mid=(lo+hi)/2; int x=query (mid, n); if (x==n-1) lo=mid; else hi=mid-1; } if (hi!=lo){ if (query (hi, n)==n-1) lo++; } //cout << lo; bio [1]=1; l[lo]=1; for (int i=lo+1; i<n+1; i++){ int x=query (i-1, i); if (moze (l[i-1]+x) && moze (l[i-1]-x)){ int y=query (i-2, i); l[i]=moze2 (l[i-2], l[i-1], x, y); bio [moze2 (l[i-2], l[i-1], x, y)]=1; } else{ if (moze(l[i-1]+x)){ l[i]=l[i-1]+x; bio [l[i-1]+x]=1; } else{ l[i]=l[i-1]-x; bio [l[i-1]-x]=1; } } } for (int i=lo-1; i>0; i--){ int x=query (i, i+1); if (moze (l[i+1]+x) && moze (l[i+1]-x)){ int y=query (i, i+2); if (y>abs(l[i+1]-l[i+2])){ int y=query (i+2, i); l[i]=moze2 (l[i+2], l[i+1], x, y); bio [moze2 (l[i+2], l[i+1], x, y)]=1; } else{ if (l[i+1]>l[i+2]){ l[i]=l[i+1]-x; bio [l[i+1]-x]=1; } else{ l[i]=l[i+1]+x; bio [l[i+1]+x]=1; } } } else{ if (moze(l[i+1]+x)){ l[i]=l[i+1]+x; bio [l[i+1]+x]=1; } else{ l[i]=l[i+1]-x; bio [l[i+1]-x]=1; } } } for (int i=1; i<n+1; i++) answer (i, l[i]); }

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

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:25:21: error: too few arguments to function 'int moze(int, int)'
   25 |   if (moze (l[i-1]+x) && moze (l[i-1]-x)){
      |                     ^
xylophone.cpp:5:5: note: declared here
    5 | int moze (int x, int n){
      |     ^~~~
xylophone.cpp:25:40: error: too few arguments to function 'int moze(int, int)'
   25 |   if (moze (l[i-1]+x) && moze (l[i-1]-x)){
      |                                        ^
xylophone.cpp:5:5: note: declared here
    5 | int moze (int x, int n){
      |     ^~~~
xylophone.cpp:27:9: error: 'moze2' was not declared in this scope; did you mean 'moze'?
   27 |    l[i]=moze2 (l[i-2], l[i-1], x, y); bio [moze2 (l[i-2], l[i-1], x, y)]=1;
      |         ^~~~~
      |         moze
xylophone.cpp:30:21: error: too few arguments to function 'int moze(int, int)'
   30 |    if (moze(l[i-1]+x)){
      |                     ^
xylophone.cpp:5:5: note: declared here
    5 | int moze (int x, int n){
      |     ^~~~
xylophone.cpp:40:21: error: too few arguments to function 'int moze(int, int)'
   40 |   if (moze (l[i+1]+x) && moze (l[i+1]-x)){
      |                     ^
xylophone.cpp:5:5: note: declared here
    5 | int moze (int x, int n){
      |     ^~~~
xylophone.cpp:40:40: error: too few arguments to function 'int moze(int, int)'
   40 |   if (moze (l[i+1]+x) && moze (l[i+1]-x)){
      |                                        ^
xylophone.cpp:5:5: note: declared here
    5 | int moze (int x, int n){
      |     ^~~~
xylophone.cpp:44:10: error: 'moze2' was not declared in this scope; did you mean 'moze'?
   44 |     l[i]=moze2 (l[i+2], l[i+1], x, y); bio [moze2 (l[i+2], l[i+1], x, y)]=1;
      |          ^~~~~
      |          moze
xylophone.cpp:56:21: error: too few arguments to function 'int moze(int, int)'
   56 |    if (moze(l[i+1]+x)){
      |                     ^
xylophone.cpp:5:5: note: declared here
    5 | int moze (int x, int n){
      |     ^~~~