Submission #574504

#TimeUsernameProblemLanguageResultExecution timeMemory
574504ArvinAncient Machine (JOI21_ancient_machine)C++17
0 / 100
38 ms5216 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; #define ll long long namespace { int variable_example = 0; } void Anna(int N, std::vector<char> S) { vector<int> ans; vector<pair<int, int>> v; int pos = -1; for(int x=0;x<N;x++){ if(S[x] == 'Z'){ while(!v.empty()){ if(pos != -1){ Send(1); ans.push_back(pos); } Send(1); ans.push_back(v.back().second); pos = v.back().first; v.pop_back(); } Send(1); ans.push_back(x); } else if(S[x] == 'Y'){ if(pos != -1){ Send(0); v.push_back({pos, x}); pos = -1; } else { Send(1); ans.push_back(x); } } else if(S[x] == 'X'){ if(pos != -1){ Send(1); ans.push_back(x); } else { Send(0); pos = x; } } } while(!v.empty()){ Send(1); Send(1); ans.push_back(v.back().first); ans.push_back(v.back().second); v.pop_back(); } if(pos != -1){ Send(1); ans.push_back(pos); pos = -1; } }
#include "Bruno.h" #include <bits/stdc++.h> using namespace std; #define ll long long namespace { int variable_example = 0; int FunctionExample(int P) { return 1 - P; } } // namespace void Bruno(int N, int L, std::vector<int> A) { // for (int i = 0; i < L; i++) { // variable_example += FunctionExample(A[i]); // } vector<int> ans; vector<int> v; int lst = 0; for(int x=0;x<N;x++){ if(A[x] == 0){ v.push_back(x); lst = x+1; } else if(A[x] == 1){ if(x+1 < N && A[x+1] == 1) continue; int cnt = x-lst+1; cnt--; while(cnt > 0){ ans.push_back(v.back()); v.pop_back(); } ans.push_back(x); lst = x+1; } } for(auto val : ans){ // cout << "- " << val << "\n"; Remove(val); } }

Compilation message (stderr)

Anna.cpp:10:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   10 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~

Bruno.cpp:12:5: warning: 'int {anonymous}::FunctionExample(int)' defined but not used [-Wunused-function]
   12 | int FunctionExample(int P) { return 1 - P; }
      |     ^~~~~~~~~~~~~~~
Bruno.cpp:10:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   10 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...