56422023-08-31 17:25:12TomaSajtTáblajáték 2 (70 pont)cpp17Partially correct 68/703ms4504 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++;
  }
  cout << '\n';
}
SubtaskSumTestVerdictTimeMemory
base68/70
1Accepted0/03ms1944 KiB
2Accepted0/02ms2176 KiB
3Accepted2/23ms2428 KiB
4Accepted3/32ms2396 KiB
5Accepted3/32ms2592 KiB
6Accepted3/33ms2808 KiB
7Accepted3/33ms3020 KiB
8Accepted3/33ms3228 KiB
9Accepted3/33ms3560 KiB
10Accepted3/33ms3700 KiB
11Accepted3/32ms3776 KiB
12Accepted3/33ms3836 KiB
13Accepted3/33ms3956 KiB
14Accepted3/32ms4168 KiB
15Accepted4/43ms4136 KiB
16Accepted4/43ms4140 KiB
17Accepted4/42ms4136 KiB
18Accepted4/42ms4140 KiB
19Accepted4/42ms4140 KiB
20Accepted4/42ms4256 KiB
21Accepted4/43ms4384 KiB
22Accepted4/42ms4380 KiB
23Partially correct1/32ms4504 KiB