Submission #548381

#TimeUsernameProblemLanguageResultExecution timeMemory
548381TrungNotChungAncient Machine (JOI21_ancient_machine)C++17
Compilation error
0 ms0 KiB
#define BIT(x,i) (1&((x)>>(i))) #define MASK(x) (1LL<<(x)) #define CNT(x) __builtin_popcountll(x) #include "Anna.h" const char ch[] = {'X' , 'Y' , 'Z'}; long long pw[50]; void Anna(int N, std::vector<char> S) { pw[0] = 1; for(int i=1 ; i<=38 ; ++i) pw[i] = 1LL * pw[i-1] * 3; for(int i=0 ; i<N ; i+=38) { long long tmp = 0; for(int j=i ; j<=min(N-1 , i+37) ; ++j) { for(int k=0 ; k<3 ; ++k) if(S[j] == ch[k]) { tmp += pw[j-i] * k; } } for(int j=0 ; j<=62 ; ++j) Send(BIT(tmp , j)); } }
#define BIT(x,i) (1&((x)>>(i))) #define MASK(x) (1LL<<(x)) #define CNT(x) __builtin_popcountll(x) #include "Anna.h" const char ch[] = {'X' , 'Y' , 'Z'}; long long pw[50]; void Bruno(int N, int L, std::vector<int> A) { vector<char> s; for(int i=0 ; i<L ; i+=63) { long long tmp = 0; for(int j=0 ; j<=62 ; ++j) { if(A[i+j] == 1) tmp += MASK(j); } for(int j=1 ; j<=38 ; ++j) { int c = tmp % 3; tmp /= 3; s.push_back(ch[c]); if((int)s.size() == N) break; } } stack<int> st; for(int i=0 ; i<N ; ++i) { if(st.size() && s[i] == s[st.top()]) { Remove(i); continue; } if(s[i] == 'X') { st.push(i); } else if(s[i] == 'Y') { if(st.size()) st.push(i); else Remove(i); } else { if((int)st.size() < 2) { Remove(i); continue; } if(st.size() && s[st.top()] == 'X') { Remove(st.top()); st.pop(); } while((int)st.size() > 2) { Remove(st.top()); st.pop(); Remove(st.top()); st.pop(); } if((int)st.size() == 2) { Remove(st.top()); st.pop(); } Remove(i); } } while(st.size()) Remove(st.top()) , st.pop(); }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:14:22: error: 'min' was not declared in this scope; did you mean 'std::min'?
   14 |     for(int j=i ; j<=min(N-1 , i+37) ; ++j)
      |                      ^~~
      |                      std::min
In file included from /usr/include/c++/10/vector:60,
                 from Anna.h:1,
                 from Anna.cpp:4:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: 'std::min' declared here
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:10:3: error: 'vector' was not declared in this scope
   10 |   vector<char> s;
      |   ^~~~~~
Bruno.cpp:10:3: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from Anna.h:1,
                 from Bruno.cpp:4:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from Anna.h:1,
                 from Bruno.cpp:4:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
Bruno.cpp:10:10: error: expected primary-expression before 'char'
   10 |   vector<char> s;
      |          ^~~~
Bruno.cpp:22:7: error: 's' was not declared in this scope
   22 |       s.push_back(ch[c]);
      |       ^
Bruno.cpp:26:3: error: 'stack' was not declared in this scope
   26 |   stack<int> st;
      |   ^~~~~
Bruno.cpp:26:9: error: expected primary-expression before 'int'
   26 |   stack<int> st;
      |         ^~~
Bruno.cpp:29:8: error: 'st' was not declared in this scope; did you mean 'std'?
   29 |     if(st.size() && s[i] == s[st.top()])
      |        ^~
      |        std
Bruno.cpp:29:21: error: 's' was not declared in this scope
   29 |     if(st.size() && s[i] == s[st.top()])
      |                     ^
Bruno.cpp:31:7: error: 'Remove' was not declared in this scope
   31 |       Remove(i);
      |       ^~~~~~
Bruno.cpp:34:8: error: 's' was not declared in this scope
   34 |     if(s[i] == 'X')
      |        ^
Bruno.cpp:36:7: error: 'st' was not declared in this scope; did you mean 'std'?
   36 |       st.push(i);
      |       ^~
      |       std
Bruno.cpp:40:10: error: 'st' was not declared in this scope; did you mean 'std'?
   40 |       if(st.size()) st.push(i);
      |          ^~
      |          std
Bruno.cpp:41:12: error: 'Remove' was not declared in this scope
   41 |       else Remove(i);
      |            ^~~~~~
Bruno.cpp:45:15: error: 'st' was not declared in this scope; did you mean 'std'?
   45 |       if((int)st.size() < 2)
      |               ^~
      |               std
Bruno.cpp:47:9: error: 'Remove' was not declared in this scope
   47 |         Remove(i);
      |         ^~~~~~
Bruno.cpp:50:10: error: 'st' was not declared in this scope; did you mean 'std'?
   50 |       if(st.size() && s[st.top()] == 'X')
      |          ^~
      |          std
Bruno.cpp:52:9: error: 'Remove' was not declared in this scope
   52 |         Remove(st.top());
      |         ^~~~~~
Bruno.cpp:55:18: error: 'st' was not declared in this scope; did you mean 'std'?
   55 |       while((int)st.size() > 2)
      |                  ^~
      |                  std
Bruno.cpp:57:9: error: 'Remove' was not declared in this scope
   57 |         Remove(st.top());
      |         ^~~~~~
Bruno.cpp:62:15: error: 'st' was not declared in this scope; did you mean 'std'?
   62 |       if((int)st.size() == 2)
      |               ^~
      |               std
Bruno.cpp:64:9: error: 'Remove' was not declared in this scope
   64 |         Remove(st.top());
      |         ^~~~~~
Bruno.cpp:67:7: error: 'Remove' was not declared in this scope
   67 |       Remove(i);
      |       ^~~~~~
Bruno.cpp:70:9: error: 'st' was not declared in this scope; did you mean 'std'?
   70 |   while(st.size()) Remove(st.top()) , st.pop();
      |         ^~
      |         std
Bruno.cpp:70:20: error: 'Remove' was not declared in this scope
   70 |   while(st.size()) Remove(st.top()) , st.pop();
      |                    ^~~~~~