Submission #868303

#TimeUsernameProblemLanguageResultExecution timeMemory
868303LOLOLODetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; vector <int> find_subset(ll l, ll r, vector <ll> arr) { vector <pair <ll, ll>> v; for (int i = 0; i < sz(arr); i++) v.pb({arr[i], i}); sort(all(v)); vector <int> lst; ll s = 0, st = 0; for (int j = 0; j < sz(v); j++) { s += v[j].f; while (s > r) { s -= v[st].f; st++; } if (s >= l) { for (int f = st; f <= j; f++) { lst.pb(v[f].s); } return lst; } } return {0}; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(ll, ll, std::vector<long long int>)':
molecules.cpp:8:25: error: 'sz' was not declared in this scope
    8 |     for (int i = 0; i < sz(arr); i++)
      |                         ^~
molecules.cpp:9:11: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'pb'
    9 |         v.pb({arr[i], i});
      |           ^~
molecules.cpp:11:10: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   11 |     sort(all(v));
      |          ^~~
      |          std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from molecules.cpp:2:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~
molecules.cpp:15:25: error: 'sz' was not declared in this scope; did you mean 'st'?
   15 |     for (int j = 0; j < sz(v); j++) {
      |                         ^~
      |                         st
molecules.cpp:16:19: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'f'
   16 |         s += v[j].f;
      |                   ^
molecules.cpp:18:24: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'f'
   18 |             s -= v[st].f;
      |                        ^
molecules.cpp:24:21: error: 'class std::vector<int>' has no member named 'pb'
   24 |                 lst.pb(v[f].s);
      |                     ^~
molecules.cpp:24:29: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 's'
   24 |                 lst.pb(v[f].s);
      |                             ^