제출 #1014488

#제출 시각아이디문제언어결과실행 시간메모리
1014488CookieDetecting Molecules (IOI16_molecules)C++14
69 / 100
35 ms5576 KiB
#include<bits/stdc++.h> #include<fstream> using namespace std; #define sz(a) (int)a.size() #define ALL(v) v.begin(), v.end() #define ALLR(v) v.rbegin(), v.rend() #define ll long long #define pb push_back #define forr(i, a, b) for(int i = a; i < b; i++) #define dorr(i, a, b) for(int i = a; i >= b; i--) #define ld double #define vt vector #include<fstream> #define fi first #define se second #define pll pair<ll, ll> #define pii pair<int, int> #define mpp make_pair std::vector<int> find_subset(int l, int u, std::vector<int> w) { vt<pii>v; for(int i = 0; i < sz(w); i++){ v.pb(mpp(w[i], i)); } sort(ALL(v)); int r = 0, tot = 0; vt<int>res; for(int i = 0; i < sz(v); i++){ if(i)tot -= v[i - 1].fi; while(r < sz(v) && tot < l){ tot += v[r++].fi; } if(tot >= l && tot <= u){ for(int j = i; j < r; j++){ res.pb(v[j].se); } return(res); } } return(res); } /* #include <cstdio> #include <vector> #include <cassert> //#include "molecules.h" int main() { int n, l, u; assert(3 == scanf("%d %d %d", &n, &l, &u)); std::vector<int> w(n); for (int i = 0; i < n; i++) assert(1 == scanf("%d", &w[i])); std::vector<int> result = find_subset(l, u, w); printf("%d\n", (int)result.size()); for (int i = 0; i < (int)result.size(); i++) printf("%d%c", result[i], " \n"[i == (int)result.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...