This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
void TestCase() {
int n;
cin >> n;
int cnt1 = 0, cnt2 = 0, cnt3 = 0;
for (int i = 1; i <= n; ++i) {
string s, t;
cin >> s >> t;
if (s == "section") {
++cnt1;
cnt2 = cnt3 = 0;
cout << cnt1 << ' ' << t << '\n';
} else if (s == "subsection") {
++cnt2;
cnt3 = 0;
cout << cnt1 << "." << cnt2 << ' ' << t << '\n';
} else if (s == "subsubsection") {
++cnt3;
cout << cnt1 << "." << cnt2 << "." << cnt3 << ' ' << t << '\n';
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int tests = 1;
for (int tc = 1; tc <= tests; ++tc) {
TestCase();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |