Submission #150536

# Submission time Handle Problem Language Result Execution time Memory
150536 2019-09-01T08:36:21 Z Fenwick_team(#3609, amiratou, AyaBenSaad, Nucleist) King of Chairs (FXCUP4_chairs) C++17
0 / 100
23 ms 1272 KB
#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
ll m,n;
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
vector<ll> matchR; 
bool bpm(bool bpGraph[M][N], ll u, 
         bool seen[]) 
{ 
    for (ll 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<ll> maxBPM(bool bpGraph[M][N]) 
{ 
     
    matchR.resize(n);
    fill(matchR.begin(),matchR.end(),-1); 
    ll result = 0;  
    for (ll 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 (ll i = 0; i < n; ++i)
	{
		for (ll j = 0; j < n; ++j)
		{
			if(W[i]<=C[j])
			{
				bpgraph[i][j]=1;
				bpgraph[j][i]=1;
			}
		}
	}
	vector<ll>k=maxBPM(bpgraph);
	k.resize(n);
	string ans;
	string ans1;
	for (ll i = 0; i < k.size(); ++i)
	{
		ll 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());
	if(ans1.size()==n)return -1;
	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;
ll comp;
ll sizei;
set<ll>used;
string dol;
ll comp1;
bool ka=false;
int Maid(int weight)
{
	if(!ka)
	{
	if(used.find(comp1)!=used.end())
		{   
			comp1++;
			return -1;
		}
	ll hey= -1;
	if(comp>=0)	
	ll hey = (ll)(dol[comp])-48;
	else hey=0;
	comp++;
	comp1++;
	return hey;	}
	return -1;	
}

void Init(ll BS,vector<int>C)
{
	glob = BS;
	if(glob==-1)
		ka=true;
	if(!ka)
	{dol = to_string(glob);
	ll index=dol.size()-2;
	ll nb = (ll)(dol[dol.size()-1])-48;
	while(nb!=0)
	{
		used.insert((ll)(dol[index])-48);
		index--;
		nb--;
	}
	comp = C.size()-(nb);
	ll zomp= dol.size()-(nb+1);
	comp = (-(comp-zomp));}
	return;
}
//code the AC sol !
// BS/queue/map

Compilation message

king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:78:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (ll i = 0; i < k.size(); ++i)
                 ~~^~~~~~~~~~
king.cpp:86:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(ans1.size()==n)return -1;
     ~~~~~~~~~~~^~~

vassal.cpp: In function 'int Maid(int)':
vassal.cpp:38:5: warning: unused variable 'hey' [-Wunused-variable]
  ll hey = (ll)(dol[comp])-48;
     ^~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1044 KB Correct
2 Incorrect 10 ms 1040 KB Wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 23 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -