Submission #507480

#TimeUsernameProblemLanguageResultExecution timeMemory
507480Hacv16Kaučuk (COCI21_kaucuk)C++17
50 / 50
1 ms316 KiB
#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#define endl '\n'
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define bn binary_search
#define lb lower_bound
#define up upper_bound
#define np next_permutation
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define mdc(x, y) __gcd(x, y)
#define dbg(x) cout << #x << ": " << "[ " << x << " ]\n"

typedef int ii;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAX = 2e6 + 15;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const int VAR[4] = {-1, 1, 0, 0};

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;

    int s = 0, ss = 0, sss = 0;

    for(int i = 0; i < n; i++){
        string t, h;
        cin >> t >> h;

        if(t == "section"){
            cout << ++s << ' ' << h << '\n';
            sss = ss = 0;
        }else if(t == "subsection"){
            cout << s << '.' << ++ss << ' ' << h << '\n';
            sss = 0;
        }else{
            cout << s << '.' << ss << '.' << ++sss << ' ' << h << '\n';
        }
    }    

    return 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...