This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Problem: E - Sequence Decomposing
// Contest: AtCoder - AtCoder Beginner Contest 134
// URL: https://atcoder.jp/contests/abc134/tasks/abc134_e
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
using namespace std;
#define lg long long
int main()
{
lg n;
cin >> n;
lg lev = 0;
vector<lg> a(3);
while(n--)
{
string s, t;
cin >> s >> t;
if(s == "section")
{
while(lev)
{
a[lev] = 0;
lev--;
}
a[lev]++;
cout << a[lev] << ' ' << t << '\n';
}
else if(s == "subsection")
{
while(lev > 1)
{
a[lev] = 0;
lev--;
}
lev = 1;
a[lev]++;
cout << a[0] << '.' << a[1] << ' ' << t << '\n';
}
else{
lev = 2;
a[2]++;
cout << a[0] << '.' << a[1] << '.' << a[2] << ' ' << t << '\n';
}
}
}
# | 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... |