# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
537700 | Jarif_Rahman | Ancient Machine (JOI21_ancient_machine) | C++17 | 91 ms | 9696 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anna.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
namespace {
}
void Anna(int n, vector<char> s){
for(int i = 0; i < n; i++){
if(s[i] == 'X') Send(0), Send(0);
else if(s[i] == 'Y') Send(0), Send(1);
else Send(1);
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
namespace {
}
void Bruno(int n, int m, vector<int> A){
str s = "";
for(int i = 0; i < m; i++){
if(A[i] == 0){
if(A[i+1] == 0) s+="X";
else s+="Y";
i++;
}
else s+="Z";
}
list<pair<int, char>> ls;
for(int i = 0; i < n; i++) ls.pb({i, s[i]});
for(auto it = ls.begin(); it != ls.end();){
if(it == ls.begin() || prev(it)->sc != it->sc){
it++;
continue;
}
Remove(it->f);
it = ls.erase(it);
}
while(!ls.empty() && ls.begin()->sc != 'X')
Remove(ls.begin()->f), ls.erase(ls.begin());
while(!ls.empty() && prev(ls.end())->sc != 'Z')
Remove(prev(ls.end())->f), ls.erase(prev(ls.end()));
if(ls.empty()) return;
for(auto it = ls.begin(); it != ls.end();){
if(it->sc != 'Z'){
it++;
continue;
}
for(auto it2 = prev(it); it2 != ls.begin();)
Remove(it2->f), it2 = ls.erase(it2), it2--;
Remove(it->f);
it = ls.erase(it);
}
Remove(ls.begin()->f);
ls.erase(ls.begin());
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |