ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1431. Diplomas

AC prog!!!all test gives OK but WA#8 PLEASE HELP
Posted by Paradox(Petrosian Alexander){RAU}~ 28 Jun 2007 23:01
#include <iostream>
#include <algorithm>

using namespace std;

int n;
int a[30],b[30]={0};

int main(){
    cin>>n;
    int i,j;
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    int ans=n;
    for (i=n;i>=0;i--){
        if(b[i]==1)continue;
        for(j=i;j>=0;j--){
            if(a[i]-a[j]==1&&b[j]!=1){
        //        i++;
                b[j]=1;
                ans--;
            }
        }
    }
    cout<<ans<<endl;
//    cin>>n;
    return 0;
}
Thanks
Re: AC prog!!!all test gives OK but WA#8 PLEASE HELP
Posted by Mace(Lviv Polytechniс NU) 29 Jun 2007 03:36
If there is WA, program cant be called "AC" =)
Re: AC prog!!!all test gives OK but WA#8 PLEASE HELP
Posted by Paradox(Petrosian Alexander){RAU}~ 3 Jul 2007 15:35
why?

Edited by author 03.07.2007 15:36

Edited by author 01.06.2008 12:33
Re: AC prog!!!all test gives OK but WA#8 PLEASE HELP
Posted by Paradox(Petrosian Alexander){RAU}~ 3 Jul 2007 15:35
Mace(Lviv Polytechniс NU) wrote 29 June 2007 03:36
Yes [AC code is moderator] but this prog is the best.]:---}

Edited by author 03.07.2007 15:41

Edited by author 01.06.2008 12:34

Edited by author 01.06.2008 12:35