이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,O3,unroll-loops")
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpi vector<pii>
#define vvpi vector<vpi>
#define vb vector<bool>
#define vvb vector<vb>
#define endl "\n"
#define sp << " " <<
#define F(i, s, n) for(int i = s; i < n; i++)
#define pb push_back
#define fi first
#define se second
int inf = LLONG_MAX >> 3;
void solve() {
int s1 = 0, s2 = 0, s3 = 0;
int n;
cin >> n;
F(i, 0, n) {
string type, content;
cin >> type >> content;
if(type == "section") {
s1++;
s2 = 0;
s3 = 0;
cout << s1 << " " << content << endl;
} else if(type == "subsection") {
s2++;
s3 = 0;
cout << s1 << "." << s2 << " " << content << endl;
}else if(type == "subsubsection") {
s3++;
cout << s1 << "." << s2 << "." << s3 << " " << content << endl;
}
}
}
void setIO() {
ios::sync_with_stdio(0); cin.tie(0);
#ifdef Local
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
}
signed main() {
setIO();
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |