Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
奇怪..为什么G++>1s TLE ,C++36ms#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator