Submission #998463

# Submission time Handle Problem Language Result Execution time Memory
998463 2024-06-14T02:35:51 Z ezzzay Type Printer (IOI08_printer) C++14
10 / 100
371 ms 3032 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
signed main(){
    int n;
    cin>>n;
    vector<pair<int,string>>v;
    vector<char>op;
    for(int i=1;i<=n;i++){
        string s;
        cin>>s;
        v.pb({s.size(),s});
    }
    sort(v.begin(),v.end());
    string cur;
    for(auto p:v){
        string s=p.ss;
        while(cur!=s.substr(0,cur.size())){
            cur.pop_back();
            op.pb('-');
        }
        for(int i=cur.size();i<s.size();i++){
            cur+=s[i];
            op.pb(s[i]);
        }
        op.pb('P');
    }
    cout<<op.size()<<endl;
    for(auto u:op){
        cout<<u<<endl;
    }
}

Compilation message

printer.cpp: In function 'int main()':
printer.cpp:25:31: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for(int i=cur.size();i<s.size();i++){
      |                              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 152 ms 1360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 371 ms 3032 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 285 ms 3000 KB Output isn't correct
2 Halted 0 ms 0 KB -