56412023-08-31 17:24:24TomaSajtTáblajáték 2 (70 pont)cpp17Partially correct 68/703ms4048 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N = 101;
  vector<int> d(N, 0);
  int row = 0;

  auto mult3 = [&]() {
    d.insert(d.begin(), 0);
    d.resize(N, 0);
  };
  auto div3 = [&]() {
    d.erase(d.begin());
    d.resize(N, 0);
  };
  auto inc = [&]() {
    int i = 0;
    while (d[i] == 2) {
      d[i] = 0;
      i++;
    }
    d[i]++;
  };
  auto dec = [&]() {
    int i = 0;
    while (d[i] == 0) {
      d[i] = 2;
      i++;
    }
    d[i]--;
  };

  int k;
  cin >> k;
  while (k--) {
    int op;
    cin >> op;
    if (op == 0)
      mult3(), row++;
    else if (op == 1)
      mult3(), inc(), row++;
    else if (op == 2)
      mult3(), inc(), inc(), row++;
    else if (op == 3)
      div3(), row--;
    else if (op == 4)
      dec();
    else if (op == 5)
      inc();
  }

  cout << row << '\n';

  auto it = find_if(d.rbegin(), d.rend(), [](int a) { return a != 0; });
  while (it != d.rend()) {
    cout << *it;
    it++;
  }
}
SubtaskSumTestVerdictTimeMemory
base68/70
1Accepted0/03ms1684 KiB
2Accepted0/03ms1852 KiB
3Accepted2/23ms2064 KiB
4Accepted3/33ms2268 KiB
5Accepted3/32ms2524 KiB
6Accepted3/32ms2764 KiB
7Accepted3/32ms2904 KiB
8Accepted3/32ms3124 KiB
9Accepted3/32ms3368 KiB
10Accepted3/32ms3412 KiB
11Accepted3/32ms3416 KiB
12Accepted3/32ms3528 KiB
13Accepted3/33ms3780 KiB
14Accepted3/33ms3840 KiB
15Accepted4/42ms3720 KiB
16Accepted4/42ms3728 KiB
17Accepted4/42ms3756 KiB
18Accepted4/42ms3732 KiB
19Accepted4/43ms3736 KiB
20Accepted4/42ms3816 KiB
21Accepted4/43ms3960 KiB
22Accepted4/43ms4048 KiB
23Partially correct1/32ms4044 KiB