Submission #783104

# Submission time Handle Problem Language Result Execution time Memory
783104 2023-07-14T15:29:47 Z Matblube Type Printer (IOI08_printer) C++14
0 / 100
24 ms 2180 KB
#include <iostream>
#include <iomanip>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll;
#define dbg(x) cerr<<#x<<": "<<x<<"\n";
#define fr(i, x) for(ll i=0 ; i<x ; i++)
#define fra(x, v) for(auto x:v)
#define fra1(x,v) for(auto &x:v)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb(x) push_back(x)
#define F first
#define S second
#define inf 10000000000
#define sz(x) (ll) x.size()

const double PI=acos(-1);
const ll MOD=1e9+7, maxN=100010;

struct uwu{
    ll x ,y, z;
};

ll gcd(ll a, ll b){return (!b)?a:(gcd(b, a%b));}

ll lcm(ll a, ll b){
    if(a>b) swap(a, b);
    return a/gcd(a, b)*b;
}

ll binpow(ll a, ll b){
    ll cc=1;
    while(b){
        if(b&1) cc*=a;
        a*=a;
        b>>=1;
    }
    return cc;
}
ll binpow1(ll a, ll b){
    ll cc=1;
    while(b){
        if(b&1) cc=cc*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return cc%MOD;
}

ll arr[50][50], n, m;
ll dp[50][50];

void move(ll a, ll b){
    for(ll i=a ; i<=n ; i++){
        for(ll j=b ; j<=m ; j++){
            dp[i][j]+=(max(dp[i-1][j], dp[i][j-1]));
        }
    }
}

ll subs(string a, string b){
    if(a.size()>b.size()) swap(a, b);
    ll i=0;
    while(i<a.size() && i<b.size() && a[i]==b[i]) i++;
    return i;
}

void solve(){
    ll n, aux; cin>>n;
    vector<string>v(n);
    fra1(x, v) cin>>x;
    sort(all(v));
    string a, b;
    a=b="";
    fra(x, v){
        aux=subs(a, x);
        while(a.size()>aux){
            a.pop_back();
            b.push_back('-');
        }
        a+=x.substr(aux);
        b+=x.substr(aux);
        b.push_back('P');
    }
    fra(x, b) cout<<x<<"\n";
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Compilation message

printer.cpp: In function 'll subs(std::string, std::string)':
printer.cpp:77:12: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |     while(i<a.size() && i<b.size() && a[i]==b[i]) i++;
      |           ~^~~~~~~~~
printer.cpp:77:26: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |     while(i<a.size() && i<b.size() && a[i]==b[i]) i++;
      |                         ~^~~~~~~~~
printer.cpp: In function 'void solve()':
printer.cpp:90:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   90 |         while(a.size()>aux){
      |               ~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Expected integer, but "t" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Expected integer, but "e" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Expected integer, but "h" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Expected integer, but "b" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 596 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 1128 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 2180 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 2028 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -