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;
string prev = "no";
int s1 = 0, s2 = 0, s3 = 0;
while(n--) {
string a, b; cin >> a >> b;
if(a == prev) {
if(a == "section") s1++;
if(a == "subsection") s2++;
if(a == "subsubsection") s3++;
cout << s1;
if(s2) cout << "." << s2;
if(s3) cout << "." << s3;
cout << " " << b << "\n";
}
else {
if(a == "section") {
s2 = 0, s3 = 0;
s1++;
}
if(a == "subsection") {
s3 = 0;
s2++;
}
if(a == "subsubsection") {
s3++;
}
cout << s1;
if(s2) cout << "." << s2;
if(s3) cout << "." << s3;
cout << " " << b << "\n";
}
}
}
# | 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... |