Submission #916993

#TimeUsernameProblemLanguageResultExecution timeMemory
916993vjudge13D Histogram (COCI20_histogram)C++17
20 / 110
2603 ms6220 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
#define MOD 1000000007
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FIN "\n"
#define REP(i,a,b) for(int i=a;i<b;i++)
#define ALL(x) x.begin(),x.end();
typedef long long int ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
ll n,a,b;
int main()
{
    /*ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);*/
    scanf("%lld",&n);
    vector<pair<ll,ll>> xd(n);
    ll maxi=0;
    for(ll i=0;i<n;i++){
        scanf("%lld %lld",&a,&b);
        xd[i].F=a;
        xd[i].S=b;
        maxi=max(maxi,a*b);
    }
    for(ll i=0;i<n-1;i++){
        ll xda=xd[i].F;
        ll xdb=xd[i].S;
        for(ll j=i+1;j<n;j++){
            xda=min(xda,xd[j].F);
            xdb=min(xdb,xd[j].S);
            maxi=max(maxi,xda*xdb*(j-i+1));
        }
    }
    printf("%lld",maxi);
}

Compilation message (stderr)

histogram.cpp: In function 'int main()':
histogram.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     scanf("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
histogram.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |         scanf("%lld %lld",&a,&b);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...