Submission #660489

#TimeUsernameProblemLanguageResultExecution timeMemory
660489Chal1shkanKaučuk (COCI21_kaucuk)C++14
50 / 50
1 ms320 KiB
# include <bits/stdc++.h> # define pb push_back # define ff first # define ss second # define nl "\n" # define pii pair <int, int> # define pll pair <ll, ll> typedef long long ll; typedef unsigned long long ull; typedef long double ld; const ll maxn = 1e6 + 25; const ll maxl = 20 + 0; const ll inf = 2e9 + 0; const ll mod = 998244353; using namespace std; void ma1n () { int n; cin >> n; vector < pair <int, string> > ans; map <string, int> m1, m2; map <string, int> num; int cnt = 1; string last = "", last1 = ""; for (int i = 1; i <= n; ++i) { string s, t; cin >> s >> t; if (s == "section") { num[t] = cnt++; cout << cnt - 1 << " " << t << nl; last = t; } else if (s == "subsection") { cout << num[last] << "." << ++m1[last] << " " << t << nl; last1 = t; } else if (s == "subsubsection") { cout << num[last] << "." << m1[last] << "." << ++m2[last1] << ' ' << t << nl; } } } int main () { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int ttt = 1; // cin >> ttt; for (int test = 1; test <= ttt; test++) { // cout << "Case " << test << ":" << nl; ma1n(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...