33902023-02-27 12:14:12AblablablaTáblajátékcpp11Wrong answer 15/503ms3464 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> lepesek(n, 0);
    int melyseg = 0;
    int szelesseg = 0;
    for(int i = 0; i < n; i++){
        cin >> lepesek[i];
        if(lepesek[i] == 0){
            melyseg++;
            if(szelesseg != 0){
                szelesseg *= 2;
            }
        }else if(lepesek[i] == 1){
            melyseg++;
            if(szelesseg != 0){
                szelesseg = szelesseg * 2 + 1;
            } else{
                szelesseg++;
            }
        } else if(lepesek[i] == 2){
            melyseg--;
            if(szelesseg % 2 == 0){
                szelesseg /= 2;
            } else{
                szelesseg = (szelesseg - 1) / 2;
            }
        } else if(lepesek[i] == 3){
            szelesseg--;
        } else{
            szelesseg++;
        }
    }

    /*szelesseg = 100;
    vector<int> valasz(0, 0);
    while(szelesseg > 0){
        int mar = szelesseg % 2;
        valasz.push_back(mar);
        szelesseg = szelesseg / 2;
    }*/

    cout << melyseg << "\n";
    /*for(int i = valasz.size() - 1; i >= 0; i--){
        cout << valasz[i];
    }*/
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Wrong answer0/03ms1812 KiB
2Wrong answer0/03ms2056 KiB
3Partially correct1/33ms2300 KiB
4Partially correct1/33ms2464 KiB
5Partially correct1/32ms2536 KiB
6Partially correct1/33ms2736 KiB
7Partially correct1/32ms2820 KiB
8Partially correct1/32ms2948 KiB
9Partially correct1/32ms2828 KiB
10Partially correct1/33ms2824 KiB
11Partially correct1/32ms2832 KiB
12Partially correct1/32ms2836 KiB
13Partially correct1/43ms3084 KiB
14Partially correct1/43ms3052 KiB
15Partially correct1/43ms3172 KiB
16Partially correct1/43ms3380 KiB
17Partially correct1/43ms3464 KiB