Submission #317579

# Submission time Handle Problem Language Result Execution time Memory
317579 2020-10-30T02:54:21 Z bin1st090104 Fortune Telling 2 (JOI14_fortune_telling2) C++11
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>

#define Size(x) ((int)(x).size())
#define endl '\n'

using namespace std;

template<typename T> using vc=vector<T>;
template<typename T> using vc1=vc<T>;
template<typename T> using vc2=vc<vc1<T>>;
template<typename T> using vc3=vc<vc2<T>>;
template<typename T> using vc4=vc<vc3<T>>;
template<typename T> using cr=const T&;
using pii=pair<int,int>;
using lli=long long int;
using pli=pair<lli,int>;

template<typename X,typename Y>
bool minimize(X&x,cr<Y>y){
	return (y<x?x=y,true:false);
}

template<typename X,typename Y>
bool maximize(X&x,cr<Y>y){
	return (y>x?x=y,true:false);
}

const int maxN=2e5;
const int maxM=2e5;
const int inf=0x3f3f3f3f;
const lli INF=0x3f3f3f3f3f3f3f3f;

struct Interval_Tree_Sum{
	vc<int> Node;
	int N;
	Interval_Tree_Sum(int __N){
		N=__N;
		Node.resize(4*N+3,0);
		return ;
	}
	void Upd(int i,int l,int r,int p,int v){
		if(p<l||r<p)
			return;
		if(l==r){
			Node[i]=v;
			return ;
		}
		int m=(l+r)>>1;
		if(p<=m)
			Upd(i<<1,l,m,p,v);
		else
			Upd(i<<1|1,m+1,r,p,v);
		Node[i]=Node[i<<1]+Node[i<<1|1];
		return ;
	}
	void Upd(int p,int v){
		Upd(1,1,N,p,v);
	}
	int Get(int i,int l,int r,int u,int v){
		if(v<l||r<u)
			return 0;
		if(u<=l&&r<=v)
			return Node[i];
		int m=(l+r)>>1;
		return Get(i<<1,l,m,u,v)+Get(i<<1|1,m+1,r,u,v);
	}
	int Get(int u,int v){
		return Get(1,1,N,u,v);
	}
};

struct Interval_Tree_Max{
	vc<int> Node;
	int N;
	Interval_Tree_Max(int __N){
		N=__N;
		Node.resize(4*N+3);
	}
	void Build(int i,int l,int r,const pii *a){
		if(l==r){
			Node[i]=a[l].second;
			return ;
		}
		int m=(l+r)>>1;
		Build(i<<1,l,m,a);Build(i<<1|1,m+1,r,a);
		Node[i]=max(Node[i<<1],Node[i<<1|1]);
		return ;
	}
	void Build(const pii*a){
		Build(1,1,N,a);
		return ;
	}
	int Get(int i,int l,int r,int u,int v){
		if(v<l||r<u||u>v)
			return -1;
		if(u<=l&&r<=v)
			return Node[i];
		int m=(l+r)>>1;
		return max(Get(i<<1,l,m,u,v),Get(i<<1|1,m+1,r,u,v));
	}
	int Get(int u,int v){
		return Get(1,1,N,u,v);
	}
};

int N,K;
pii a[maxN+3];
pii t[maxN+3];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(nullptr);
	//freopen("t.inp","r",stdin);freopen("t.out","w",stdout);
	cin>>N>>K;
	for(int i=1;i<=N;i++)
		cin>>a[i].first>>a[i].second;
	
	for(int i=1;i<=K;i++){
		cin>>t[i].first;
		t[i].second=i;
	}
	
	return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -