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;
typedef long long ll;
int main() {
int n; cin>>n;
int sec=0, subsec=0, subsubsec=0;
while (n--) {
string s, t; cin>>s>>t;
if (s=="section") {
sec++;
subsec=0;
subsubsec=0;
} else if (s=="subsection") {
subsec++;
subsubsec=0;
} else {
subsubsec++;
}
cout<<sec;
if (subsec!=0) {
cout<<"."<<subsec;
if (subsubsec!=0) cout<<"."<<subsubsec;
}
cout<<" "<<t<<"\n";
}
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... |