답안 #499498

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499498 2021-12-28T14:08:38 Z Ibraheem Kaučuk (COCI21_kaucuk) C++14
10 / 50
1 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++;
        }
        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(l > t && r == 0){
            r = 0;
        }
        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;
        }
        e = m;
        i++;
        t = l;
        n--;
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:18:14: warning: 'e' may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |         if(m > e && l > 0 && r == 0){
      |            ~~^~~
Main.cpp:29:9: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized]
   29 |         if(l > t && r == 0){
      |         ^~
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -