Submission #1196589

#TimeUsernameProblemLanguageResultExecution timeMemory
1196589al95ireyizDetecting Molecules (IOI16_molecules)C++20
31 / 100
191 ms13372 KiB
//*** Bismillah ***// #pragma GCC optimize("O3") #pragma GCC optimize("fast-math") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("no-stack-protector") #include <bits/stdc++.h> using namespace std; #if !defined(ONLINE_JUDGE) and !defined(EVAL) #include "template/debug.h" #else #define d(x...) #endif #define fr first #define sc second #define in insert #define ll long long #define pb push_back #define vll vector<ll> #define pll pair<ll,ll> #define vvll vector<vll> #define vpll vector<pll> #define len(x)(ll)x.size() #define all(x)x.begin(),x.end() const ll INF = 1e9; const ll INFL = 1e18; const ll MOD = 1e9+7; // const ll MOD = 998244353; const ll maxn = 1e4+5; ll n,m,k=0; #include "molecules.h" vll v; ll l, r; bitset<maxn>dp[maxn]; bitset<maxn>dpp; vector<int> find_subset(int _l, int _r, vector<int> _w){ l = _l, r = _r; v.clear(); for(auto x : _w) v.pb(x); n = len(v); for(ll i = 0; i <= r; i ++){ dp[i].reset(); } dpp.reset(); if(accumulate(all(v), 0ll) < l) return {}; for(ll i = 0; i < n; i ++) if(l <= v[i] and v[i] <= r) return {(int)i}; for(ll i = 0; i < n; i ++){ vll sy; for(ll j = dpp._Find_first();j <= r;j = dpp._Find_next(j)){ sy.pb(j); } reverse(all(sy)); for(auto j : sy){ dp[j + v[i]] = dp[j]; dp[j + v[i]][i] = 1; dpp[j + v[i]] = 1; if(l <= j + v[i] and j + v[i] <= r){ vector<int>cv; for(ll q = 0; q < maxn; q ++) if(dp[j + v[i]][q]) cv.pb(q); return cv; } } dp[v[i]].reset(); dp[v[i]][i] = 1; dpp[v[i]] = 1; } return {}; } // void _(ll tt){ // } // signed main(){ // ll tm=clock(); // cin.tie(0)->sync_with_stdio(0); // ll t=1; // // cin>>t; // for(ll tt=1;tt<=t;tt++){ // _(tt); // } // cerr<<"\n\033[1;31mTime: \033[1;30m" \ // <<(double)(clock()-tm)/1000000<<"\033[1;32m seconds\n"; // }

Compilation message (stderr)

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...