Submission #781040

#TimeUsernameProblemLanguageResultExecution timeMemory
781040cig32Kaučuk (COCI21_kaucuk)C++17
50 / 50
1 ms304 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string prev = "no"; int s1 = 0, s2 = 0, s3 = 0; while(n--) { string a, b; cin >> a >> b; if(a == prev) { if(a == "section") s1++; if(a == "subsection") s2++; if(a == "subsubsection") s3++; cout << s1; if(s2) cout << "." << s2; if(s3) cout << "." << s3; cout << " " << b << "\n"; } else { if(a == "section") { s2 = 0, s3 = 0; s1++; } if(a == "subsection") { s3 = 0; s2++; } if(a == "subsubsection") { s3++; } cout << s1; if(s2) cout << "." << s2; if(s3) cout << "." << s3; cout << " " << b << "\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...