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>
using namespace std;
int main(){
int n , m = 0 , l = 0 , r = 0 , t , e , i = 1;
string s = "section" , f = "subsection" , d = "subsubsection" , o , p;
cin >> n;
while(n > 0){
cin >> o >> p;
if(o == s){
m++;
}
if(m > e){
l = 0;
r = 0;
}
if(m > e){
l = 0;
r = 0;
}
else if(o == f){
l++;
}
if(l > t){
r = 0;
}
if(o == d){
r++;
}
if(m > 0 && l > 0 && r > 0){
cout << m << '.' << l << '.' << r << ' ' << p;
}
if(m > 0 && l == 0 && r == 0){
cout << m << ' ' << p << endl;
}
if(m > 0 && l > 0 && r == 0){
cout << m << '.' << l << ' ' << p << endl;
}
if(m > 0 && l == 0 && r > 0){
cout << m << "." << p << endl;
}
if(m == 0 && l > 0 && r == 0){
cout << l << " " << p << endl;
}
if(m == 0 && l > 0 && r > 0){
cout << l << "." << r << " " << endl;
}
if(m == 0 && l == 0 && r > 0){
cout << r << " " << p << endl;
}
if(m == 0 && l == 0 && r == 0){
cout << p;
}
e = m;
i++;
t = l;
n--;
}
}
Compilation message (stderr)
Main.cpp: In function 'int main()':
Main.cpp:12:9: warning: 'e' may be used uninitialized in this function [-Wmaybe-uninitialized]
12 | if(m > e){
| ^~
Main.cpp:23:9: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized]
23 | if(l > t){
| ^~
# | 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... |