int main(){
		memset(dp,-1,sizeof(dp));
		int s;
		cin>>n>>s;
		col.PB(parcel(0,-1,2000,0,s,0));

		FOR(i,n){
			int in,out,w,s,v;
			cin>>in>>out>>w>>s>>v;
			col.PB(parcel(i+1,in,out,w,s,v));
		}
示例#2
0
文件: main.cpp 项目: zjsxzy/acmicpc
int main(int argc, char const *argv[])
{
    while (scanf("%d", &n)) {
        v.clear();
        for (int i = 0; i < n; i++) {
            int x, h;
            scanf("%d%d", &x, &h);
            v.PB(MP(x, h));
        }
        sort(v.begin(), v.end());
        g.init(n);
        for (int i = 0; i < n; i++) {

        }
    }
    return 0;
}
示例#3
0
/*int search(int temp,int high,int low)
{
	int mid = (high+low)/2 ;
    if(high<low)
    	return 0;


	if(temp > v[mid])
		search(temp,high,mid+1)
	else
		search(temp,0,mid) ;
}*/
int main()
{
	long long int temp,j,count1 ;
	cin >>  n;
	for(long long int i=0;i<n;i++)
	{
		cin >> temp ;
		v.PB(temp) ;
	}
	sort(v.begin(),v.end()) ;
	int max1 = v[n-1] ;
	int min1 = v[0] ;
	int q ;
	cin >> q ;
	for(int i=0;i<q;i++)
	{
		count1 = 0 ;
		cin >> temp ;
		if(temp>v[n-1])
		{
			cout << n ;
			//continue ; 
		}
		else if(temp<v[0])
			cout << 0 ;
        else
        {
		  for(j=0;j<n;j++)
		  {
			//cout << "atyam" ;
			if(temp<=v[j])
			{
				break ;
			}
			else if(temp>v[j])
			{
				count1++ ;
			}
		  }
		  cout << count1 << endl;
	    }
	}
  return 0 ;
}
void relax() {
	int curW = 0;
	for(int i = 0; i < n; ++i) {
		if (curW + arr[i].first <= c) {
			curW += arr[i].first;
		}
	}
	if (curW > bestAns) {
		int curW = 0;
		ans.clear();
		for(int i = 0; i < n; ++i) {
			if (curW + arr[i].first <= c) {
				curW += arr[i].first;
				ans.PB(arr[i].second);
			}
		}
		bestAns = curW;
	}
}
示例#5
0
void dfs(int parent,int current)
{
	if(colors[current]!=dfs_white)
	{
		return ;
	}
	dfs_num[current] = dfs_low[current] = dfs_current_num++ ;
	colors[current] = dfs_grey ;
	in_stack[current] = true ;
	stronglyconnected_nodes.push(current) ;
	for(std::vector<int>::iterator it = adjacency_list[current].begin();it!=adjacency_list[current].end();it++)
	{
		int pakkadi = *it ;
		if(colors[pakkadi]==dfs_white)
		{
			dfs(current,pakkadi) ;
			dfs_low[current] = min(dfs_low[current],dfs_low[pakkadi]) ;
		}
		else if(in_stack[pakkadi])
		{
			dfs_low[current] = min(dfs_low[current],dfs_num[pakkadi]) ;
		}
	}
	colors[current] = dfs_grey ;
	if(dfs_low[current]==dfs_num[current])
	{
		std::vector<char> stronglyconnected_components;
		while(1)
		{
			int top = stronglyconnected_nodes.top() ;
			stronglyconnected_components.PB(naming[top]) ;
			in_stack[top] = false ;
			stronglyconnected_nodes.pop() ;
			if(top==current)
				break ;
		}
		result.PB(stronglyconnected_components) ;
	}
	
}