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++;
}else if(o == f){
l++;
}
if(o == d){
r++;
}
if(m > e && l > 0 && r == 0){
l = 1;
r = 0;
}
if(m > e && l > 0 && r > 0){
l = 1;
r = 1;
}
if(l > t && r > 0){
r = 1;
}
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;
}
i++;
e = m;
t = l;
n--;
}
}
Compilation message (stderr)
Main.cpp: In function 'int main()':
Main.cpp:17:14: warning: 'e' may be used uninitialized in this function [-Wmaybe-uninitialized]
17 | if(m > e && l > 0 && r == 0){
| ~~^~~
Main.cpp:25:9: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized]
25 | if(l > t && r > 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... |