This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define REP(i,a,b) for (auto i = (a); i <= (b); ++i)
#define debug(x) cerr << #x << " is " << x << endl
#define el '\n'
using namespace std; using ll = long long;
const int N = 103;
int main() {
cin.tie(0)->sync_with_stdio(0);
int n; cin >> n;
pair<int,pair<int,int>> x {0,{0,0}};
REP(i,1,n) {
string command, q;
cin >> command >> q;
if (command == "section") {
cout << ++x.first << ' ' << q << el;
x.second = {0,0};
} else if (command == "subsection") {
cout << x.first << '.' << ++(x.second.first) << ' ' << q << el;
x.second.second = 0;
} else {
cout << x.first << '.' << x.second.first << '.' << ++(x.second.second) << ' ' << q << el;
}
}
}
# | 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... |