Submission #68110309


Source Code Expand

// Thales Sena de Queiroz - 14608873
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define INF 0x7fffffff
#define MINF -0x7fffffff
#define MAX_VAL 0x7fffffffffffffff
#define pb push_back
#define sz(a) a.size()
#define mod 998244353
#define MOD 1000000007
#define f first
#define s second
#define sortv(a) sort(a.begin(), a.end())
#define rsortv(a) sort(a.rbegin(), a.rend())
#define ins insert
#define fr(i, a) for(long long int i=0;i<a;i++)
#define fr1(i, a) for(long long int i=1;i<=a;i++)
#define mem0(a) memset(a, 0, sizeof(a)) // a nome da matirz
#define mem1(a) memset(a, 1, sizeof(a))
#define mem_1(a) memset(a, -1, sizeof(a))
#define memI(a) memset(a, 0x3f3f3f3f, sizeof(a))
#define formap(it, a) for(map<int, int>::iterator it=a.begin();it!=a.end();it++)
#define forset(it, a) for(set<int>::iterator it=a.begin();it!=a.end();it++)
#define formset(it, a) for(multiset<int>::iterator it=a.begin();it!=a.end();it++)

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<ll, pair<ll, ll> > pipii;
typedef priority_queue<pipii, vector<pipii>, greater<pipii> > pqueue;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

using Matrix = array<array<ll, 110>, 110>;

/*
virtually unhackable way of generating $B$ in the implementation
above is to use a random number generator seeded with a high-precision clock

mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
const ll Base = uniform_int_distribution<ll>(0,  - 1)(rng);
*/

Matrix mul(Matrix a, Matrix b, ll m){
    Matrix res;
    fr(i, 110)
        fr(j, 110)
            res[i][j]=0x3f3f3f3f3f3f3f3f;

    for (int i = 1; i < 101; i++) {
        for (int j = 1; j < 101; j++) {
            for (int k = 1; k < 101; k++) {
                //res[i][j] += a[i][k] * b[k][j]; // multiplicaçao
                //res[i][j] = min(res[i][j], a[i][k] + b[k][j]); // min sum distance
                //res[i][j] %= m;
        }
    }
}
    return res;
}

Matrix indentityMatrix(int n){
    Matrix id;
    fr(i, n){
        fr(j, n){
            id[i][j]=0;
            if(i==j)
                id[i][j]=0x3f3f3f3f3f3f3f3f; // se for so multilicaçao 1 se min dist coloque o infinito
        }
    }
    return id;
}
Matrix mexp(Matrix b, ll e, ll m){
    if(e==0) return indentityMatrix(101); // a dependennder da operaçao mul a identidade mdua
    if(e==1) return b;

    Matrix h=mexp(b, e/2, m);
    if(e%2==0){
        return mul(h, h, m);
    }else{
        return mul(mul(h, h, m), b, m);
    }
}

ll gcd(ll a, ll b){
    return b==0 ? a : gcd(b, a%b);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}
ll fexp(ll b, ll e, ll m){
    if(e==0) return 1;
    if(e==1) return b%m;

    ll h=fexp(b, e/2, m);
    if(e%2==0){
        return (h*h)%m;
    }else{
        return (((h*h)%m)*b)%m;
    }
}

ll inv(ll x, ll m){
    if (x <= 1) {
        return x;
    }
    return m-m/x*inv(m % x, m)%m;
}
void irr(ll *a, ll *b){ //deixar primos entre si
    ll gc=gcd(*a, *b);
    *a/=gc;
    *b/=gc;
}
ll divmod(ll num, ll den, ll m){
    irr(&num, &den);
    return (num*fexp(den, m-2, m))%m;
}
int setbits(int x){
    return __builtin_popcount(x);
}
int lgb(ll x, ll b){
    int ct=-1;
    while(x>0){
        ct++;
        x/=b;
    }
    return ct;
}

// long long rng(){
//     static std::mt19937 gen(std::chrono::steady_clock::now().time_since_epoch().count());
//     return std::uniform_int_distribution<long long>(0, INT64_MAX)(gen);
// }

void dbg_out() { cerr << endl; }
template <typename H, typename... T>
void dbg_out(H h, T... t) { cerr << ' ' << h; dbg_out(t...); }
#define dbg(...) { cerr << #__VA_ARGS__ << ':'; dbg_out(__VA_ARGS__); }

struct HASH{
  size_t operator()(const pair<ll,ll>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<63));
  }
};

///////////////SOLVE
//////////////////////////////////
////////////////////////

multiset<int> st;

void solve(int TIMES){ 
   int n, m;
   cin >> n >> m;

   fr(i, n){
    int a;
    cin >> a;
    st.ins(a);
   }

   fr(i, m){
    int a;
    cin >> a;

    if(st.find(a)!=st.end())
        st.erase(st.find(a));
   }

   for(auto x : st)
    cout << x << ' ';
   cout << "\n";
}

///////////////SOLVE
//////////////////////////////////
////////////////////////

int32_t main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    int t=1;
    int fiasdq=0;

    // funcs to run only once
        
    // funcs to run only once

    //cin >> t;
    while(t--){
        fiasdq++;
        solve(fiasdq);
    }

    return 0;
}

Submission Info

Submission Time
Task B - Search and Delete
User Taresu
Language C++ 20 (gcc 12.2)
Score 200
Code Size 4873 Byte
Status AC
Exec Time 2 ms
Memory 3628 KiB

Compile Error

Main.cpp: In function ‘Matrix mul(Matrix, Matrix, ll)’:
Main.cpp:49:19: warning: unused parameter ‘a’ [-Wunused-parameter]
   49 | Matrix mul(Matrix a, Matrix b, ll m){
      |            ~~~~~~~^
Main.cpp:49:29: warning: unused parameter ‘b’ [-Wunused-parameter]
   49 | Matrix mul(Matrix a, Matrix b, ll m){
      |                      ~~~~~~~^
Main.cpp:49:35: warning: unused parameter ‘m’ [-Wunused-parameter]
   49 | Matrix mul(Matrix a, Matrix b, ll m){
      |                                ~~~^
Main.cpp: In function ‘void solve(int)’:
Main.cpp:157:16: warning: unused parameter ‘TIMES’ [-Wunused-parameter]
  157 | void solve(int TIMES){
      |            ~~~~^~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 28
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3416 KiB
example_01.txt AC 1 ms 3412 KiB
hand_00.txt AC 1 ms 3348 KiB
hand_01.txt AC 1 ms 3488 KiB
hand_02.txt AC 1 ms 3488 KiB
hand_03.txt AC 1 ms 3472 KiB
hand_04.txt AC 1 ms 3412 KiB
hand_05.txt AC 1 ms 3488 KiB
random_00.txt AC 1 ms 3492 KiB
random_01.txt AC 1 ms 3436 KiB
random_02.txt AC 1 ms 3460 KiB
random_03.txt AC 1 ms 3620 KiB
random_04.txt AC 1 ms 3440 KiB
random_05.txt AC 1 ms 3464 KiB
random_06.txt AC 1 ms 3456 KiB
random_07.txt AC 1 ms 3412 KiB
random_08.txt AC 1 ms 3488 KiB
random_09.txt AC 1 ms 3432 KiB
random_10.txt AC 1 ms 3488 KiB
random_11.txt AC 1 ms 3424 KiB
random_12.txt AC 2 ms 3436 KiB
random_13.txt AC 1 ms 3352 KiB
random_14.txt AC 1 ms 3544 KiB
random_15.txt AC 1 ms 3472 KiB
random_16.txt AC 1 ms 3488 KiB
random_17.txt AC 1 ms 3592 KiB
random_18.txt AC 1 ms 3628 KiB
random_19.txt AC 1 ms 3344 KiB