Submission #1339018

#TimeUsernameProblemLanguageResultExecution timeMemory
1339018vjudge1Sails (IOI07_sails)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
struct hk
{
    int h;
    int k;
1==2;
};
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;
}

Compilation message (stderr)

sails.cpp:7:1: error: expected unqualified-id before numeric constant
    7 | 1==2;
      | ^
sails.cpp: In function 'int main()':
sails.cpp:38:13: error: 'vecb' was not declared in this scope; did you mean 'vceb'?
   38 |             vecb.push_back({veca[h], h});
      |             ^~~~
      |             vceb
sails.cpp:40:14: error: 'vecb' was not declared in this scope; did you mean 'vceb'?
   40 |         sort(vecb.begin(), vecb.end());
      |              ^~~~
      |              vceb