제출 #963187

#제출 시각아이디문제언어결과실행 시간메모리
963187maxFedorchukDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "molecules.h" vector<int> find_subset(const long long l,const long long u,const vector<long long> w) { vector < pair < long long ,long long > > mas; vector < long long > ans; for(long long i=0;i<w.size();i++) { mas.push_back({w[i],i}); } sort(mas.begin(),mas.end()); for(long long sum=0,ru=0,lu=0;ru<w.size();ru++) { sum+=mas[ru].first; while(sum>u) { sum-=mas[lu].first; lu++; } if(sum>=l) { for(long long j=lu;j<=ru;j++) { ans.push_back(mas[j].second); } break; } } return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(long long int, long long int, std::vector<long long int>)':
molecules.cpp:11:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(long long i=0;i<w.size();i++)
      |                       ~^~~~~~~~~
molecules.cpp:18:37: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(long long sum=0,ru=0,lu=0;ru<w.size();ru++)
      |                                   ~~^~~~~~~~~
molecules.cpp:39:12: error: could not convert 'ans' from 'vector<long long int>' to 'vector<int>'
   39 |     return ans;
      |            ^~~
      |            |
      |            vector<long long int>