제출 #520305

#제출 시각아이디문제언어결과실행 시간메모리
520305new_acc동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "cave.h" #define ll long long #define fi first #define se second using namespace std; const int N=5000+10; bool aktres[N]; bool vis[N]; int ans[N]; int n; bool pom[N]; int bs1(int i){ int pocz=0,kon=n-1; int sr; int res=0; while(pocz<=kon){ sr=(pocz+kon)/2; for(int j=0;j<n;j++){ if(vis[j]) pom[j]=aktres[j]; else pom[j]=0; } for(int j=0;j<=sr;j++) if(!vis[j]) pom[j]=1; int xd=tryCombination(pom); if(xd>i||xd==-1){ res=sr; kon=sr-1; }else pocz=sr+1; } return res; } int bs2(int i){ int pocz=0,kon=n-1; int sr; int res=0; while(pocz<=kon){ sr=(pocz+kon)/2; for(int j=0;j<n;j++){ if(vis[j]) pom[j]=aktres[j]; else pom[j]=1; } for(int j=0;j<=sr;j++) if(!vis[j]) pom[j]=0; int xd=tryCombination(pom); if(xd>i||xd==-1){ res=sr; kon=sr-1; }else pocz=sr+1; } return res; } void exploreCabe(int n){ for(int i=0;i<n;i++){ int a=tryCombination(aktres); bool curr=(a==-1?1:a>i); curr^=1; int xd=0; if(curr) xd=bs1(i); else xd=bs2(i); aktres[xd]=curr; vis[xd]=1; ans[xd]=i; } answer(aktres,ans); }

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

cave.cpp: In function 'int bs1(int)':
cave.cpp:24:25: error: cannot convert 'bool*' to 'int*'
   24 |   int xd=tryCombination(pom);
      |                         ^~~
      |                         |
      |                         bool*
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp: In function 'int bs2(int)':
cave.cpp:43:25: error: cannot convert 'bool*' to 'int*'
   43 |   int xd=tryCombination(pom);
      |                         ^~~
      |                         |
      |                         bool*
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp: In function 'void exploreCabe(int)':
cave.cpp:53:24: error: cannot convert 'bool*' to 'int*'
   53 |   int a=tryCombination(aktres);
      |                        ^~~~~~
      |                        |
      |                        bool*
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:64:9: error: cannot convert 'bool*' to 'int*'
   64 |  answer(aktres,ans);
      |         ^~~~~~
      |         |
      |         bool*
In file included from cave.cpp:2:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~