Submission #235653

#TimeUsernameProblemLanguageResultExecution timeMemory
235653abacabaDetecting Molecules (IOI16_molecules)C++14
69 / 100
1079 ms4600 KiB
#include <iostream> #include <string> #include <unordered_map> #include <unordered_set> #include <cstring> #include <chrono> #include <vector> #include <map> #include <random> #include <set> #include <algorithm> #include <math.h> #include <cstdio> #include <stdio.h> #include <queue> #include <bitset> #include <cstdlib> #include <deque> #include <cassert> #include <stack> using namespace std; #define mp make_pair #define f first #define se second #define ll long long #define endl '\n' #define pii pair<int, int> inline void setin(string s) { freopen(s.c_str(), "r", stdin); } inline void setout(string s) { freopen(s.c_str(), "w", stdout); } const int inf = 2e9 + 5; const int mod = 1e9 + 7; const int N = 1e6 + 15; int n; ll p[N]; pii a[N]; inline bool lie(ll l, ll x, ll r) { return l <= x && x <= r; } vector<int> find_subset(int l, int u, vector<int> w) { n = w.size(); for(int i = 0; i < n; ++i) a[i+1] = {w[i], i}; sort(a + 1, a + 1 + n); for(int i = 1; i <= n; ++i) p[i] = p[i-1] + a[i].f; vector <int> ans = {}; for(int j = 1; j <= n; ++j) { for(int i = j; i <= n; ++i) { if(lie(l, p[i] - p[j-1], u)) { for(int k = j; k <= i; ++k) ans.push_back(a[k].se); return ans; } } } 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...