# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
996378 | hotboy2703 | Ancient Machine (JOI21_ancient_machine) | C++17 | 66 ms | 11468 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anna.h"
#include<bits/stdc++.h>
using ll = int;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1)
#define MASK(i) (1LL << (i))
namespace A{
}
void Anna(int N, std::vector<char> S) {
using namespace A;
for (ll i = 0;i < N;i ++){
Send(BIT(S[i] - 'X',0));
Send(BIT(S[i] - 'X',1));
}
}
#include "Bruno.h"
#include<bits/stdc++.h>
using ll = int;
using namespace std;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1)
#define MASK(i) (1LL << (i))
namespace B{
struct pt{
ll type,l,r;
};
void del(pt x){
for (ll i = x.l;i <= x.r;i ++)Remove(i);
}
} // namespace
void Bruno(int N, int L, std::vector<int> A) {
using namespace B;
vector <ll> a;
for (ll i = 0;i < N;i ++){
a.push_back(A[i*2] + A[i*2+1] * 2);
}
vector <pt> nw;
for (ll i = 0;i < N;i ++){
ll j = i;
while (j + 1 < N && a[j+1] == a[i])j++;
nw.push_back({a[i],i,j});
i = j;
}
while (!nw.empty() && nw.back().type != 2){
del(nw.back());
nw.pop_back();
}
ll last0 = -1;
for (ll i = 0;i < sz(nw);i ++){
if (last0 == -1){
if (nw[i].type == 0)last0 = i;
else{
del(nw[i]);
}
}
else{
ll j = i;
while (nw[j].type != 2)j++;
for (ll k = j - 1;k >= i;k --){
del(nw[k]);
}
del(nw[j]);
i = j;
}
}
if (last0 != -1)del(nw[last0]);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |