Submission #818614

# Submission time Handle Problem Language Result Execution time Memory
818614 2023-08-10T05:45:51 Z Sandarach151 Kaučuk (COCI21_kaucuk) C++17
50 / 50
1 ms 300 KB
#include <bits/stdc++.h>
using namespace std;

typedef string subsubsection;
typedef pair<vector<subsubsection>, string> subsection;
typedef pair<vector<subsection>, string> section;

int main() {
    int n;
    cin >> n;
    vector<section> book;
    for(int i=0; i<n; i++){
        string s, title;
        cin >> s >> title;
        if(s=="section"){
            vector<subsection> temp;
            book.push_back({temp, title});
        }
        else if(s=="subsection"){
            vector<subsubsection> temp;
            book.back().first.push_back({temp, title});
        }
        else{
            book.back().first.back().first.push_back(title);
        }
    }
    for(int i=0; i<book.size(); i++){
        cout << i+1 << " " << book[i].second << '\n';
        for(int j=0; j<book[i].first.size(); j++){
            cout << i+1 << "." << j+1 << " " << book[i].first[j].second << '\n';
            for(int k=0; k<book[i].first[j].first.size(); k++){
                cout << i+1 << "." << j+1 << "." << k+1 << ' ' << book[i].first[j].first[k] << '\n';
            }
        }
    }
    return 0;
}














Compilation message

Main.cpp: In function 'int main()':
Main.cpp:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::vector<std::pair<std::vector<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> > >, std::__cxx11::basic_string<char> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(int i=0; i<book.size(); i++){
      |                  ~^~~~~~~~~~~~
Main.cpp:29:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::vector<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for(int j=0; j<book[i].first.size(); j++){
      |                      ~^~~~~~~~~~~~~~~~~~~~~
Main.cpp:31:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             for(int k=0; k<book[i].first[j].first.size(); k++){
      |                          ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 0 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 0 ms 296 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 300 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 300 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct