Submission #149812

# Submission time Handle Problem Language Result Execution time Memory
149812 2019-09-01T07:12:36 Z (παρα)γεμιστά(#3619, cfalas, ctziapo, Charis02) King of Chairs (FXCUP4_chairs) C++17
Compilation error
0 ms 0 KB
#include "king.h"
#include<map>
#include<vector>
#include<algorithm>
#include<iostream>
#define ll long long
#define rep(i,a,b) for(int i = a;i < b;i++)
#define MAXN 300003

long long SendInfo(std::vector<int> W, std::vector<int> C) {
	int n = W.size();
    int cur = 0;

    sort(W.rbegin(),W.rend());
    sort(C.rbegin(),C.rend());

	rep(i,0,n)
	{
        if(W[i] <= C[cur])
        {
            first = W[i];
            cur++;
        }
	}

	if(cur==0)
        return 0;

	return W[n-cur];
}
#include "vassal.h"
#include<map>
#include<vector>
#include<iostream>
#include<set>
#define ll long long
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)
#define rep(i,a,b) for(int i = a;i < b;i++)

using namespace std;

long long maxi;
set < pi > available;

void Init(long long B, std::vector<int> C){
	int n = C.size();
	maxi = B;

	rep(i,0,n)
	{
        available.insert(mp(C[i],i));
	}

	return;
}

int Maid(int W){
    if(W>maxi)
        return -1;
    else
    {
        set < pi >::iterator it = available.lower_bound(mp(W,0));
        available.erase(it);
        return (*it).second;
    }
}

Compilation message

king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:21:13: error: 'first' was not declared in this scope
             first = W[i];
             ^~~~~
king.cpp:21:13: note: suggested alternative: 'fpos_t'
             first = W[i];
             ^~~~~
             fpos_t