Submission #715217

#TimeUsernameProblemLanguageResultExecution timeMemory
715217duchuy297Ancient Machine (JOI21_ancient_machine)C++17
30 / 100
83 ms9636 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; namespace { int variable_example = 0; } void Anna(int N, std::vector<char> S) { for (auto u : S) { if (u == 'X') Send (0), Send (0); else if (u == 'Y') Send (0), Send(1); else Send (1), Send(0); } }
#include "Bruno.h" #include <bits/stdc++.h> using namespace std; void Bruno(int N, int L, std::vector<int> A) { string s; int n = N; for (int i=0; i<2*n; i+=2) { if (A[i] == 0 && A[i+1] == 0) s.push_back('X'); else if (A[i] == 0 && A[i+1] == 1) s.push_back('Y'); else s.push_back('Z'); } int l = -1, r = -1; for (int i=0; i<n; i++) { if (s[i] == 'X') { l = i; break; } } for (int i=n-1; i>=0; i--) { if (s[i] == 'Z') { r = i; break; } } // cout << s << ' ' << l << ' ' << r << '\n'; if (l == -1 || r == -1 || l > r) { for (int i=0; i<n; i++) Remove(i); return; } for (int i=0; i<l; i++) Remove(i); for (int i=r+1; i<n; i++) Remove(i); stack<int> st; st.push(l); for (int i=l+1; i<=r; i++) { int u = st.top(); if (s[i] == s[u]) { Remove(i); continue; } if (s[i] == 'Z') { while (st.size() > 1) { int u = st.top(); Remove(u); st.pop(); } Remove(i); } else st.push(i); } while (st.size()) { int u = st.top(); Remove(u); st.pop(); } }

Compilation message (stderr)

Anna.cpp:6:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    6 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...