# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150038 | Fenwick_team (#200) | King of Chairs (FXCUP4_chairs) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "king.h"
using namespace std;
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
#define ve vector<ll>
#define dos pair<ll,ll>
#define vedos vector<dos>
#define M 11
#define N 11
int m,n;
struct greateri
{
template<class T>
bool operator()(T const &a, T const &b) const { return a > b; }
};
vector<int> matchR;
bool bpm(bool bpGraph[][], int u,
bool seen[])
{
for (int v = 0; v < n; v++)
{
if (bpGraph[u][v] && !seen[v])
{
seen[v] = true;
if (matchR[v] < 0 || bpm(bpGraph, matchR[v],
seen))
{
matchR[v] = u;
return true;
}
}
}
return false;
}
vector<int> maxBPM(bool bpGraph[M][N])
{
matchR.resize(n);
fill(matchR.begin(),matchR.end(),-1);
int result = 0;
for (int u = 0; u < m; u++)
{
bool seen[N];
memset(seen, 0, sizeof(seen));
if (bpm(bpGraph, u, seen))
result++;
}
return matchR;
}
ll SendInfo(vector<int>W,vector<int>C)
{
n=W.size();
m=n;
bool bpgraph[M][N]={0};
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < n; ++j)
{
if(W[i]<=C[j])
{
bpgraph[i][j]=1;
bpgraph[j][i]=1;
}
}
}
vector<int>k=maxBPM(bpgraph);
string ans;
string ans1;
for (int i = 0; i < k.size(); ++i)
{
int yo = k[i];
if(yo!=-1)
{ans.pb((char)(yo+48));}
else {ans1.pb((char)(i+48));}
}
string finali = ans+ans1+to_string(ans1.size());
ll final = stol(finali, nullptr, 10);
return final;
}
//code the AC sol !
// BS/queue/map
#include <bits/stdc++.h>
#include "vassal.h"
using namespace std;
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
#define ve vector<ll>
#define dos pair<ll,ll>
#define vedos vector<dos>
struct greateri
{
template<class T>
bool operator()(T const &a, T const &b) const { return a > b; }
};
ll glob;
int comp;
int sizei;
set<int>used;
string dol;
int Maid(int weight)
{
if(used.find(comp)!=used.end())
return -1;
int hey = dol[comp]-48;
comp++;
return hey;
}
void Init(ll BS,vector<int>C)
{
glob=BS;
dol = to_string(glob);
int index=dol.size()-2;
int nb=dol[dol.size()-1]-48;
while(nb--)
{
used.insert(dol[index]-48);
index--;
}
return;
}
//code the AC sol !
// BS/queue/map