Submission #49123

#TimeUsernameProblemLanguageResultExecution timeMemory
49123aomeSequence (BOI14_sequence)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; long long pow10[18]; long long res = 1e18; bool in[10]; void go(vector<int> vec, long long cur, int cnt) { if (vec.size() == 1) { for (int i = 9; i >= 0; --i) { if (vec[0] >> i & 1) cur += i * pow10[cnt++]; } if (res > cur) res = cur; return; } for (int i = 0; i < 10; ++i) { vector<int> buf; int k = i, mask = 0; for (auto j : vec) { if (j >> k & 1) j ^= 1 << k; mask |= j, k++; if (k == 10) { buf.push_back(mask), mask = k = 0; } } if (k) buf.push_back(mask); if (buf.size() < vec.size()) { go(buf, cur + i * pow10[cnt], cnt + 1); } } } int main() { ios::sync_with_stdio(false); int n; cin >> n; vector<int> vec; for (int i = 0; i < n; ++i) { int x; cin >> x, vec.push_back(1 << x); } pow10[0] = 1; for (int i = 1; i < 18; ++i) pow10[i] = pow10[i - 1] * 10; go(vec, 0, 0); cout << res; }

Compilation message (stderr)

sequence.cpp:5:19: error: 'long long int pow10 [18]' redeclared as different kind of symbol
 long long pow10[18];
                   ^
In file included from /usr/include/features.h:367:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:533,
                 from /usr/include/c++/7/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from sequence.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:122:1: note: previous declaration 'double pow10(double)'
 __MATHCALL (pow10,, (_Mdouble_ __x));
 ^
sequence.cpp: In function 'void go(std::vector<int>, long long int, int)':
sequence.cpp:12:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
    if (vec[0] >> i & 1) cur += i * pow10[cnt++];
                                               ^
sequence.cpp:12:34: error: invalid operands of types 'int' and 'double(double) noexcept' to binary 'operator*'
    if (vec[0] >> i & 1) cur += i * pow10[cnt++];
                                ~~^~~~~~~~~~~~~~
sequence.cpp:29:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
    go(buf, cur + i * pow10[cnt], cnt + 1);
                               ^
sequence.cpp:29:20: error: invalid operands of types 'int' and 'double(double) noexcept' to binary 'operator*'
    go(buf, cur + i * pow10[cnt], cnt + 1);
                  ~~^~~~~~~~~~~~
sequence.cpp: In function 'int main()':
sequence.cpp:41:9: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  pow10[0] = 1;
         ^
sequence.cpp:41:13: error: assignment of function 'double pow10(double)'
  pow10[0] = 1;
             ^
sequence.cpp:41:13: error: cannot convert 'int' to 'double(double) noexcept' in assignment
sequence.cpp:42:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  for (int i = 1; i < 18; ++i) pow10[i] = pow10[i - 1] * 10;
                                      ^
sequence.cpp:42:53: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  for (int i = 1; i < 18; ++i) pow10[i] = pow10[i - 1] * 10;
                                                     ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
sequence.cpp:42:55: error: invalid operands of types 'double(double) noexcept' and 'int' to binary 'operator*'
  for (int i = 1; i < 18; ++i) pow10[i] = pow10[i - 1] * 10;
                                          ~~~~~~~~~~~~~^~~~