#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
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 |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |