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>
using namespace std;
using ll = long long;
void output(bool yes){yes ? cout << "Yes" << "\n" : cout << "No" << "\n";}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
int n;
cin >> n;
int s = 0;
int ss = 0;
int sss = 0;
for(int i = 0;i < n;i++){
string a,b;
cin >> a >> b;
if(a == "section"){
s++;
cout << s << " " << b << "\n";
ss = 0;
sss = 0;
}else if(a == "subsection"){
ss++;
cout << s << "." << ss << " " << b << "\n";
sss =0;
}else{
sss++;
cout << s << "." << ss << "." << sss << " " << b << "\n";
}
}
return 0;
}
# | 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... |