Cod sursa(job #2725644)

Utilizator BoraVladBora Vlad BoraVlad Data 19 martie 2021 13:45:27
Problema Twoton Scor 100
Compilator cpp-64 Status done
Runda Arhiva ICPC Marime 1.03 kb
#include <stdio.h>
#include <iostream>
#include <fstream>

using namespace std;

int n;
int a[1000024];
int counter = 0;

int wtf(int i)
{
    counter++;
    if (counter >= 19997) {
        counter -= 19997;
    }
    if (i == n - 1) {
        return a[i];
    }
    if (a[i] < wtf(i + 1)) {
        return a[i];
    }
    else {
         return wtf(i + 1);
    }
}

void solve()
{

    int minim = a[n - 1];
    counter = 1;
    for (int i = n - 2; i >= 0; i--)
    {
        if (minim < a[i])
        {
            counter = counter * 2;
            if (counter >= 19997) {
                counter -= 19997;
            }
        }
        else
        {
            minim = a[i];
        }
        counter++;
        if (counter >= 19997) {
            counter -= 19997;
        }
    }
}

int main()
{
    fstream f("twoton.in", ios::in), g("twoton.out", ios::out);
    f >> n;
    for (int i = 0; i < n; ++i) {
        f >> a[i];
    }
    solve();
    g << counter << "\n";
    return 0;
}