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

奇怪..为什么G++>1s TLE ,C++36ms

Posted by Lucifer at 2005-08-28 22:38:48 on Problem 1989
#include <iostream.h>
#include <memory.h>
int main()
{
        long n,k,a,i,v[10005];
        cin>>n>>k;
        long t=0,z=1;
        memset(v,0,sizeof(v));
        for (i=1;i<=n;i++)
        {
                cin>>a;
                if (v[a]==0) {v[a]=1; t++;}
                if (t==k)
                {
                        long p;
                        for (p=1;p<=k;p++) v[p]=0;
                        t=0;
                        z++;
                }
        }
        cout<<z<<endl;
        return 0;
}
//---------------------------------------------------------------------------

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