# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1051895 | awu | Ancient Machine (JOI21_ancient_machine) | C++17 | 288 ms | 10016 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 last = ' ';
vector<int> ans(n);
int z = 0;
for(int i = 0; i < n; i++) {
if(s[i] == 'Z') z = i;
}
for(int i = 0; i < z; i++) {
if(last == ' ' && s[i] == 'X') {
ans[i] = 2;
last = 'X';
} else if(last == 'Y' && s[i] == 'X') {
ans[i] = 2;
last = 'X';
} else if(last == 'Y' && s[i] == 'Z') {
ans[i] = 3;
last = 'X';
} else if(last == 'X' && s[i] == 'Y') {
ans[i] = 1;
last = 'Y';
}
}
if(last == ' ') return;
if(last == 'X') {
for(int i = z; i >= 0; i--) {
if(ans[i]) {
ans[i] = 0;
break;
}
}
}
ans[z] = 3;
for(auto i : ans) {
if(i >= 2) {
Send(1);
Send(i & 1);
} else {
Send(i);
}
}
}
#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) {
debug(a);
if(a.empty()) {
for(int i = 0; i < n; i++) {
Remove(i);
}
return;
}
string s;
int i = 0;
char last = 'Y';
while(i < a.size()) {
if(a[i]) {
if(last == 'Y') {
s.push_back(a[i + 1] ? 'Z' : 'X');
i += 2;
last = 'X';
} else {
s.push_back('Y');
i++;
last = 'Y';
}
} else {
s.push_back('.');
i++;
}
}
int z = 0;
for(int i = 0; i < n; i++) {
if(s[i] == 'Z') z = i;
}
for(int i = 0; i < n; i++) {
if(s[i] == '.') Remove(i);
}
int prv = 0;
for(int i = 0; i < n; i++) {
if(s[i] == '.') continue;
if(s[i] == 'Z' && i != z) {
Remove(prv);
Remove(i);
s[prv] = s[i] = '.';
}
prv = i;
}
prv = n - 1;
for(int i = n - 1; i >= 0; i--) {
if(s[i] == '.') continue;
if(s[i] == 'X') {
Remove(prv);
Remove(i);
s[prv] = s[i] = '.';
}
prv = i;
}
Remove(z);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |