Tags » Histogram

Light OJ 1083 - Histogram


/*
Link: http://www.lightoj.com/volume_showproblem.php?problem=1083
*/

#include <bits/stdc++.h>

#define pii pair <int,int>
#define sc scanf
#define pf printf
#define Pi 2*acos(0.0)
#define ms(a,b) memset(a, b, sizeof(a))
#define pb(a) push_back(a)
#define MP make_pair
#define oo 1<<29
#define dd double
#define ll long long
#define EPS 10E-10
#define ff first
#define ss second
#define MAX 10000
#define SZ(a) (int)a.size()
#define getint(a) scanf("%d",&a)
#define loop(i,n) for(int i=0;i<n;i++)
#define TEST_CASE(t) for(int z=1;z<=t;z++)
#define PRINT_CASE printf("Case %d: ",z)
#define all(a) a.begin(),a.end()
#define intlim 2147483648
#define inf 1000000
#define rtintlim 46340
#define llim 9223372036854775808
#define rtllim 3037000499
#define ull unsigned long long
#define I int

using namespace std;
int ara;
int n;
ll histogram()
{
    stack<int>st;
    ll ans=0;
    int i=0;
    while(i<n)
    {
        if(st.empty() || ara<=ara[i])
            st.push(i++);
        else
        {
            int top=st.top();
            st.pop();
            ll top_area=ara*(st.empty()?i:i-st.top()-1);
            ans=max(ans,top_area);
        }
    }
    while(!st.empty())
    {
        int top=st.top();
        st.pop();
        ll top_area=ara*(st.empty()?i:i-st.top()-1);
        ans=max(ans,top_area);
    }
    return ans;
}

int main()
{
    ///freopen("in.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t;
    getint(t);
    TEST_CASE(t)
    {

        getint(n);
        loop(i,n)
        sc("%d",&ara[i]);
        PRINT_CASE;
        pf("%lld\n",histogram());
    }
    return 0;
}


Light OJ

Calibrating digital exposure index

I wanted to establish the true ISO sensitivity of my Nikon D800e’s light meter.

To do this I set my camera on to a tripod and aimed it at a grey card. 200 more words

Coursework - The Art Of Photography

Univariate, Bivariate and Multivariate Datasets

In the earlier post, I avoided using the term “variable” to keep you out of confusion until I explained what is meant by the term… 250 more words

Prerequisites

Kernel density estimates

In the senior thesis writing course, I suggested to the class that they replace the histograms that several students were using with kernel density estimates… 873 more words

Project 1 - The Instrument -Exercise 1.1 Histogram

A very simple exercise to show how the histogram illustrates the camera reading light differently. With a consistent set up of the camera, whether in Auto or Manual mode, and without altering settings or framing, the Histogram will show that the camera’s sensor picks up and reads light differently with each frame exposed. 50 more words

Coursework

Lazy or...

The holiday over Christmas and the new year has made me lazy. Or, more accurately, I’ve allowed myself to revert back to finding more important… 582 more words

Photography

How Histograms Help Snowy Shots

A histogram is a graph of the exposure of each image and can help you determine if images are over or underexposed.  The ‘true black’ is illustrated at the far left of the graph and ‘true white’ is found on the far right. 141 more words