제출 #812698

#제출 시각아이디문제언어결과실행 시간메모리
812698elotelo966Detecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; std::vector<int> find_subset(int l, int u, std::vector<int> w){ vector <pair<ll,ll>> dizi; ll n=w.size(); for(ll i=0;i<n;i++){ dizi.push_back({w[i],i}); } sort(dizi.begin(),dizi.end()); ll le=0,r=0,sum=0; bool stop=false; while(le<=r && r<n){ if(sum+dizi[r].first<l){ sum+=dizi[r].first; r++; } else if(sum+dizi[r].first>=l && sum+dizi[r].first<=u){ stop=true; break; } else{ sum-=dizi[le].first; le++; } } vector <ll> cev; if(stop){ for(int i=le;i<=r;i++){ cev.push_back(dizi[i].second); } sort(cev.begin(),cev.end()); } return cev; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:37:12: error: could not convert 'cev' from 'vector<long long int>' to 'vector<int>'
   37 |     return cev;
      |            ^~~
      |            |
      |            vector<long long int>