31062023-02-15 18:08:09balaaaazsElőzésekcpp14Wrong answer 0/1003.084s19236 KiB
#include <bits/stdc++.h>

using namespace std;

void vkiir(vector<int> v){
    for(int x:v)
        cout<<x<<" ";
    cout<<endl;
}

void kiir(vector<vector<int>> mat)
{
    for(vector<int> y:mat)
    {
        for(int x:y)
            cout<<x<<" ";
        cout<<endl;
    }
    cout<<endl;
}

int legn(vector<int> v, int &index)
{
    int legn=*max_element(v.begin(),v.end());
    vector<int> ind;
    for(int i=0;i<v.size();i++)
    {
        if(v.at(i)==legn)
        {
            ind.push_back(i);
        }
    }
    index=*min_element(ind.begin(),ind.end());
    return legn;
}
//1 1 1 2 3 4
int leggye(vector<int> v)
{
    vector<int> szamok(10);
    for(int i=0;i<v.size();i++)
        szamok.at(v.at(i))++;
    int index;
    legn(szamok,index);
    return index;
}



vector<vector<int>> felbont(vector<int> v)
{
    vector<vector<int>> ki(v.size()+1);
    for(int i=1;i<v.size()+1;i++)
        ki.at(i).resize(i,0);
    for(int i=1;i<v.size()+1;i++)
    {
        for(int j=0;j<i;j++)
            ki.at(i).at(j)=v.at(j);
    }

    return ki;
}
int main()
{
    int n,q;
    cin>>n>>q;
    vector<int> sor(n);
    vector<int> kikerult(q);
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        sor.at(i)=a;
    }
    for(int i=0;i<q;i++)
    {
        int kerul;
        cin>>kerul;
        for(int j=0;j<n;j++)
            if(sor.at(j)==kerul)
            {
                kikerult.at(i)=sor.at(j-1);
                swap(sor.at(j-1),sor.at(j));
            }
    }
    //vkiir(kikerult);

    vector<vector<int>> seged=felbont(kikerult);
    //kiir(seged);
    cout<<endl;
    for(int i=1;i<seged.size();i++)
    {
        cout<<leggye(seged.at(i))<<endl;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1808 KiB
subtask20/30
2Runtime error4ms2628 KiB
3Runtime error4ms2868 KiB
4Runtime error9ms6920 KiB
5Runtime error8ms5924 KiB
6Runtime error20ms18012 KiB
7Runtime error23ms19236 KiB
subtask30/70
8Time limit exceeded3.065s3032 KiB
9Time limit exceeded3.075s3356 KiB
10Time limit exceeded3.084s3680 KiB
11Time limit exceeded3.063s3712 KiB
12Time limit exceeded3.063s4092 KiB
13Time limit exceeded3.076s4552 KiB
14Time limit exceeded3.078s4820 KiB
15Time limit exceeded3.069s5208 KiB
16Time limit exceeded3.072s4996 KiB
17Time limit exceeded3.049s5096 KiB
18Time limit exceeded3.069s5228 KiB
19Time limit exceeded3.052s4792 KiB
20Time limit exceeded3.049s5100 KiB
21Time limit exceeded3.036s5096 KiB