제출 #112296

#제출 시각아이디문제언어결과실행 시간메모리
112296ioilolcomDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ll long long int int rad(int a,int b){ return rand%(b-a+1); } std::vector<int> find_subset(int l, int u, std::vector<int> w) { ll sum=0; vector<int> ans; for(int i=0; i<(int)w.size(); i++) { sum+=w[i]; ans.push_back(w[i]); if(sum>r) { int m=rad(0,(int)ans.size()) : sum-=ans[m]; ans.erase(ans.begin()+m); break; } } if(sum>=l&&sum<=r) { return ans; } return std::vector<int>(0); }

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

molecules.cpp: In function 'int rad(int, int)':
molecules.cpp:6:13: error: invalid operands of types 'int() throw ()' and 'int' to binary 'operator%'
  return rand%(b-a+1);
         ~~~~^~~~~~~~
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:14:10: error: 'r' was not declared in this scope
   if(sum>r) {
          ^
molecules.cpp:15:33: error: expected ',' or ';' before ':' token
    int m=rad(0,(int)ans.size()) :
                                 ^
molecules.cpp:21:18: error: 'r' was not declared in this scope
  if(sum>=l&&sum<=r) {
                  ^