제출 #241169

#제출 시각아이디문제언어결과실행 시간메모리
241169crossing0verDetecting Molecules (IOI16_molecules)C++17
9 / 100
5 ms384 KiB
#include<bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> answer(vector<int> &ans,deque<int> v) { for (int i = 0; i < v.size(); i++) { ans.push_back(v[i]); } return ans; } vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); sort(w.begin(),w.end()); long long tot = 0; deque<int> v; vector<int> ans; if (w[0] > u) return ans; for (int i = 0; i < n; i++) { if ( tot + w[i] < l) { tot+=w[i]; v.push_back(i); } } for (int i = n - 1; i >= 0; i--) { if (w[i] > u) n--; } int in = (v.size() > 0 ? v.back() : -1); for (int i = in + 1; i < n; i++) { if ( tot + w[i] >= l && tot + w[i] <= u) { v.push_back(i); return answer(ans,v); } if (tot + w[i] > u) { tot -= w[v.front()]; v.pop_front(); } tot += w[i]; v.push_back(i); if (tot >= l && tot <= u) return answer(ans,v); } return ans; }

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

molecules.cpp: In function 'std::vector<int> answer(std::vector<int>&, std::deque<int>)':
molecules.cpp:5:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < v.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...