답안 #916993

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
916993 2024-01-26T23:22:33 Z vjudge1 3D Histogram (COCI20_histogram) C++17
20 / 110
2500 ms 6220 KB
#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

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);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 4 ms 484 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 4 ms 504 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 4 ms 476 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 5 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 4 ms 484 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 4 ms 504 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 4 ms 476 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 5 ms 348 KB Output is correct
13 Execution timed out 2603 ms 6220 KB Time limit exceeded
14 Halted 0 ms 0 KB -