제출 #769365

#제출 시각아이디문제언어결과실행 시간메모리
769365Mery2005Detecting Molecules (IOI16_molecules)C++14
31 / 100
3 ms980 KiB
#include "molecules.h" #include <iostream> #include <algorithm> #include <queue> #include <cmath> #include <vector> #include <list> #include <string> #include <unordered_map> #include <map> #include <set> #include <stack> #include <string> #include <iomanip> #include <fstream> using namespace std; void fastio() { ios_base::sync_with_stdio(false); cin.tie(0); } const long long mod = 1e9+7; const int N = 3e5+5; int a[N] , dp[N]; vector<int> find_subset(int l, int u, vector<int> w){ int n = w.size(); vector<pair<int , int>> w1; for(int i = 0 ; i < w.size() ; i++){ w1.push_back({w[i] , i}); } sort(w1.begin() , w1.end()); int ind = 0; long long int s = 0; for(int i = 0 ; i < n ; i++){ while(s < l){ s += w1[ind].first * 1ll; ind++; } if(s >= l && s <= u){ vector<int> res; for (int j = i; j < ind; j++) { res.push_back(w1[j].second); } return res; } s -= w1[i].first * 1ll; } return vector<int>(0); } // int main(){ // vector<int> ans = find_subset(15, 17, {6, 8, 8, 7}); // for(auto x : ans){ // cout << x << endl; // } // return 0; // }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:31:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   for(int i = 0 ; i < w.size() ; i++){
      |                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...