Elevador

Problem Link

Solution by TioPatinhas100 pts

Code / Notes

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    if (n > 1) { 
    vector<int>P(n);
    for (int i = 0; i < n; i++) cin >> P[i];
    sort(P.begin(), P.end());
    if (P[0] > 8) {
        cout << 'N' << endl;
        exit(0);
    }
    for (int i = 0; i+1 < n; i++) {
        if (P[i+1] - P[i] > 8) {
            cout << 'N' << endl;
            exit(0);
            }
        }
    cout << 'S' << endl;
    }
    else {
        int A;
        cin >> A;
        if (A <= 8) cout << 'S' << endl;
        else {cout << 'N' << endl;}
    }
}

Last updated 1 week, 3 days ago


« Back to problem