Fila

Problem Link

Solution by TioPatinhas100 pts

Code / Notes

#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int>A;
    for(int i = 0; i < N; i++) {
        int Ai;
        cin >> Ai;
        A.push_back(Ai);
    }
    int bigboy = A[N-1];
    int cheaters = 0;
    for (int i = N - 2; i >= 0; i--) {
        if(A[i] <= bigboy) {
            cheaters++;
        } else {
            bigboy = A[i];
        }
    }
    cout << cheaters;
}

Last updated 1 month, 4 weeks ago


« Back to problem