Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <algorithm>
- using namespace std;
- const int I_MAX_CHANSONS = 100000;
- const int INFINI = 1000*1000*1000;
- int degreUtilisation[I_MAX_CHANSONS+1];
- int nbUtilisesMax = -INFINI;
- int main()
- {
- int nbChansons;
- scanf("%d", &nbChansons);
- int iSeq = 1, nbUtilises = 0;
- for(int iChanson = 1 ; iChanson <= nbChansons ; iChanson++)
- {
- int curChanson;
- scanf("%d", &curChanson);
- if(curChanson == 0)
- {
- nbUtilises = 0;
- iSeq++;
- }
- else if(degreUtilisation[curChanson] != iSeq)
- {
- nbUtilises++;
- degreUtilisation[curChanson] = iSeq;
- }
- if(nbUtilises > nbUtilisesMax)
- nbUtilisesMax = nbUtilises;
- }
- printf("%d", nbUtilisesMax);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement