Submission #499529

# Submission time Handle Problem Language Result Execution time Memory
499529 2021-12-28T14:50:10 Z Ibraheem Kaučuk (COCI21_kaucuk) C++14
0 / 50
0 ms 204 KB
#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){
            l = 0;
            r = 0;
        }
        if(m > e && l > 0 && r > 0){
            l = 0;
            r = 0;
        }
        if(l > t && r > 0){
            r = 0;
        }
        if(l > t && r == 0){
            r = 0;
        }
        else if(o == f){
            l++;
        }
        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

Main.cpp: In function 'int main()':
Main.cpp:12:14: warning: 'e' may be used uninitialized in this function [-Wmaybe-uninitialized]
   12 |         if(m > e && l > 0 && r == 0){
      |            ~~^~~
Main.cpp:20:14: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |         if(l > t && r > 0){
      |            ~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -