제출 #416945

#제출 시각아이디문제언어결과실행 시간메모리
416945oolimryAncient Machine (JOI21_ancient_machine)C++17
69 / 100
88 ms9060 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){ 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++){ if(s[i] == 'Z') tosend.push_back(1); else tosend.push_back(0); } 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){ int vis[n]; fill(vis,vis+n,0); 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(); } int prev = X+1; for(int i = X+1;i < n;i++){ int a = A[i-X-1]; if(a == 1){ for(int j = i-1;j >= prev;j--) Remove(j), vis[j] = 1; Remove(i); vis[i] = 1; prev = i+1; } } for(int i = 0;i < n;i++){ if(not vis[i]) Remove(i); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...