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

Paradox(Petrosian Alexander){RAU}~ AC prog!!!all test gives OK but WA#8 PLEASE HELP [3] // Problem 1431. Diplomas 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
Mace(Lviv Polytechniс NU) Re: AC prog!!!all test gives OK but WA#8 PLEASE HELP [2] // Problem 1431. Diplomas 29 Jun 2007 03:36
If there is WA, program cant be called "AC" =)
Paradox(Petrosian Alexander){RAU}~ Re: AC prog!!!all test gives OK but WA#8 PLEASE HELP // Problem 1431. Diplomas 3 Jul 2007 15:35
why?

Edited by author 03.07.2007 15:36

Edited by author 01.06.2008 12:33
Paradox(Petrosian Alexander){RAU}~ Re: AC prog!!!all test gives OK but WA#8 PLEASE HELP // Problem 1431. Diplomas 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