답안 #150850

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
150850 2019-09-01T08:59:36 Z Fenwick_team(#3609, amiratou, AyaBenSaad, Nucleist) King of Chairs (FXCUP4_chairs) C++17
0 / 100
22 ms 1280 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;
	ll final=0;
	for (ll i = 0; i < k.size(); ++i)
	{
		ll yo = k[i];
		yo++;
		for (int j = 0; j < 4; ++j)
		{
			if(yo & (1 << j))
				final |= (1 << j+i);
		}
	}
	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 comp=0;
bool ka=false;
ll glob;
int Maid(int weight)
{
	int ans=0;
	for (int i = comp; i < comp+4; ++i)
	{
		if(glob & (1 << i))
			ans|=(1<<(i-comp));
	}
	comp+=4;
	return ans-1;
}

void Init(ll BS,vector<int>C)
{
	glob=BS;
	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:79:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (ll i = 0; i < k.size(); ++i)
                 ~~^~~~~~~~~~
king.cpp:86:21: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
     final |= (1 << j+i);
                    ~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1032 KB Correct
2 Runtime error 10 ms 528 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 22 ms 1280 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 21 ms 1280 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -