Submission #730194

#TimeUsernameProblemLanguageResultExecution timeMemory
730194ktkeremDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms256 KiB
/*#pragma GCC target ("avx2") #pragma GCC optimize ("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/ #include<bits/stdc++.h> typedef long long ll; typedef long double ld; typedef __int128 vll; typedef long long ftyp; typedef std::complex<ftyp> vec; #define llll std::pair<ll , ll> #define pb push_back #define fi first #define sec second #define cx real #define cy imag #define all(a) a.begin() , a.end() #define debug std::cout << "!!ALERT ALERT!!" << std::endl; const ll limit = 1e12+7; const ll sus = 1e5+5; std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count()); std::vector<int> find_subset(int l , int u , std::vector<int> w){ ll n = 0; for(auto j:w){ if(j != 0){ n++; } } std::vector<int> ans; ll ps = 0 , ss = 0; ll lf = n - 1; std::sort(all(w)); while(l > ss && lf >= 0){ ss += w[lf]; lf--; } lf++; ll rg = 0; if(lf == 0 && l > ss){ return ans; } if(ss <= u && ss >= l){ for(ll i = n-1;lf <= i;i--){ ans.pb(i); } std::sort(all(ans)); return ans; } for(ll i = 1;n>=i;i++){ if(i != 0){ ps += w[i-1]; } while(lf < i && n > lf){ ss -= w[lf]; lf++; } while(ps + ss > u && lf < n){ ss -= w[lf]; lf++; } if(ps + ss >= l && ps + ss <= u){ for(ll j = n-1;lf <= j;j--){ ans.pb(j); } for(ll j = 0;i>j;j++){ ans.pb(j); } std::sort(all(ans)); return ans; } } return ans; } /*void solve(){ std::vector<int> ar = {50 , 50 , 50 , 50 , 50 , 50 , 51 , 51 , 51 , 51 , 51 , 51}; std::vector<int> ans = find_subset(302 , 304 , ar); std::cout << ans.size() << "\n"; for(ll i = 0;ans.size()>i;i++){ std::cout << ans[i] << " "; } return; } int main(){ std::ios_base::sync_with_stdio(false);std::cin.tie(NULL); #ifndef ONLINE_JUDGE freopen("in.txt" , "r" , stdin); freopen("out.txt" , "w" , stdout); #endif ll t = 1; //std::cin >> t; while(t--){ solve(); } }*/

Compilation message (stderr)

molecules.cpp:5:78: warning: "/*" within comment [-Wcomment]
    5 | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
      |                                                                               
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:39:6: warning: unused variable 'rg' [-Wunused-variable]
   39 |   ll rg = 0;
      |      ^~
#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...