Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

test没错,但是RE,不知道哪里 出错了

Posted by cpp050400448169 at 2010-10-10 14:01:32 on Problem 1341
#include<iostream>
#include<numeric>
#include<vector>
#include<algorithm>
using namespace std;

#define MaxL 50002
 
int N , a1, a2, a3, M ,s1, s2, s3, e1, e2, e3;
	vector<int>A(MaxL);
	vector<int>S(MaxL);
	vector<int>E(MaxL);
	vector<int>R(MaxL);
int genA()
{
	static int i =-1;
	i++;
	return (a1*i*i + a2*i + a3) %9973;
}

int genS()
{
	static int i =-1;
	i++;
	return (s1*i*i+ s2*i + s3)%(N/2);
}
int genE()
{
	static int i =-1;
	i++;
	return  S[i] + (e1*i*i+ e2*i + e3)%(N/2) ;
}
int genR()
{
	static int i=-1;
	i++;
	return *min_element(A.begin()+S[i], A.begin()+E[i]);
}
int main()
{
	
	ostream_iterator<int> output(cout,",");
	int ncases;
	cin>>ncases;
	while(ncases--)
	{
		cin>>N >> a1 >> a2 >> a3 >> M >> s1 >> s2 >> s3 >> e1 >> e2 >> e3;
		generate_n(A.begin (),N,genA);
		generate_n(S.begin (),M,genS);
		generate_n(E.begin (),M,genE);
		generate_n(R.begin (),M,genR);
		int max = *max_element(R.begin(), R.begin()+M);
		int minj = find(R.begin(), R.begin()+M, max) - R.begin();
		cout<<minj<<endl;
	}

	return 1;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator