제출 #1339019

#제출 시각아이디문제언어결과실행 시간메모리
1339019vjudge1Aliens (IOI07_aliens)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
struct hk
{
    int h;
    int k;
};
bool boolm(hk a, hk b) 
{
    return a.h < b.h;
}
int main() 
{
    int n;
    if (!(cin >> n))
    {
        return 0;
    } 
    vector<hk> vec(n);
    int maxh = 0;
    for (int i = 0; i < n; i++) 
    {
        cin >> vec[i].h;
        cin >> vec[i].k;
        if (vec[i].h > maxh)
        {
            maxh = vec[i].h;
        } 
    }
    sort(vec.begin(), vec.end(), boolm);
    vector<int> veca(maxh + 1, 0);
    for (int i = 0; i < n; i++) 
    {
        vector<pair<int, int>> vceb;
        for (int h = 1; h <= vec[i].h; h++) 
        {
            vecb.push_back({veca[h], h});
        }
        sort(vecb.begin(), vecb.end());
        for (int j = 0; j < vec[i].k; j++) 
        {
            veca[vecb[j].second]++;
        }
    }
    int tot = 0;
    for (int i = 1; i <= maxh; i++)
    {
        int c = veca[i];
        tot += (c * (c - 1 )) / 2;
    }
    cout << tot << endl;
    return 0;
}

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

aliens.cpp: In function 'int main()':
aliens.cpp:37:13: error: 'vecb' was not declared in this scope; did you mean 'vceb'?
   37 |             vecb.push_back({veca[h], h});
      |             ^~~~
      |             vceb
aliens.cpp:39:14: error: 'vecb' was not declared in this scope; did you mean 'vceb'?
   39 |         sort(vecb.begin(), vecb.end());
      |              ^~~~
      |              vceb