제출 #434218

#제출 시각아이디문제언어결과실행 시간메모리
434218SupersonicDetecting Molecules (IOI16_molecules)C++14
69 / 100
55 ms9876 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n=w.size();vector<pair<int,int>> s;vector<int> r; for(int i=0;i<n;i++)s.push_back({w[i],i}); sort(s.begin(),s.end()); vector<pair<int,int>> mi,ma;mi.push_back(s[0]);ma.push_back(s.back()); int as=mi[0].first,bs=ma[0].first; for(int i=0;i<n;i++){ if(i>0){mi.push_back(s[i]);ma.push_back(s[n-1-i]); //for(auto j:mi)cerr<<j.first<<' ';cerr<<endl;for(auto j:ma)cerr<<j.first<<' ';cerr<<endl;cerr<<endl; as+=mi[i].first,bs+=ma[i].first;} if(as<=l&&bs>=l){ //for(auto j:mi)cerr<<j.first<<' ';cerr<<endl;for(auto j:ma)cerr<<j.first<<' ';cerr<<endl; for(int j=0;j<=i+1;j++){ if(as>=l&&as<=u)break; if(j==i+1)exit(1); as-=mi[j].first;mi[j]=ma[j];as+=mi[j].first; } for(auto i:mi)r.push_back(i.second); return r; } if(as>=l&&as<=u){ for(auto i:mi)r.push_back(i.second); return r; } if(as>u)break; } return r; }
#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...