이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
//#define int long long int
//#define ll long long
#define pb push_back
#define p push
#define f first
#define s second
#define N 350
signed main(){
lalala;
int n;cin>>n;
int a=0,b=0,c=0;
while(n--){
string x,y;cin>>x>>y;
if(x=="section"){
a++;
b=c=0;
cout<<a<<" "<<y<<endl;
}
else if(x=="subsection"){
if(a==0)a=1;
b++;
c=0;
cout<<a<<"."<<b<<" "<<y<<endl;
}
else{
if(a==0)a=1;
if(b==0)b=1;
c++;
cout<<a<<"."<<b<<"."<<c<<" "<<y<<endl;
}
}
}
# | 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... |