제출 #963184

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

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:12:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i=0;i<w.size();i++)
      |                 ~^~~~~~~~~
molecules.cpp:20:20: error: redeclaration of 'std::vector<int> ans'
   20 |     vector < int > ans;
      |                    ^~~
molecules.cpp:10:20: note: 'std::vector<int> ans' previously declared here
   10 |     vector < int > ans;
      |                    ^~~
molecules.cpp:21:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int sum=0,ru=0,lu=0;ru<w.size();ru++)
      |                             ~~^~~~~~~~~