제출 #773365

#제출 시각아이디문제언어결과실행 시간메모리
773365MatblubeDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include <iostream> #include <iomanip> #include <string> #include <math.h> #include <algorithm> #include <cstring> #include <numeric> #include <vector> #include <map> #include <set> #include <deque> #include <unordered_map> #include <unordered_set> typedef long long ll; #define dbg(x) cerr<<#x<<": "<<x<<"\n"; #define fr(i, x) for(ll i=0 ; i<x ; i++) #define fra(x, v) for(auto x:v) #define fra1(x,v) for(auto &x:v) #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define pb(x) push_back(x) #define F first #define S second; std::vector<int> find_subset(int l, int u, std::vector<int> w) { sort(all(w)); ll a, b, cc, pos; std::vector<int>result; a=b=cc=pos=0; while(1){ if(b>=n || a>=n) break; if(cc<l){ cc+=w[a++]; continue; } if(cc>u){ cc-=w[b++]; continue; } for(int i=a; i<b ; i++){ result.pb(w[i]); } return result; } return std::vector<int>(0); }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:31:15: error: 'n' was not declared in this scope
   31 |         if(b>=n || a>=n) break;
      |               ^