Submission #818614

#TimeUsernameProblemLanguageResultExecution timeMemory
818614Sandarach151Kaučuk (COCI21_kaucuk)C++17
50 / 50
1 ms300 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...