Submission #966661

# Submission time Handle Problem Language Result Execution time Memory
966661 2024-04-20T07:51:53 Z vjudge1 Type Printer (IOI08_printer) C++17
0 / 100
36 ms 2704 KB
#include <bits/stdc++.h>
 #define ll long long
using namespace std;
 
int main() {
    ll n;
    cin >> n;
    vector<string> p(n);
    for (int i=0;i<n;i++) {
        cin >> p[i];
    }
    sort(p.begin(),p.end(),[](auto&x,auto&y) {
        if (x[0] == y[0]) {
            return true;
        }
        return x.size() < y.size();
    });
    string curr="";
    string ans="";
    for (int i=0;i<n;i++) {
        while (curr.size() != 0 && curr != p[i].substr(0,curr.size())) {
            ans+="-";
            curr.pop_back();
        }
        ans+=p[i].substr(curr.size(),p[i].size()-curr.size());
        curr=p[i];
        ans+="P";
    }
    n = ans.size();
    for (int i=0;i<n;i++) {
        cout << ans[i] <<'\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Expected integer, but "t" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Expected integer, but "n" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Expected integer, but "p" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Expected integer, but "x" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Expected integer, but "j" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Expected integer, but "m" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 860 KB Expected integer, but "e" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1260 KB Expected integer, but "g" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 2584 KB Expected integer, but "v" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 2704 KB Expected integer, but "c" found
2 Halted 0 ms 0 KB -