Submission #1051743

#TimeUsernameProblemLanguageResultExecution timeMemory
1051743awuAncient Machine (JOI21_ancient_machine)C++17
0 / 100
35 ms8040 KiB
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;

// #define int long long
#define ll long long
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) [&](decltype(x) _x) {cerr << #x << " = " << _x << endl; return _x;}(x)
using pii =  pair<int, int>;

const ll inf = 1ll << 60;

template <typename T, typename U>
ostream& operator<<(ostream& out, pair<T, U> p) {
  return out << "(" << p.f << ", " << p.s << ")";
}
template <typename T, typename = decltype(begin(declval<T>()))>
typename enable_if<!is_same<T, string>::value, ostream&>::type operator<<(ostream& out, T x) {
  string dlm = "";
  out << "{";
  for(auto i : x) {
    out << dlm << i;
    dlm = ", ";
  }
  return out << "}";
}

#include "Anna.h"

void Anna(int n, vector<char> s) {
  char want = 'X';
  for(int i = 0; i < n; i++) {
    if(s[i] == want) {
      Send(1);
      if(want == 'Y') want = 'Z';
      else want = 'Y';
    } else {
      Send(0);
    }
  }
}
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;

// #define int long long
#define ll long long
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) [&](decltype(x) _x) {cerr << #x << " = " << _x << endl; return _x;}(x)
using pii =  pair<int, int>;

const ll inf = 1ll << 60;

template <typename T, typename U>
ostream& operator<<(ostream& out, pair<T, U> p) {
  return out << "(" << p.f << ", " << p.s << ")";
}
template <typename T, typename = decltype(begin(declval<T>()))>
typename enable_if<!is_same<T, string>::value, ostream&>::type operator<<(ostream& out, T x) {
  string dlm = "";
  out << "{";
  for(auto i : x) {
    out << dlm << i;
    dlm = ", ";
  }
  return out << "}";
}

#include "Bruno.h"

void Bruno(int n, int l, vector<int> a) {
  for(int i = 0; i < n; i++) {
    if(!a[i]) Remove(i);
  }
  bool x = false;
  for(int i = 0; i < n; i++) {
    if(a[i]) {
      if(x) Remove(i);
      else x = true;
    }
  }
  for(int i = 0; i < n; i++) {
    if(a[i]) {
      Remove(i);
      break;
    }
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...