Elevador

Problem Link

Solution by Mr.Olimpia100 pts

Code / Notes

#include <bits/stdc++.h>
using namespace std;

/*int dig(int N) {
    int ans = 1;
    while (N > 10) {
        N /= 10;
        ans++;
    }
    return ans;
}*/

int main() {
   int n;
   cin >> n;
   vector<int> peso(n);
   for(int i=0; i<n; i++){
    cin >> peso[i];
   }
   sort(peso.begin(), peso.end());
   if(peso[0]>8){
    cout << "N";
    exit(0);
   }
   for(int i=0; i<n; i++){
    if(i!=0 && peso[i]-peso[i-1]>8){
        cout << "N";
        exit(0);
    }
   }
   cout << "S";
}

Last updated 1 week, 3 days ago


« Back to problem