Submission #1294745

#TimeUsernameProblemLanguageResultExecution timeMemory
1294745NValchanovAncient Machine (JOI21_ancient_machine)C++20
Compilation error
0 ms0 KiB
#include "Bruno.h" #include <vector> #include <algorithm> #include <stack> #include <iostream> using namespace std; const int MAXN = 1e5 + 10; const int BLOCK_SIZE = 63; const int MAXLOG = 17; const int MAXBITS = 44; namespace { typedef unsigned long long ulong; vector < int > red; ulong f[BLOCK_SIZE + 2 + 1]; void fill_f() { f[0] = 1; f[1] = 1; for(int i = 2; i <= BLOCK_SIZE + 2; i++) { f[i] = f[i - 1] + f[i - 2]; } } vector < bool > decode(ulong x) { vector < bool > result; for(int i = BLOCK_SIZE - 1; i >= 0; i--) { if(x >= f[i]) { x -= f[i]; result.push_back(1); } else { result.push_back(0); } } return result; } } void Bruno(int n, int l, vector < int > a) { if(l == 1) { for(int i = 0; i < n; i++) { Remove(i); } return; } fill_f(); vector < bool > red; for(int i = 0; i < l; i += MAXBITS) { ulong type = 0; for(int j = 0; j < MAXBITS; j++) { if(a[i + j]) { type += (1LL << j); } } vector < bool > tmp = decode(type); for(bool b : tmp) { red.push_back(b); } } int ptr = 0; while(ptr < n && red[ptr] == 0) { Remove(ptr); ptr++; } int firstx = ptr; int last = firstx; ptr++; while(ptr < n) { if(red[ptr]) { for(int i = ptr - 1; i > last; i--) { Remove(i); } Remove(ptr); last = ptr; } ptr++; } for(int i = last + 1; i < n; i++) { Remove(i); } if(firstx < n) Remove(firstx); }
#include "Bruno.h" #include <vector> #include <algorithm> #include <stack> #include <iostream> using namespace std; typedef unsigned long long ulong; const int MAXN = 1e5 + 10; const int BLOCK_SIZE = 63; const int MAXLOG = 17; const int MAXBITS = 44; namespace { vector < int > red; ulong f[BLOCK_SIZE + 2 + 1]; void fill_f() { f[0] = 1; f[1] = 1; for(int i = 2; i <= BLOCK_SIZE + 2; i++) { f[i] = f[i - 1] + f[i - 2]; } } vector < bool > decode(ulong x) { vector < bool > result; for(int i = BLOCK_SIZE - 1; i >= 0; i--) { if(x >= f[i]) { x -= f[i]; result.push_back(1); } else { result.push_back(0); } } return result; } } void Bruno(int n, int l, vector < int > a) { if(l == 1) { for(int i = 0; i < n; i++) { Remove(i); } return; } fill_f(); vector < bool > red; for(int i = 0; i < l; i += MAXBITS) { ulong type = 0; for(int j = 0; j < MAXBITS; j++) { if(a[i + j]) { type += (1LL << j); } } vector < bool > tmp = decode(type); for(bool b : tmp) { red.push_back(b); } } int ptr = 0; while(ptr < n && red[ptr] == 0) { Remove(ptr); ptr++; } int firstx = ptr; int last = firstx; ptr++; while(ptr < n) { if(red[ptr]) { for(int i = ptr - 1; i > last; i--) { Remove(i); } Remove(ptr); last = ptr; } ptr++; } for(int i = last + 1; i < n; i++) { Remove(i); } if(firstx < n) Remove(firstx); }

Compilation message (stderr)

# 1번째 컴파일 단계

Anna.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Anna.cpp:68:9: error: reference to 'ulong' is ambiguous
   68 |         ulong type = 0;
      |         ^~~~~
Anna.cpp:15:30: note: candidates are: 'typedef long long unsigned int {anonymous}::ulong'
   15 |   typedef unsigned long long ulong;
      |                              ^~~~~
In file included from /usr/include/stdlib.h:514,
                 from /usr/include/c++/13/cstdlib:79,
                 from /usr/include/c++/13/bits/stl_algo.h:71,
                 from /usr/include/c++/13/algorithm:61,
                 from Anna.cpp:3:
/usr/include/x86_64-linux-gnu/sys/types.h:148:27: note:                 'typedef long unsigned int ulong'
  148 | typedef unsigned long int ulong;
      |                           ^~~~~
Anna.cpp:74:17: error: 'type' was not declared in this scope; did you mean 'std::__cmp_cat::type'?
   74 |                 type += (1LL << j);
      |                 ^~~~
      |                 std::__cmp_cat::type
In file included from /usr/include/c++/13/bits/stl_pair.h:65,
                 from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/vector:62,
                 from Bruno.h:1,
                 from Anna.cpp:1:
/usr/include/c++/13/compare:49:11: note: 'std::__cmp_cat::type' declared here
   49 |     using type = signed char;
      |           ^~~~
Anna.cpp:78:38: error: 'type' was not declared in this scope; did you mean 'std::__cmp_cat::type'?
   78 |         vector < bool > tmp = decode(type);
      |                                      ^~~~
      |                                      std::__cmp_cat::type
/usr/include/c++/13/compare:49:11: note: 'std::__cmp_cat::type' declared here
   49 |     using type = signed char;
      |           ^~~~