71202023-12-31 09:23:04MagyarKendeSZLGTáblajáték 2 (70 pont)cpp17Wrong answer 28/703ms3592 KiB
#include <bits/stdc++.h>

#define speed cin.tie(0); ios::sync_with_stdio(0)
#define cinv(v) for (auto& e : v) cin >> e;
#define all(v) v.begin(), v.end()
#define has(s, e) s.count(e)

using namespace std;
using ll = long long;
using point = array<int, 2>;

string base3(int n) {
    string s;
    while (n > 0) {
        int mod = n % 3;
        s = to_string(mod) + s;
        n /= 3;
    }
    return s;
}

int main() {
    speed;

    int K, row = 0, col = 0;
    cin >> K;
    while (K--) {
        char m;
        cin >> m;

        if (m == '0') {
            row++;
            col *= 3;
        }
        else if (m == '1') {
            row++;
            col *= 3;
            col++;
        }
        else if (m == '2') {
            row++;
            col *= 3;
            col += 2;
        }
        else if (m == '3') {
            row--;
            col /= 3;
        }
        else if (m == '4') {
            col--;
        }
        else {
            col++;
        }
    }
    cout << row << '\n' << base3(col);
}
SubtaskSumTestVerdictTimeMemory
base28/70
1Accepted0/03ms1972 KiB
2Wrong answer0/03ms2212 KiB
3Accepted2/23ms2344 KiB
4Partially correct1/33ms2684 KiB
5Accepted3/33ms2532 KiB
6Partially correct1/33ms2592 KiB
7Accepted3/33ms2644 KiB
8Partially correct1/33ms2796 KiB
9Partially correct1/33ms3044 KiB
10Partially correct1/33ms3012 KiB
11Accepted3/33ms3220 KiB
12Partially correct1/33ms3216 KiB
13Partially correct1/33ms2936 KiB
14Partially correct1/33ms3132 KiB
15Partially correct1/43ms3268 KiB
16Partially correct1/43ms3488 KiB
17Partially correct1/43ms3484 KiB
18Partially correct1/43ms3488 KiB
19Partially correct1/43ms3492 KiB
20Partially correct1/43ms3484 KiB
21Partially correct1/43ms3484 KiB
22Partially correct1/43ms3592 KiB
23Partially correct1/33ms3548 KiB