제출 #77091

#제출 시각아이디문제언어결과실행 시간메모리
77091shoemakerjoDetecting Molecules (IOI16_molecules)C++14
0 / 100
1070 ms836 KiB
#include "molecules.h" #include <bits/stdc++.h> #define ll long long using namespace std; map<ll, set<int>> indos; vector<int> find_subset(int l, int u, vector<int> w) { sort(w.begin(), w.end()); multiset<ll> curin; multiset<ll> curout; ll csum = 0; for (int i = 0; i < w.size(); i++) { if (indos.count(w[i])) { indos[w[i]].insert(i); } else { set<int> stuff; stuff.insert(i); indos[w[i]] = stuff; } curout.insert(w[i]); } while (csum < l) { if (curout.size() == 0) break; if (csum + *curout.begin() <= u) { csum += *curout.begin(); curin.insert(*curout.begin()); curout.erase(curout.begin()); } else { ll val = *curout.rbegin(); ll oval = *curin.begin(); if (val <= oval) break; csum += val-oval; curout.erase(--curout.end()); curin.erase(curin.begin()); curin.insert(val); curout.insert(oval); } } if (csum < l) { vector<int> ans; return ans; } vector<int> ans; for (ll vv : curin) { ans.push_back(*indos[vv].begin()); indos[vv].erase(indos[vv].begin()); } return ans; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:15:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     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...