Rezultati

Up. imeNalogaJezikRezultatČas oddaje
Aquasonic-2018 Tabela C++ 100/100OK 13. okt '18 @ 13:53

Test Točke Porabljen spomin Porabljen čas Status
#1 20/20 4,273 MiB 0,039 s OK
#2 20/20 3,250 MiB 0,000 s OK
#3 20/20 3,262 MiB 0,000 s OK
#4 20/20 3,230 MiB 0,004 s OK
#5 20/20 3,227 MiB 0,004 s OK

Ocenjevani program (main.cpp):
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie();
cout.tie();
    int n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    vector<vector<string> > v;
    vector<string> vec;
    v.insert(v.begin(),1000,vec);
    for(int i=0;i<n;i++)
    {
    string a;
    cin>>a;
    string ss="";
        for(int j=0;j<a.size();j++)
        {
            if(a[j]==',')
            {

                v[i].push_back(ss);
                ss="";
            }
            else
            ss+=a[j];

        }
        v[i].push_back(ss);
    }
    vector<int> maxi(1000+1,0);
    for(int j=0;j<m;j++)
    {
        for(int i=0;i<n;i++)
        {
        maxi[j]=max(maxi[j],(int)v[i][j].size());
        }
    }
    for(int i=0;i<n;i++)
    {
    string res="";
        for(int j=0;j<m;j++)
        {
            if(s[j]=='L')
            {
                res+=v[i][j];
                for(int k=0;k<(maxi[j]-(int)v[i][j].size());k++)
                res+=" ";
            }
            else
            {
            for(int k=0;k<(maxi[j]-(int)v[i][j].size());k++)
                res+=" ";

                res+=v[i][j];
            }
            if(j!=m-1)
            {
            res+=" | ";
            }
        }
        cout<<res<<endl;
    }
     return 0;
}