답안 #841790

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
841790 2023-09-02T06:01:55 Z vjudge1 Roadside Advertisements (NOI17_roadsideadverts) C++17
7 / 100
8 ms 348 KB
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back 
#define pf push_front
#define UseOFF ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0)
#define sz size
#define ins insert
#define new odgfdoigj
using namespace std ;
const ll N = 2e6 + 111 ;
const ll mod = ( 1e9 + 7 ) ;
ll a[ N ] ;
struct DO{
    ll mn = 1e9, mn2 = 1e9 ;
};
DO t[ 25000 ] ;
void hz( ll v, ll L, ll R )
{
    t[ v ].mn = min( t[ L ].mn, t[ R ].mn ) ;
    if( t[ L ].mn < t[ R ].mn )
    {
        t[ v ].mn2 = min( { t[ R ].mn, t[ L ].mn2, t[ v ].mn2 } ) ;
    }
    else
    {
        t[ v ].mn2 = min( { t[ L ].mn, t[ R ].mn2, t[ v ].mn2 } ) ; 
    }
    //cout << tl << " " << tr << " " << t[ v ].mn << " " << t[ v ].mn2 << " " << t[ L ].mn << " " << t[ R ].mn << " " << t[ R ].mn2 << '\n' ; 
}
void build( ll v, ll tl, ll tr )
{
    if( tl == tr )
    {
        t[ v ].mn = a[ tl ] ;
        return ;
    }
    ll L = v + v, R = v + v + 1, tm = ( tl + tr ) / 2 ; 
    build( L, tl, tm ) ;
    build( R, tm + 1, tr ) ;
    hz( v, L, R ) ;
}
ll num = 1e9, num2 = 1e9 ;
void get( ll v, ll tl, ll tr, ll l, ll r ) 
{
    if( l > tr || r < tl ) return ;
    if( l <= tl && tr <= r ) 
    {
        // if( l == 4 && r == 7 )
        // {
        //     cout << num << " " << num2 << " " << t[ v ].mn << " " << t[ v ].mn2 << '\n' ;
        // }
        if( t[ v ].mn >= num )
        {
            num2 = min( t[ v ].mn, num2 ) ;
        }
        if( t[ v ].mn < num ) 
        {
            num2 = min( { num2, t[ v ].mn2, num } ) ;
            num = t[ v ].mn ;
        }
        // if( l == 4 && r == 7 )
        // {
        //     cout << num << " " << num2 << " " << t[ v ].mn << " " << t[ v ].mn2 << '\n' ;
        // }
        return ;
    }
    ll L = v + v, R = v + v + 1, tm = ( tl + tr ) / 2 ; 
    get( L, tl, tm, l, r ) ;
    get( R, tm + 1, tr, l, r ) ;
}
signed main()
{
    //auxiliary.push_back({});
    //swap(auxiliary.back(),v);
    UseOFF ;
    ll n ;
    cin >> n ;
    ll sum = 0 ;
    for( int i = 1 ; i <= n ; i++ )
    {
        ll x, y, z ;
        cin >> x >> y >> z ;
        sum += z ;
    }
    ll q ;
    cin >> q ;
    ll l, o, h, u, v ;
    cin >> l >> o >> h >> u >> v ;
    cout << sum ;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 8 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -