제출 #523584

#제출 시각아이디문제언어결과실행 시간메모리
523584obiu10Detecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, std::vector<int> w){ int n=w.size(); vector<pair<int,int>> nums(n); for(int i=0; i<n; i++){ int tmp; cin>>tmp; nums[i]={tmp,i}; } sort(nums.begin(), nums.end()); int la=0,ra=0; long long sum=0; while(ra!=n){ while(sum<l && ra!=n){ sum+=nums[i].first; ra++; } if(sum<=u && sum>=l){ vector<int> res; for(int i=la; i<ra; i++) res.push_back(nums[i].second); return res; } suma-=nums[la].first; la++; } return vector<int>(0); }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:19:23: error: 'i' was not declared in this scope
   19 |             sum+=nums[i].first;
      |                       ^
molecules.cpp:27:9: error: 'suma' was not declared in this scope; did you mean 'sum'?
   27 |         suma-=nums[la].first;
      |         ^~~~
      |         sum