제출 #843644

#제출 시각아이디문제언어결과실행 시간메모리
843644Mr_HusanboyDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; template<typename T> int len(T &a){return a.size();} #define all(a) (a).begin(), (a).end() vector<int> find_subset(int a, int b, vector<int> w) { int n = len(w); vector<int> p(n); iota(all(p), 0); sort(all(p), [&](int i, int j){ return w[i] < w[j]; }); int l = 0, r = 0; ll cur = 0; queue<int> q; while(r < n){ cur += w[p[r]]; q.push(p[r]); while(l <= r && cur > b) cur -= w[p[l ++]], q.pop(); if(cur >= a) break; r ++; } vector<int> ans; if(cur >= a){ while(!q.empty()) ans.push_back(q.front()), q.pop(); } return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:24:5: error: 'll' was not declared in this scope; did you mean 'l'?
   24 |     ll cur = 0;
      |     ^~
      |     l
molecules.cpp:27:9: error: 'cur' was not declared in this scope
   27 |         cur += w[p[r]];
      |         ^~~
molecules.cpp:34:8: error: 'cur' was not declared in this scope
   34 |     if(cur >= a){
      |        ^~~