// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define db long double
#define vll vector<pll>
#define endl '\n'
#define pb push_back
#define all(x) x.begin(), x.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// #define int long long
void fmain(){
int n, cnt1 = 0, cnt2 = 0, cnt3 = 0;
string a, b;
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a >> b;
if(a == "section"){
cnt1++;
cout << cnt1 << " " << b << endl;
cnt2 = cnt3 = 0;
}
else if(a == "subsection"){
cnt2++;
cout << cnt1 << "." << cnt2 << " " << b << endl;
cnt3 = 0;
}
else{
cnt3++;
cout << cnt1 << "." << cnt2 << "." << cnt3 << " " << b << endl;
}
}
}
signed main(){
fastio;
int tmr = 1;
// cin >> tmr;
while(tmr--){
fmain();
}
}
# | 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... |