Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <set>
  4. #include <map>
  5. #include <algorithm>
  6. #include <cmath>
  7. #include <string>
  8.  
  9. using namespace std;
  10. typedef long long ll;
  11. typedef vector<ll> vll;
  12. typedef vector<vector<ll>> vvll;
  13.  
  14. int main(){
  15.     int n;
  16.     cin >> n;
  17.     vector<ll> arr;
  18.     for (int i=0; i<n; i++){
  19.         int elem;
  20.         cin >> elem;
  21.         arr.push_back(elem);
  22.     }
  23.     int num_dupes = 0;
  24.     int sum = 0;
  25.     sort(arr.begin(), arr.end());
  26.     for (int j=0; j<n; j++){
  27.         if ((j + 1 < n) && (arr[j]==arr[j+1])) {
  28.             num_dupes++;
  29.             if (j!=0){
  30.                 if (arr[j-1]+1 == arr[j]){
  31.                     cout << "cslnb";
  32.                     return 0;
  33.                 }
  34.             }
  35.             if (arr[j] == 0){
  36.                 cout << "cslnb";
  37.                 return 0;
  38.             }
  39.         }
  40.         int diff = arr[j] - j;
  41.         if (diff < 0){
  42.             cout << "cslnb";
  43.             return 0;
  44.         }
  45.         sum += diff;
  46.     }
  47.     if (num_dupes>1) cout << "cslnb";
  48.     else if (sum%2==0) cout << "cslnb";
  49.     else cout << "sjfnb";
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement