Submission #966666

# Submission time Handle Problem Language Result Execution time Memory
966666 2024-04-20T07:55:56 Z vjudge1 Type Printer (IOI08_printer) C++17
0 / 100
35 ms 2140 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.substr(0,abs((signed)(x.size()-y.size()))) == y.substr(0,abs((signed)(x.size()-y.size())))) {
            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 0 ms 348 KB Expected integer, but "n" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Expected integer, but "p" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Expected integer, but "x" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Expected integer, but "z" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 34 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 1112 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 2140 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 35 ms 1992 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -