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>
# define pb push_back
# define ff first
# define ss second
# define nl "\n"
# define pii pair <int, int>
# define pll pair <ll, ll>
  
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
  
const ll maxn = 1e6 + 25;
const ll maxl = 20 + 0;
const ll inf = 2e9 + 0;
const ll mod = 998244353;
using namespace std;
void ma1n ()
{
	int n;
	cin >> n;
	vector < pair <int, string> > ans;
	map <string, int> m1, m2;
	map <string, int> num;
	int cnt = 1;
	string last = "", last1 = "";
	for (int i = 1; i <= n; ++i)
	{
		string s, t;
		cin >> s >> t;
		if (s == "section")
		{
			num[t] = cnt++;
			cout << cnt - 1 << " " << t << nl;
			last = t;
		}
		else if (s == "subsection")
		{
			cout << num[last] << "." << ++m1[last] << " " << t << nl;
			last1 = t;
		}
		else if (s == "subsubsection")
		{
			cout << num[last] << "." << m1[last] << "." << ++m2[last1] << ' ' << t << nl;
		}
	}
}
	
int main ()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int ttt = 1;
//  cin >> ttt;
    for (int test = 1; test <= ttt; test++)
    {
//    	cout << "Case " << test << ":" << nl;
    	ma1n();
	}
    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... |