/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 536.0 KiB
#2 Time Exceeded ≥2087ms ≥4.352 MiB

Code

/**
 *  Author : Shafi
 * 
 ***/
#include <iostream>
#include "vector"
#include "set"
#include "algorithm"
using namespace std;
#define ll long long int

int main() {
    // Write C++ code here
    int n,m;
    cin>>n;
    vector<ll>v(n);
    vector<ll>combined;
    for(auto &it:v){
        cin>>it;
        combined.push_back(it);
    }
    cin>>m;
    vector<ll>vv(m);
    for(auto &it:vv){
        cin>>it;
        combined.push_back(it);
    }
    sort(combined.rbegin(),combined.rend());
    vector<ll>ans;
    set<ll>st;
    int j = 0;
    for(int i=0;i<m;i++){
        auto ite = find(combined.begin(),combined.end(),vv[i]);
        int idx;
        if(ite != combined.end()){
            idx = ite - combined.begin();
            if(!st.count(idx)) st.insert(idx);
            else{
                idx++;
                st.insert(idx);
            }
        }
        int cnt = count(v.begin(),v.end(),vv[i]);
        ans.push_back(cnt+idx+1+j);
    }
    for(auto it:ans){
        cout<<it<<" ";
    }
    cout<<endl;
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1049 Combined scoreboard
Contest
Brain Booster #3
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-06 16:00:04
Judged At
2024-11-11 03:33:33
Judged By
Score
0
Total Time
≥2087ms
Peak Memory
≥4.352 MiB