제출 #878873

#제출 시각아이디문제언어결과실행 시간메모리
878873raul2008487동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" #define ll long long #define pb push_back #define eb emplace_back #define vl vector<ll> #define fi first #define se second #define in insert #define mpr make_pair #define lg(x) __lg(x) #define bpc(x) __builtin_popcount(x) #define all(v) v.begin(), v.end() #define endl "\n" using namespace std; const int sz = 5005; bool used[sz]; void exploreCave(int N) { ll n, i, j, low, high, mid, a1, a2; ll ans1[n] = {0}, ans2[n], dub[n] = {0}; bool as = 0; for(i=0;i<n;i++){ a1 = tryCombination(ans1); low = 0, high = n-1; if(a1 == -1){a1 = n;} if(a1 > i){as = 1;} else{as = 0;} while(low < high){ mid = (low + high)>>1; for(j=0;j<n;j++){ dub[j] = a[j]; if(used[j]){continue;} if(j > mid && j <= high){ dub[j] = 1; } } a2 = tryCombination(dub); if(a2 == -1){a2 = n;} if(as && a2 == i){ low = mid + 1; } else if(!as && a2 > i){ low = mid + 1; } else{ high = mid - 1; } } ans2[low] = i; if(!as){ ans1[l] = 1 - ans1[l]; } used[l] = 1; } answer(ans1, ans2); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:24:29: error: cannot convert 'long long int*' to 'int*'
   24 |         a1 = tryCombination(ans1);
      |                             ^~~~
      |                             |
      |                             long long int*
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:32:26: error: 'a' was not declared in this scope; did you mean 'as'?
   32 |                 dub[j] = a[j];
      |                          ^
      |                          as
cave.cpp:38:33: error: cannot convert 'long long int*' to 'int*'
   38 |             a2 = tryCombination(dub);
      |                                 ^~~
      |                                 |
      |                                 long long int*
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:52:18: error: 'l' was not declared in this scope
   52 |             ans1[l] = 1 - ans1[l];
      |                  ^
cave.cpp:54:14: error: 'l' was not declared in this scope
   54 |         used[l] = 1;
      |              ^
cave.cpp:56:12: error: cannot convert 'long long int*' to 'int*'
   56 |     answer(ans1, ans2);
      |            ^~~~
      |            |
      |            long long int*
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[]);
      |             ~~~~^~~