Submission #668820

#TimeUsernameProblemLanguageResultExecution timeMemory
668820as111Board (CEOI13_board)C++14
0 / 100
6 ms980 KiB
#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] = 1; pos--; } } } } }

Compilation message (stderr)

board.cpp: In function 'int main()':
board.cpp:15:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  for (int i = 0; i < A.length(); i++) {
      |                  ~~^~~~~~~~~~~~
board.cpp:11:6: warning: unused variable 'startA' [-Wunused-variable]
   11 |  int startA = 0;
      |      ^~~~~~
board.cpp:12:6: warning: unused variable 'startB' [-Wunused-variable]
   12 |  int startB = 0;
      |      ^~~~~~
board.cpp:14:6: warning: unused variable 'endB' [-Wunused-variable]
   14 |  int endB = 0;
      |      ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...