Submission #149011

# Submission time Handle Problem Language Result Execution time Memory
149011 2019-09-01T05:33:56 Z bitKOIn(#3612, gs15120, phsongys) King of Chairs (FXCUP4_chairs) C++17
100 / 100
172 ms 11996 KB
#include "king.h"

long long SendInfo(std::vector<int> W, std::vector<int> C) {
	//int N = W.size();
	return 0;
}
#include "vassal.h"
#include <bits/stdc++.h>
#define PI 3.1415926535897932384626
using namespace std;

struct vec
{
    long double x,y;
    bool operator ==(const vec &a) const{
        return x==a.x&&y==a.y;
    }
    bool operator <(const vec &a) const{
        if(a.x!=x) return x<a.x;
        return y<a.y;
    }
    vec operator +(const vec &a) const{
        return {x+a.x,y+a.y};
    }
    vec operator *(const long double &a) const{
        return {x*a,y*a};
    }
    vec operator -(const vec &a) const{
        return {x-a.x,y-a.y};
    }
    vec operator /(const long double &a) const{
        return {x/a,y/a};
    }
    long double len() const{
        return sqrt(x*x+y*y);
    }
    long double dot(const vec &a) const{
        return x*a.x+y*a.y;
    }
    long double crs(const vec &a) const{
        return x*a.y-y*a.x;
    }
    vec proj(const vec &a) const{
        return (a/a.len())*(*this).dot(a)/a.len();
    }
};

struct P
{

    int x,y,z;
    bool operator <(const P &a) const{
        if(x!=a.x) return x<a.x;
        return y<a.y;
    }
};



long long x,y,z,mod=1000000007;
vector<int> v1;
int i,n,m,k,a,d,b,c,dx[10]={1,0,-1,0},dy[10]={0,1,0,-1};
int e;
int o[221];
int l[221];
int par[1];
int j[1];

//stack<int> s;
//set<P> s;
queue<int> q,q1;
P u[211111];
char r[1];
//string r,r1;
//2147483647
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
map<int,int> p;
//v.resize(unique(v.begin(),v.end())-v.begin());

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//rng();

set<P> s;
long long BB;
void Init(long long B, std::vector<int> C){
	int N = C.size();
	for(int t=0;t<N;t++)
    s.insert({C[t],t});
	BB = B;
	// ToDo
}



int Maid(int W){
	//if(W == BB%10) return 2;
	//if(W == BB/100) return 0;
	//return -1;
	set<P>::iterator a=s.lower_bound({W,0});
	if(a==s.end()) return -1;
	int n=(*a).y;
	s.erase(a);
	return n;
}
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1056 KB Correct
2 Correct 11 ms 1056 KB Correct
3 Correct 10 ms 544 KB Correct
4 Correct 10 ms 1060 KB Correct
5 Correct 11 ms 1060 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 6768 KB Correct
2 Correct 111 ms 10984 KB Correct
3 Correct 126 ms 11972 KB Correct
4 Correct 115 ms 11996 KB Correct
5 Correct 125 ms 11992 KB Correct
6 Correct 121 ms 11980 KB Correct
7 Correct 131 ms 11984 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 78 ms 6768 KB Correct
2 Correct 159 ms 10796 KB Correct
3 Correct 137 ms 11988 KB Correct
4 Correct 172 ms 11980 KB Correct
5 Correct 161 ms 11984 KB Correct
6 Correct 166 ms 11988 KB Correct
7 Correct 147 ms 11724 KB Correct
8 Correct 130 ms 11984 KB Correct