제출 #679486

#제출 시각아이디문제언어결과실행 시간메모리
679486kilikuma벽 (IOI14_wall)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <wall.h> using namespace std; const int INFINI = 200000; int arbreBinaireMin[(1 << 18)]; int arbreBinaireMax[(1 << 18)]; void initialise() { for (int i = 0; i < (1 << 18); i ++) { arbreBinaireMin[i] = INFINI; arbreBinaireMax[i] = 0; } } void corr(int ind) { return ind + (1 << 17); } int valMin(int ind) { int miniCur = INFINI; while (ind > 0) { miniCur = min(miniCur, arbreBinaireMin[ind]); ind /= 2; } return miniCur; } int valMax(int ind) { int maxiCur = 0; while (ind > 0) { maxiCur = max(maxiCur, arbreBinaireMax[ind]); ind /= 2; } return maxiCur; } void interMin(int L, int R, int val) { if (L > R) return; if (L == R) { arbreBinaireMin[L] = min(arbreBinaireMin[L], val); } if (L % 2) { arbreBinaireMin[L] = min(arbreBinaireMin[L], val); L ++; } if (! (R % 2)) { arbreBinaireMin[R] = min(arbreBinaireMin[R], val); R --; } interMin(L / 2, R / 2, val); } void interMax(int L, int R, int val) { if (L > R) return; if (L == R) { arbreBinaireMax[L] = max(arbreBinaireMax[L], val); } if (L % 2) { arbreBinaireMax[L] = max(arbreBinaireMax[L], val); L ++; } if (! (R % 2)) { arbreBinaireMax[R] = max(arbreBinaireMax[R], val); R --; } interMax(L / 2, R / 2, val); } void buildWall(int N, int K, int operations[], int gauche[], int droite[], int hauteur[], int hauteurFinale[]) { for (int i = 0; i < N; i ++) hauteurFinale[i] = 0; initialise(); for (int iOperation = 0; iOperation < K; iOperation ++) { if (operations[iOperation] == 1) { interMax(corr(gauche[iOperation]), corr(droite[iOperation]), hauteur[iOperation]); } else { interMin(corr(gauche[iOperation]), corr(droite[iOperation]), hauteur[iOperation]); } } for (int i = 0; i < N; i ++) hauteurFinale[i] = min(valMax(corr(i)), valMin(corr(i))); }

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

wall.cpp: In function 'void corr(int)':
wall.cpp:14:14: error: return-statement with a value, in function returning 'void' [-fpermissive]
   14 |   return ind + (1 << 17);
      |          ~~~~^~~~~~~~~~~
wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:72:20: error: invalid use of void expression
   72 |       interMax(corr(gauche[iOperation]), corr(droite[iOperation]), hauteur[iOperation]);
      |                ~~~~^~~~~~~~~~~~~~~~~~~~
wall.cpp:75:20: error: invalid use of void expression
   75 |       interMin(corr(gauche[iOperation]), corr(droite[iOperation]), hauteur[iOperation]);
      |                ~~~~^~~~~~~~~~~~~~~~~~~~
wall.cpp:79:39: error: invalid use of void expression
   79 |     hauteurFinale[i] = min(valMax(corr(i)), valMin(corr(i)));
      |                                   ~~~~^~~
wall.cpp:79:56: error: invalid use of void expression
   79 |     hauteurFinale[i] = min(valMax(corr(i)), valMin(corr(i)));
      |                                                    ~~~~^~~