Advertisement
a53

robot2

a53
Feb 9th, 2020
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. //Em. Cerchez 100 puncte
  2. #include <fstream>
  3. #define LMAX 100
  4. #define NMAX 500002
  5.  
  6. using namespace std;
  7. ifstream fin("robot.in");
  8. ofstream fout("robot.out");
  9. int cerinta, n, nrtip, nrcutii=NMAX;
  10. int nr[LMAX*LMAX];
  11.  
  12. int main()
  13. {int i, lg1, lg2, aux;
  14. fin>>cerinta>>n;
  15. for (i=0; i<n; i++)
  16. {
  17. fin>>lg1>>lg2;
  18. if (lg1>lg2) {aux=lg1; lg1=lg2; lg2=aux;}
  19. nr[lg1*100+lg2]++;
  20. }
  21. for (i=1; i<LMAX*LMAX; i++)
  22. if (nr[i])
  23. {nrtip++;
  24. if (nr[i]<nrcutii) nrcutii=nr[i];}
  25. if (cerinta==1) fout<<nrtip<<'\n';
  26. else fout<<nrcutii<<'\n';
  27. fout.close();
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement