Submission #715805

#TimeUsernameProblemLanguageResultExecution timeMemory
715805europiumType Printer (IOI08_printer)C++17
0 / 100
14 ms2220 KiB
// - 28/3/23 #include <iostream> #include <vector> #include <algorithm> #include <string> #include <numeric> #include <cmath> #include <iterator> #include <set> #include <map> #include <math.h> #include <iomanip> #include <unordered_set> #include <queue> #include <climits> using namespace std; // clang++ -std=c++17 IOI08_Printer.cpp && ./a.out using ll = long long; void solve(){ int n; cin >> n; vector<string> a(n); for (string& e : a) cin >> e; sort(a.begin(), a.end()); string s = ""; for (auto e : a){ // removing characters int pos = s.size() - 1; while (s.size() > 0 && s[pos] != e[pos]){ s = s.substr(0, pos); cout << "-\n"; pos = s.size() - 1; } // adding characters while (s != e){ cout << e[s.size()] << '\n'; s += e[s.size()]; } cout << "P\n"; } } int main() { ios::sync_with_stdio(false); cin.tie(0); // freopen("input.txt", "r", stdin); solve(); 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...
#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...