This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
.'.................',.
............'''',,'''',,'..
......''';:cloodxxxxdolc;,''..
......',;,:lddxkkOO000Okkxdc,....
.....';;;;:ldddxkkOO0K0Okkkxdc,...
....';::;:ldddxxkkkO000Okkkxdo:....
...';;;:codddddxxxkkOO00Okkxxo:'... ██████╗ ███████╗ █████╗ ██████╗ ██████╗ ███╗ ██╗
...';,,:cloooooddddddxxxddddddc'... ██╔══██╗██╔════╝██╔══██╗██╔════╝██╔═══██╗████╗ ██║
..',,,'',;;:cclollcc;,''',;coo;.. ██████╔╝█████╗ ███████║██║ ██║ ██║██╔██╗ ██║
..,,,''....',:oddl:,'..',,,:od:.'. ██╔══██╗██╔══╝ ██╔══██║██║ ██║ ██║██║╚██╗██║
..';;'','....'cdkOx:'',,;clclodc,:, ██████╔╝███████╗██║ ██║╚██████╗╚██████╔╝██║ ╚████║
..';;,,,,',,',cdkkxolccccloddooc;:; ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝
.';::cllc::,,cdxxdooollloddxxdlcoc. ________ ___
.';:clc:;;;,;codddooolc::cclooodkc. ███████╗██╗ ██╗███████╗███████╗██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗ /_ __/ |/ /
.';;;,,,,,,,;cooollloolc;,',:cc:,. ██╔════╝██║ ██║██╔════╝██╔════╝╚██╗ ██╔╝ ██╔════╝██╔═══██╗██╔══██╗██╔════╝ / / / /|_/ /
.,,,'..',,,,,::::cccc:;''..;:,. ███████╗██║ ██║███████╗███████╗ ╚████╔╝ ██║ ██║ ██║██║ ██║█████╗ /_/ /_/ /_/
';:;,..,;;;,;:ccllool;';;;::. ╚════██║██║ ██║╚════██║╚════██║ ╚██╔╝ ██║ ██║ ██║██║ ██║██╔══╝
.,:::,';oxxxxkkO00KOocclcc:. ███████║╚██████╔╝███████║███████║ ██║ ╚██████╗╚██████╔╝██████╔╝███████╗
.';::,',coxxkkkkxxo:cool;. ╚══════╝ ╚═════╝ ╚══════╝╚══════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
.,:;,'',:cccllodolodo:.
..''',;;;;::cllooooodddocc:;,..
....'',;;'''',;::cclllloddddlclolcdxdl:,..
..'',,'',;,,;;,,''';:ccloloodddol:::llldkkkkxxdl;.
:,,,;,',;;,,;,'',,,,,:clooooool::clc:coxxxkkkkkkkx
''',,,',;;,,,'.',,,,'';:cccc:;,;cloollodxxkkkkkkkk
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "molecules.h"
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
#define FOR(i, x, y) for(int i=x; i<y; i++)
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
vector<int> find_subset(int l, int u, vector<int> w){
set<vector<int>> sus;
int n = w.size();
vector<int> ans;
FOR(i,0,n){
if (l<=w[i] && w[i] >= u){
ans.push_back(i);
return ans;
}
}
int cur = 0;
FOR(i,0,n){
cur += w[i];
auto it = sus.lower_bound({cur-u, -1});
auto it2 = sus.lower_bound({cur-l, 1000000});
it2--;
if (it != sus.end() && it2 != sus.end() && (*it)[0] >= (*it2)[0]){
ans = {(*it)[1]+1, (*it2)[1]};
return ans;
}
sus.insert({cur, i});
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |