# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
752179 | 2023-06-02T12:35:52 Z | Sam_a17 | Ancient Machine (JOI21_ancient_machine) | C++17 | 컴파일 오류 |
0 ms | 0 KB |
#include <bits/stdc++.h> #include "Anna.h" void Send(int a); void Anna(int N, std::vector<char> S) { Send(0); for(int i = 0; i < N; i++) { if(S[i] == 'X') { Send(0); } else if(S[i] == 'Y') { Send(1); Send(0); } else { Send(1); Send(1); Send(0); } } }
#include <bits/stdc++.h> #include "Bruno.h" void Remove(int d); void Bruno(int N, int L, std::vector<int> A) { vector<int> a; for(int i = 0; i < L - 1; i++) { assert(A[i] == 0); int j = i + 1, cnt = 0; while(j < L && A[j] == 1) { j++, cnt++; } if(cnt == 0) { a.push_back(0); } else if(cnt == 1) { a.push_back(1); } else { a.push_back(2); } i = j - 1; } set<int> st[3]; auto dll = [&](int l, int r)-> void { for(int i = 0; i < 3; i++) { auto it = st[i].lower_bound(l); vector<int> to_del; while(it != st[i].end() && *it < r) { to_del.push_back(*it); it = next(it); } for(auto j: to_del) { Remove(j); st[i].erase(j); } } }; for (int i = 0; i < N; i++) { int ok = 0; if(a[i] == 2) { if(!st[1].empty() && !st[0].empty()) { auto itr = *st[1].rbegin(); auto itl = *st[0].begin(); if(itl < itr) { dll(itr + 1, i); itl = *st[0].rbegin(); dll(itl + 1, itr); // st[1].erase(prev(st[1].end())); Remove(itr); ok = 1; } } } st[a[i]].insert(i); } for(int i = 0; i < 3; i++) { for(auto j: st[i]) { Remove(j); } } }
Compilation message
Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)': Bruno.cpp:6:3: error: 'vector' was not declared in this scope 6 | vector<int> a; | ^~~~~~ Bruno.cpp:6: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:1: /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:1: /usr/include/c++/10/vector:86:13: note: 'std::pmr::vector' 86 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>; | ^~~~~~ Bruno.cpp:6:10: error: expected primary-expression before 'int' 6 | vector<int> a; | ^~~ Bruno.cpp:16:7: error: 'a' was not declared in this scope 16 | a.push_back(0); | ^ Bruno.cpp:18:7: error: 'a' was not declared in this scope 18 | a.push_back(1); | ^ Bruno.cpp:20:7: error: 'a' was not declared in this scope 20 | a.push_back(2); | ^ Bruno.cpp:26:3: error: 'set' was not declared in this scope 26 | set<int> st[3]; | ^~~ Bruno.cpp:26:3: note: suggested alternatives: In file included from /usr/include/c++/10/set:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from Bruno.cpp:1: /usr/include/c++/10/bits/stl_set.h:94:11: note: 'std::set' 94 | class set | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from Bruno.cpp:1: /usr/include/c++/10/set:78:13: note: 'std::pmr::set' 78 | using set = std::set<_Key, _Cmp, polymorphic_allocator<_Key>>; | ^~~ Bruno.cpp:26:7: error: expected primary-expression before 'int' 26 | set<int> st[3]; | ^~~ Bruno.cpp: In lambda function: Bruno.cpp:30:17: error: 'st' was not declared in this scope; did you mean 'std'? 30 | auto it = st[i].lower_bound(l); | ^~ | std Bruno.cpp:31:14: error: expected primary-expression before 'int' 31 | vector<int> to_del; | ^~~ Bruno.cpp:33:9: error: 'to_del' was not declared in this scope 33 | to_del.push_back(*it); | ^~~~~~ Bruno.cpp:34:14: error: 'next' was not declared in this scope; did you mean 'std::next'? 34 | it = next(it); | ^~~~ | std::next In file included from /usr/include/c++/10/bits/stl_algobase.h:66, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from Bruno.cpp:1: /usr/include/c++/10/bits/stl_iterator_base_funcs.h:213:5: note: 'std::next' declared here 213 | next(_InputIterator __x, typename | ^~~~ Bruno.cpp:37:19: error: 'to_del' was not declared in this scope 37 | for(auto j: to_del) { | ^~~~~~ Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)': Bruno.cpp:47:8: error: 'a' was not declared in this scope 47 | if(a[i] == 2) { | ^ Bruno.cpp:48:11: error: 'st' was not declared in this scope; did you mean 'std'? 48 | if(!st[1].empty() && !st[0].empty()) { | ^~ | std Bruno.cpp:58:23: error: 'prev' was not declared in this scope; did you mean 'std::prev'? 58 | st[1].erase(prev(st[1].end())); | ^~~~ | std::prev In file included from /usr/include/c++/10/bits/stl_algobase.h:66, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from Bruno.cpp:1: /usr/include/c++/10/bits/stl_iterator_base_funcs.h:224:5: note: 'std::prev' declared here 224 | prev(_BidirectionalIterator __x, typename | ^~~~ Bruno.cpp:65:5: error: 'st' was not declared in this scope; did you mean 'std'? 65 | st[a[i]].insert(i); | ^~ | std Bruno.cpp:65:8: error: 'a' was not declared in this scope 65 | st[a[i]].insert(i); | ^ Bruno.cpp:69:17: error: 'st' was not declared in this scope; did you mean 'std'? 69 | for(auto j: st[i]) { | ^~ | std