제출 #380119

#제출 시각아이디문제언어결과실행 시간메모리
380119vishesh312Detecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include"molecules.h" #include"bits/stdc++.h" using namespace std; using ll = long long; vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<ll, int>> v; for (int i = 0; i < (int)w.size(); ++i) { v.push_back({w[i], i}); } vector<int> ret; sort(all(v)); ll sum = 0; int pt = 0; while (sum < l) { sum += v[i].first; ret.push_back(v[i].second); } return ret; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:12:10: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   12 |     sort(all(v));
      |          ^~~
      |          std::filesystem::perms::all
In file included from /usr/include/c++/9/filesystem:36,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:129,
                 from molecules.cpp:2:
/usr/include/c++/9/bits/fs_fwd.h:147:7: note: 'std::filesystem::perms::all' declared here
  147 |       all  =  0777,
      |       ^~~
molecules.cpp:16:18: error: 'i' was not declared in this scope
   16 |         sum += v[i].first;
      |                  ^
molecules.cpp:14:9: warning: unused variable 'pt' [-Wunused-variable]
   14 |     int pt = 0;
      |         ^~