Submission #481181

#TimeUsernameProblemLanguageResultExecution timeMemory
481181lolipopType Printer (IOI08_printer)C++17
10 / 100
39 ms2912 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; using ii = pair <int, int>; int main () { ios::sync_with_stdio(0); cin.tie(0); #ifdef LOCAL freopen("in.txt", "r", stdin); #endif int n; cin >> n; vector <string> v; for (int i = 0; i < n; ++i) { string s; cin >> s; v.emplace_back(s); } sort(v.begin(), v.end(), [](string a, string b){return a.size() < b.size();}); vector <char> ans; n = (int) v.size(); for (int i = 0; i < n; ++i) { string s = v[i]; int sz = (int) s.size(); for (char ch : s) ans.emplace_back(ch); ans.emplace_back('P'); if (i != n - 1) { while (sz--) ans.emplace_back('-'); } } cout << (int) ans.size() << "\n"; for (auto c : ans) cout << c << "\n"; return 0; } /* array bound? overflow? print newline after every cases idea correct? */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...