제출 #1026055

#제출 시각아이디문제언어결과실행 시간메모리
10260550npataDetecting Molecules (IOI16_molecules)C++17
100 / 100
49 ms5720 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; #define int long long #define vec vector std::vector<int32_t> find_subset(int32_t l, int32_t u, std::vector<int32_t> w) { int n = w.size(); vec<int> wi(n); iota(wi.begin(), wi.end(), 0); sort(wi.begin(), wi.end(), [&](int i, int j) { return w[i] < w[j]; }); sort(w.begin(), w.end()); int k = 0; int sum = 0; while(k < w.size() && sum + w[k] <= u) { sum += w[k]; k++; } int j = 0; while(j+k < n && sum < l) { sum += w[j+k]; sum -= w[j]; j++; } if(sum < l) return {}; vec<int32_t> ans(0); for(int i = j; i < j+k; i++) { ans.push_back(wi[i]); } return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int32_t, int32_t, std::vector<int>)':
molecules.cpp:18:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  while(k < w.size() && sum + w[k] <= u) {
      |        ~~^~~~~~~~~~
#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...