제출 #886911

#제출 시각아이디문제언어결과실행 시간메모리
886911artixkrishnaDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; #define REP(i,a,b) for(int i=a; i<b; i++) vector<int> find_subset(int l, int u, vector<int> w){ int n=w.size(); vector<pair<int,int>> arr(n); REP(i,0,n){ arr[i].first = w[i]; arr[i].second =i; } sort(arr.begin(), arr.end()); ll sum=0; int a=0, b=0; int a1=a; int b1=b; sum+=(ll)arr[0].first(); while(b<n){ while(b+1<n&& sum<l){ b++; sum+=(ll)arr[b].first; } while(a<b && sum>u){ sum-=(ll)arr[a].first; a++; } if(sum>=l && sum<=u) break; if(b==n&&a+1==b) return vector<int>(0); if(b==b1 && a==a1) return vector<int>(0); a1=a; b1=b; } vi ans; REP(i,a,b+1) ans.push_back(arr[i].second); return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:19:31: error: expression cannot be used as a function
   19 |         sum+=(ll)arr[0].first();
      |                               ^