제출 #972452

#제출 시각아이디문제언어결과실행 시간메모리
972452vjudge1Detecting Molecules (IOI16_molecules)C++11
100 / 100
44 ms9668 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; //#define int long long #define double long double #define pon ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int T=1; #define ponchik signed main #define pb push_back #define pf push_front #define endl "\n" #define F first #define S second const long long N=1e5+69,INF=1e18+1488; vector<int> find_subset(int l, int u, vector<int> w) //int main() { long long n=w.size(),a=l,b=u; vector <pair<long long,long long>> w1; // vector <long long> w; // for (int i=0; i<n; i++) // { // int x; cin>>x; // w.pb(x); // } for (int i=0; i<n; i++) { // int x; cin>>x; int x=w[i]; w1.pb({x,i}); } sort(w1.begin(),w1.end()); long long l1=0,r=0,sum=w1[0].F; vector <int> ans; while (l1<n&&r<n) { if (sum>=a&&sum<=b) { for (int i=l1; i<=r; i++) ans.pb(w1[i].S); break; } if (sum<a) r++,sum+=w1[r].F; else if (sum>b) l1++,sum-=w1[l1-1].F; } return ans; }
#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...