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;
int main () {
int N;
cin >> N;
int cnt[3];
cnt[0] = cnt[1] = cnt[2] = 0;
for (int i = 1; i <= N; ++ i ) {
string what;
cin >> what;
if (what == "section") {
cnt[0] ++;
cnt[1] = 0, cnt[2] = 0;
}
else if (what == "subsection") {
cnt[1] ++;
cnt[2] = 0;
}
else ++ cnt[2];
string name;
cin >> name;
if (what == "section") {
cout << cnt[0] << " " << name << '\n';
continue;
}
if (what == "subsection") {
cout << cnt[0] << "." << cnt[1] << " " << name << '\n';
continue;
}
if (what == "subsubsection") {
cout << cnt[0] << "." << cnt[1] << "." << cnt[2] << " " << name << '\n';
continue;
}
}
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... |