Submission #950445

# Submission time Handle Problem Language Result Execution time Memory
950445 2024-03-20T10:14:20 Z ALTAKEXE Jelly Flavours (IOI20_jelly) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long int
#define f first
#define s second
#define pii pair<int, int>
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b)
{
    ll n = a.size(), ans = 0;
    vector<pii> v(n);
    for (int i = 0; i < n; i++)
        v.push_back({a[i], b[i]});
    sort(v.begin(), v.end());
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (v[i].f + v[j].f <= x)
                ans += 2;
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (v[i].s + v[j].s <= y)
                ans += 2;
        }
    }
    return ans;
}

Compilation message

jelly.cpp:6:39: error: 'vector' has not been declared
    6 | int find_maximum_unique(int x, int y, vector<int> a, vector<int> b)
      |                                       ^~~~~~
jelly.cpp:6:45: error: expected ',' or '...' before '<' token
    6 | int find_maximum_unique(int x, int y, vector<int> a, vector<int> b)
      |                                             ^
jelly.cpp: In function 'int find_maximum_unique(int, int, int)':
jelly.cpp:8:12: error: 'a' was not declared in this scope
    8 |     ll n = a.size(), ans = 0;
      |            ^
jelly.cpp:9:5: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    9 |     vector<pii> v(n);
      |     ^~~~~~
      |     std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from jelly.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
jelly.cpp:5:13: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    5 | #define pii pair<int, int>
      |             ^~~~
jelly.cpp:9:12: note: in expansion of macro 'pii'
    9 |     vector<pii> v(n);
      |            ^~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from jelly.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
jelly.cpp:5:18: error: expected primary-expression before 'int'
    5 | #define pii pair<int, int>
      |                  ^~~
jelly.cpp:9:12: note: in expansion of macro 'pii'
    9 |     vector<pii> v(n);
      |            ^~~
jelly.cpp:11:9: error: 'v' was not declared in this scope
   11 |         v.push_back({a[i], b[i]});
      |         ^
jelly.cpp:11:28: error: 'b' was not declared in this scope
   11 |         v.push_back({a[i], b[i]});
      |                            ^
jelly.cpp:12:10: error: 'v' was not declared in this scope
   12 |     sort(v.begin(), v.end());
      |          ^
jelly.cpp:12:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   12 |     sort(v.begin(), v.end());
      |     ^~~~
      |     std::sort
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from jelly.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:4880:5: note: 'std::sort' declared here
 4880 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
jelly.cpp:18:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |                 ans += 2;
      |                 ^~~
      |                 abs
jelly.cpp:26:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |                 ans += 2;
      |                 ^~~
      |                 abs
jelly.cpp:29:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   29 |     return ans;
      |            ^~~
      |            abs