제출 #548383

#제출 시각아이디문제언어결과실행 시간메모리
548383TrungNotChungAncient Machine (JOI21_ancient_machine)C++17
컴파일 에러
0 ms0 KiB
#define BIT(x,i) (1&((x)>>(i))) #define MASK(x) (1LL<<(x)) #define CNT(x) __builtin_popcountll(x) #include <bits/stdc++.h> #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 <bits/stdc++.h> #include "Bruno.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(); }

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

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:15:22: error: 'min' was not declared in this scope; did you mean 'std::min'?
   15 |     for(int j=i ; j<=min(N-1 , i+37) ; ++j)
      |                      ^~~
      |                      std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Anna.cpp:4:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:11:3: error: 'vector' was not declared in this scope
   11 |   vector<char> s;
      |   ^~~~~~
Bruno.cpp:11:3: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 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 /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 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:11:10: error: expected primary-expression before 'char'
   11 |   vector<char> s;
      |          ^~~~
Bruno.cpp:23:7: error: 's' was not declared in this scope
   23 |       s.push_back(ch[c]);
      |       ^
Bruno.cpp:27:3: error: 'stack' was not declared in this scope; did you mean 'std::stack'?
   27 |   stack<int> st;
      |   ^~~~~
      |   std::stack
In file included from /usr/include/c++/10/stack:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:89,
                 from Bruno.cpp:4:
/usr/include/c++/10/bits/stl_stack.h:99:11: note: 'std::stack' declared here
   99 |     class stack
      |           ^~~~~
Bruno.cpp:27:9: error: expected primary-expression before 'int'
   27 |   stack<int> st;
      |         ^~~
Bruno.cpp:30:8: error: 'st' was not declared in this scope; did you mean 'std'?
   30 |     if(st.size() && s[i] == s[st.top()])
      |        ^~
      |        std
Bruno.cpp:30:21: error: 's' was not declared in this scope
   30 |     if(st.size() && s[i] == s[st.top()])
      |                     ^
Bruno.cpp:35:8: error: 's' was not declared in this scope
   35 |     if(s[i] == 'X')
      |        ^
Bruno.cpp:37:7: error: 'st' was not declared in this scope; did you mean 'std'?
   37 |       st.push(i);
      |       ^~
      |       std
Bruno.cpp:41:10: error: 'st' was not declared in this scope; did you mean 'std'?
   41 |       if(st.size()) st.push(i);
      |          ^~
      |          std
Bruno.cpp:46:15: error: 'st' was not declared in this scope; did you mean 'std'?
   46 |       if((int)st.size() < 2)
      |               ^~
      |               std
Bruno.cpp:51:10: error: 'st' was not declared in this scope; did you mean 'std'?
   51 |       if(st.size() && s[st.top()] == 'X')
      |          ^~
      |          std
Bruno.cpp:56:18: error: 'st' was not declared in this scope; did you mean 'std'?
   56 |       while((int)st.size() > 2)
      |                  ^~
      |                  std
Bruno.cpp:63:15: error: 'st' was not declared in this scope; did you mean 'std'?
   63 |       if((int)st.size() == 2)
      |               ^~
      |               std
Bruno.cpp:71:9: error: 'st' was not declared in this scope; did you mean 'std'?
   71 |   while(st.size()) Remove(st.top()) , st.pop();
      |         ^~
      |         std