답안 #149729

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149729 2019-09-01T07:02:25 Z Fenwick_team(#3609, amiratou, AyaBenSaad, Nucleist) King of Chairs (FXCUP4_chairs) C++17
0 / 100
25 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 10
#define N 10
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[M][N], 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;
	for (int i = 0; i < k.size(); ++i)
	{
		int yo = k[i]+1;
		if(yo!=10)
			{ans.pb('0');ans.pb((char)(yo+48));}
		else {ans.pb('1');ans.pb('0');}
	}
	ll final = stoi(ans);
	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;
int Maid(int weight)
{
	string dol = to_string(glob);
	int dif = sizei-dol.size();
	int index=(comp-dif);
	int index1=(comp-dif+1);
	string indi;
	if(index<0)
	{
		indi.pb('0');
	}
	else indi.pb(dol[index]);
	if(index1<0)
	{
		indi.pb('0');
	}
	else indi.pb(dol[index1]);
	comp+=2;
	return (stoi(indi)-1);
}
void Init(ll BS,vector<int>C)
{
	glob=BS;
	sizei=C.size();
	sizei*=2;
	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:76:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < k.size(); ++i)
                  ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1048 KB Correct
2 Runtime error 11 ms 1036 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 25 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 24 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -