제출 #916102

#제출 시각아이디문제언어결과실행 시간메모리
916102AiperiiiDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ss second #define pb push_back vector<int> find_subset(int l, int u, vector<int> w) { int n=w.size(); vector <pair <int,int> > v; for(int i=0;i<n;i++){ v.pb({w[i],i}); } sort(all(v)); int sum=0,p1=0; vector <int> ans; for(int i=0;i<n;i++){ sum+=v[i].ff; while(sum>u){ sum-=v[p1].ff; p1++; } if(sum>=l && sum<=u){ for(int j=p1;j<=i;j++)ans.pb(v[j].ss); break; } } return ans; }

컴파일 시 표준 에러 (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
   12 |     sort(all(v));
      |          ^~~
molecules.cpp:16:18: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'ff'
   16 |        sum+=v[i].ff;
      |                  ^~
molecules.cpp:18:22: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'ff'
   18 |           sum-=v[p1].ff;
      |                      ^~