# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
668826 | as111 | Board (CEOI13_board) | C++14 | 989 ms | 1232 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <string>
#define MAXN 100000
using namespace std;
int bitA[MAXN + 5];
int bitB[MAXN + 5];
int main() {
string A, B;
cin >> A >> B;
int startA = 0;
int startB = 0;
int endA = 0;
int endB = 0;
for (int i = 0; i < A.length(); i++) {
if (A[i] == '1') {
bitA[endA] = 0;
endA++;
}
if (A[i] == '2') {
bitA[endA] = 1;
endA++;
}
if (A[i] == 'U') {
endA--;
}
if (A[i] == 'L') { // subtract 1
if (bitA[endA] == 1)bitA[endA] = 0;
if (bitA[endA] == 0) {
int pos = endA;
while (pos > 0) {
if (bitA[pos] == 1) {
bitA[pos] = 0;
break;
}
bitA[pos] = 1;
pos--;
}
}
}
if (A[i] == 'R') { // add 1
if (bitA[endA] == 0)bitA[endA] = 1;
if (bitA[endA] == 1) {
int pos = endA;
while (pos > 0) {
if (bitA[pos] == 0) {
bitA[pos] = 1;
break;
}
bitA[pos] = 0;
pos--;
}
}
}
}
for (int i = 0; i < B.length(); i++) {
if (B[i] == '1') {
bitB[endB] = 0;
endB++;
}
if (B[i] == '2') {
bitB[endB] = 1;
endB++;
}
if (B[i] == 'U') {
endB--;
}
if (B[i] == 'L') { // subtract 1
if (bitB[endB] == 1)bitB[endB] = 0;
if (bitB[endB] == 0) {
int pos = endB;
while (pos > 0) {
if (bitB[pos] == 1) {
bitB[pos] = 0;
break;
}
bitB[pos] = 1;
pos--;
}
}
}
if (B[i] == 'R') { // add 1
if (bitB[endB] == 0)bitB[endB] = 1;
if (bitB[endB] == 1) {
int pos = endB;
while (pos > 0) {
if (bitB[pos] == 0) {
bitB[pos] = 1;
break;
}
bitB[pos] = 0;
pos--;
}
}
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |