제출 #394386

#제출 시각아이디문제언어결과실행 시간메모리
394386oolimryAncient Machine (JOI21_ancient_machine)C++17
0 / 100
72 ms8148 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define sz(x) ((int) x.size()) #define show(x) cerr << #x << " is " << x << endl; #define show2(x, y) cerr << #x << " is " << x << ", " << #y << " is " << y << endl; typedef long long lint; typedef pair<lint, lint> ii; void Anna(int n, vector<char> s){ bool hasY = false; int X = -1; for(int i = 0;i < n;i++){ if(s[i] == 'X'){ X = i; break; } } if(X == -1) return; vector<int> tosend; for(int i = X+1;i < n;i++){ int res = 0; if(s[i] == 'Y'){ if(hasY) res = 0; else res = 1, hasY = true; } else if(s[i] == 'Z'){ if(hasY) res = 1, hasY = false; else res = 0; } else res = 0; tosend.push_back(res); } for(int x : tosend) Send(x); for(int i = 0;i < 18;i++){ Send(X&1); X >>= 1; } }
#include "Bruno.h" #include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define sz(x) ((int) x.size()) #define show(x) cerr << #x << " is " << x << endl; #define show2(x, y) cerr << #x << " is " << x << ", " << #y << " is " << y << endl; typedef long long lint; typedef pair<lint, lint> ii; void Bruno(int n, int L, vector<int> A) { if(sz(A) == 0){ for(int i = 0;i < n;i++) Remove(i); return; } int X = 0; for(int i = 0;i < 18;i++){ X *= 2; X += A.back(); A.pop_back(); } show(X); for(int i = 0;i < X;i++) Remove(i); for(int i = X+1;i < n;i++){ if(A[i-X-1] == 0) Remove(i); } for(int i = X+1;i < n;i++){ if(A[i-X-1] == 1) Remove(i); } Remove(X); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...