제출 #1019842

#제출 시각아이디문제언어결과실행 시간메모리
1019842SaltyDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms348 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<int> ans,blank; vector<int> temp; temp = w; sort(w.begin(),w.end()); unordered_map<int,int> mp; for(auto val:w){ mp[val]++; } int w1 = w[0], w2 = w[w.size()-1]; int sm = 0; for(int i = 0; i < mp[w1]; i++){ if(sm < l) { sm+=w[i]; ans.push_back(i); } else break; } if(sm <= u) return ans; else return blank; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:13:20: warning: unused variable 'w2' [-Wunused-variable]
   13 |     int w1 = w[0], w2 = w[w.size()-1];
      |                    ^~
#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...