This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// - 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 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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |