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>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ve vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define si(v) (int)v.size()
#define en '\n'
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_muiltiset tree<int, null_type,less_equal<>, rb_tree_tag,tree_order_statistics_node_update>
//#define int long long
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5 + 228;
const int big = 1e9;
//ordered_set os; // os.order_of_key(4), (*os.find_by_order(5))
int n, m, ans, kol[10];
//#undef int
int main(){
//#define int long long
iostream::sync_with_stdio(false); cin.tie(0); ios_base::sync_with_stdio(false); cout.tie(0);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
cin >> n;
for (int i = 1; i <= n; i++){
string t, s; cin >> t >> s;
if (t == "section"){
kol[2] = 0;
kol[3] = 0;
kol[1]++;
cout << kol[1] << ' ' << s << en;
} else if (t == "subsection"){
kol[3] = 0;
kol[2]++;
cout << kol[1] << '.' << kol[2] << ' ' << s << en;
} else if (t == "subsubsection"){
kol[3]++;
cout << kol[1] << '.' << kol[2] << '.' << kol[3] << ' ' << s << en;
}else assert(0);
}
return 0;
}
/*
40
section first
subsection zavod
subsubsection nekoglaya
section second
subsection dlya
subsubsection nekoglay
subsubsection nekoglay
subsubsection nekoglay
subsection dly2
subsection dl3
subsubsection dibila
subsection dl4
section zivotinje
subsection macke
subsection psi
subsubsection mops
subsubsection mop2
subsubsection mop3
subsection psih
subsubsection moppppp
subsubsection moppppr
subsubsection moppppb
subsubsection mob
section zivotinje
subsection tilox
subsubsection sam
subsubsection takoy
subsection tilox3
subsection tilox2
section ban
subsection banan
subsubsection banbanan
subsection banan2
subsubsection banbanan
subsection banan3
subsubsection banbanan
subsection banan4
subsubsection banbanan
subsubsection banbanan2
subsection bananwaht
*/
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |