Submission #289716

#TimeUsernameProblemLanguageResultExecution timeMemory
289716b00n0rpDetecting Molecules (IOI16_molecules)C++17
100 / 100
60 ms6392 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define int ll #define pb push_back #define INF 1000000000 #define MOD 1000000007 #define mp make_pair const double PI=3.141592653589793238462643383279502884197169399375105820974944; #define REP(i,n) for (int i = 0; i < n; i++) #define FOR(i,a,b) for (int i = a; i < b; i++) #define REPD(i,n) for (int i = n-1; i >= 0; i--) #define FORD(i,a,b) for (int i = a; i >= b; i--) #define remax(a,b) a = max(a,b) #define remin(a,b) a = min(a,b) #define all(v) v.begin(),v.end() #define pii pair<int,int> #define F first #define S second #define mii map<int,int> #define vi vector<int> #define vvi vector<vi> #define itr :: iterator it #define WL(t) while(t --) #define gcd(a,b) __gcd((a),(b)) #define lcm(a,b) ((a)*(b))/gcd((a),(b)) #define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl; #define debug(x) cout << x << endl; #define debug2(x,y) cout << x << " " << y << endl; #define debug3(x,y,z) cout << x << " " << y << " " << z << endl; int power(int a,int b,int m = MOD){ if(b == 0) return 1; if(b == 1) return a; int x = power(a,b/2,m)%m; x = (x*x)%m; if(b%2) return (x*a)%m; return x; } int n,l,u; pii w[200005]; vector<signed> find_subset(signed a, signed b, vector<signed> W){ l = a; u = b; n = (int)W.size(); REP(i,n){ w[i] = {W[i],i}; } sort(w,w+n); int ptr = 0,cur = 0; REP(i,n){ while(ptr < n and cur < l){ cur += w[ptr].F; ptr++; } if(l <= cur and cur <= u){ vector<signed> ans; FOR(j,i,ptr) ans.pb(w[j].S); return ans; } if(cur < l){ return {}; } cur -= w[i].F; } return {}; }
#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...