Submission #574447

#TimeUsernameProblemLanguageResultExecution timeMemory
574447ArvinAncient Machine (JOI21_ancient_machine)C++17
0 / 100
77 ms10084 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) { for(int x=0;x<N;x++){ if(S[x] == 'X'){ Send(1); Send(0); } else if(S[x] == 'Y'){ Send(0); Send(1); } else if(S[x] == 'Z'){ Send(1); Send(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]); // } int S[N]; for(int x=0;x<N;x++){ S[x] = 0; for(int y=0;y<2;y++){ if(A[2*x+y] == 1){ S[x] += (1 << y); } } } int lst = N; for(int x=N-1;x>=0;x--){ if(S[x] == 3){ lst = x; break; } } vector<int> ans; vector<pair<int, int>> v[2]; for(int x=0;x<N;x++){ if(S[x] == 3){ if(x != lst){ ans.push_back(x); continue; } while(!v[1].empty()){ int r = v[1].back().second; while(!v[0].empty() && v[0].back().first > r){ ans.push_back(v[0].back().first); v[0].pop_back(); } ans.push_back(r); ans.push_back(v[1].back().first); v[1].pop_back(); } ans.push_back(x); } else if(S[x] == 2){ if(!v[0].empty()){ v[1].push_back({v[0].back().first, x}); v[0].pop_back(); } else { ans.push_back(x); } } else if(S[x] == 1){ v[0].push_back({x, -1}); } } while(!v[1].empty()){ ans.push_back(v[1].back().first); ans.push_back(v[1].back().second); v[1].pop_back(); } while(!v[0].empty()){ ans.push_back(v[0].back().first); v[0].pop_back(); } for(auto val : ans){ 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...