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>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long int
#define oo 1e18 + 5
#define pii pair<int, int>
int main(){
int n; cin >> n;
int sec = 0;
int subsec = 0;
int subsubsec = 0;
for(int i = 0; i < n; i++){
string id; cin >> id;
string s; cin >> s;
if(id == "section"){
cout << sec + 1 << ' ' << s << '\n';
sec++;
subsec = 0;
subsubsec = 0;
}
else if(id == "subsection"){
cout << sec << '.' << subsec + 1 << ' ' << s << '\n';
subsec++;
subsubsec = 0;
}
else{
cout << sec << '.' << subsec << '.' << subsubsec + 1 << ' ' << s << '\n';
subsubsec++;
}
}
}
# | 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... |