Submission #698248

#TimeUsernameProblemLanguageResultExecution timeMemory
698248willychanKaučuk (COCI21_kaucuk)C++14
50 / 50
1 ms320 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; //#include<bits/extc++.h> //__gnu_pbds struct section{ string title; vector<section> sub; }; vector<section> text; int main(){ ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); int q;cin>>q; while(q--){ string type;cin>>type; section k; cin>>k.title; if(type=="section"){ text.push_back(k); }else if(type=="subsection"){ text.back().sub.push_back(k); }else if(type=="subsubsection"){ text.back().sub.back().sub.push_back(k); } } for(int i=1;i<=text.size();i++){ cout<<i<<" "<<text[i-1].title<<"\n"; for(int j=1;j<=text[i-1].sub.size();j++){ cout<<i<<"."<<j<<" "<<text[i-1].sub[j-1].title<<"\n"; for(int k=1;k<=text[i-1].sub[j-1].sub.size();k++){ cout<<i<<"."<<j<<"."<<k<<" "<<text[i-1].sub[j-1].sub[k-1].title<<"\n"; } } } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:29:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<section>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i=1;i<=text.size();i++){
      |              ~^~~~~~~~~~~~~
Main.cpp:31:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<section>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   for(int j=1;j<=text[i-1].sub.size();j++){
      |               ~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:33:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<section>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |    for(int k=1;k<=text[i-1].sub[j-1].sub.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...