Submission #497672

#TimeUsernameProblemLanguageResultExecution timeMemory
497672hgmhcKaučuk (COCI21_kaucuk)C++17
50 / 50
1 ms316 KiB
#include <bits/stdc++.h>
#define REP(i,a,b) for (auto i = (a); i <= (b); ++i)
#define debug(x) cerr << #x << " is " << x << endl
#define el '\n'
using namespace std; using ll = long long;

const int N = 103;

int main() {
    cin.tie(0)->sync_with_stdio(0);
    int n; cin >> n;
    pair<int,pair<int,int>> x {0,{0,0}};
    REP(i,1,n) {
        string command, q;
        cin >> command >> q;
        if (command == "section") {
            cout << ++x.first << ' ' << q << el;
            x.second = {0,0};
        } else if (command == "subsection") {
            cout << x.first << '.' << ++(x.second.first) << ' ' << q << el;
            x.second.second = 0;
        } else {
            cout << x.first << '.' << x.second.first << '.' << ++(x.second.second) << ' ' << q << el;
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...