답안 #698248

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
698248 2023-02-13T02:00:37 Z willychan Kaučuk (COCI21_kaucuk) C++14
50 / 50
1 ms 320 KB
#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

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++){
      |                ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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
6 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 320 KB Output is correct