제출 #1368613

#제출 시각아이디문제언어결과실행 시간메모리
1368613m0rtu_us0512Snacks (NOI25_snacks)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

int64_t N, Q;
map<int64_t, int64_t> A;
deque< tuple <int64_t, int64_t, int64_t> > query;
int64_t sum = 0;

int main(){
    cin >> N >> Q;

    query.assign( Q , {0,0,0} );

    for( auto n=N ; n-- > 0 ; ){
        int64_4 a ;
        cin >> a;
        A[a] ++ ;
    }
    for( auto &[l,r,x] : query ){
        cin >> l >> r >> x;
    }

    int64_t sum = 0 ;
    for( auto &[k,v] : A ){
        sum += k*v;
    }
    cout << sum << endl;

    while( query.size() ){
        auto [l,r,x] = query[0] ;
        query.pop_front();

        int64_t replaced = 0;

        // iterator
        auto it = A.lower_bound(l);

        for( ; it!=A.end() ; ){
            auto [k,v] = *it ;
            if( r < k )
                break;

            sum -= k*v;
            it = A.erase(it);
        }

        if( replaced ){
            A[x] = replaced;
            sum += x*replaced;
        }

        cout << sum << endl;
    }

    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:15:9: error: 'int64_4' was not declared in this scope; did you mean 'int64_t'?
   15 |         int64_4 a ;
      |         ^~~~~~~
      |         int64_t
Main.cpp:16:16: error: 'a' was not declared in this scope
   16 |         cin >> a;
      |                ^