This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using namespace chrono;
// using namespace atcoder
#define YES cout << "YES"
#define NO cout << "NO"
#define fd fixed
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define dbl double
#define ld long double
#define f first
#define s second
#define pii pair<int , int>
#define pll pair<ll , ll>
#define pil pair<int , ll>
#define pli pair<ll , int>
#define psi pair<string , int>
#define pci pair<char , int>
#define pic pair<int , char>
#define pis pair<int , string>
#define psl pair<string , ll>
#define pcl pair<char , ll>
#define plc pair<ll , char>
#define pls pair<ll , string>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ins insert
#define END return 0
#define speed ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define all(x) (x).begin() , (x).end()
#define oo 1e9
/*
int gcd(int number1 , int number2){
if(number2 == 0){
return number1;
}
return gcd(number2 , number1 % number2);
}
int lcm(int number1 , int number2){
return number1 / gcd(number1 , number2) * number2;
}
ll fact(int number){
ll product = 1;
for(int i=2 ; i<=number ; i++){
product *= i;
}
return product;
}
*/
//#define int ll
void solve(){
int n;
cin >> n;
int x = 0 , y = 0 , z = 0;
vector<pair<pis , int>> A;
for(int i=0 ; i<n ; i++){
string s , s1;
cin >> s >> s1;
if(s == "section"){
A.pb(mp(mp(x+1 , s1) , 1));
x++;
y = 0;
z = 0;
}
else if(s == "subsection"){
A.pb(mp(mp(x*10+(y+1) , s1) , 2));
y++;
z = 0;
}
else{
A.pb(mp(mp(x*100+y*10+(z+1) , s1) , 3));
z++;
}
}
for(int i=0 ; i<A.size() ; i++){
int k = A[i].f.f;
string s2 = A[i].f.s;
if(A[i].s == 1){
cout << k << " " << s2 << '\n';
}
else if(A[i].s == 2){
cout << k/10 << '.' << k%10 << " " << s2 << '\n';
}
else{
cout << k/100 << '.' << k/10%10 << '.' << k%10 << " " << s2 << '\n';
}
}
}
/*signed */ int main(){
speed;
int t = 1;
//cin >> t;
while(t--){
solve();
}
END;
}
Compilation message (stderr)
Main.cpp: In function 'void solve()':
Main.cpp:102:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, std::__cxx11::basic_string<char> >, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
102 | for(int i=0 ; i<A.size() ; i++){
| ~^~~~~~~~~
# | 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... |