This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#ifndef Local
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#endif
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define lim 1000000
#define till 1000001
// # of primes till 1e6 = 7e4
using namespace std;
using pii = array<int,2>;
const int mod=1000000007ll;
void solve(){
int n;
cin>>n;
int a[3]={0,0,0};
while(n--){
string t,s;
cin>>t>>s;
if(t=="section"){
a[0]++;
a[1]=0;
a[2]=0;
cout<<a[0]<<" "<<s<<"\n";
}
else if(t=="subsection"){
a[1]++;
a[2]=0;
cout<<a[0]<<"."<<a[1]<<" "<<s<<"\n";
}else{
a[2]++;
cout<<a[0]<<"."<<a[1]<<"."<<a[2]<<" "<<s<<"\n";
}
}
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
#ifdef Local
freopen("in","r",stdin);
freopen("out","w",stdout);
#endif
int t=1;
//cin>>t;
while (t--)
{
solve();
}
}
# | 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... |