Submission #332977

#TimeUsernameProblemLanguageResultExecution timeMemory
332977YomapeedDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms364 KiB
#include<bits/stdc++.h> #include "molecules.h" #define pi 3.141592653589793238 #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #define MOD 1000000007 #define INF 999999999999999999 #define pb push_back #define ff first #define ss second #define mp make_pair #define mt make_tuple #define ll long long #define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// vector<int> find_subset(int l, int u, vector<int> w){ int i, st = 0, en = -1; int n = w.size(); int sum = 0; vector<int> idx; for(i = 0; i < n; i++){ idx.pb(i); } sort(idx.begin(), idx.end(), [&](int a, int b){ return w[a] < w[b]; }); int ansl = -1, ansr = -1; for(i = 0; i < n; i++){ while(sum < l){ en++; if(en == n){ break; } sum += w[en]; } if(sum >= l && sum <= u){ ansl = st, ansr = en; break; } while(sum > u){ if(st == n){ break; } sum -= w[st]; st++; } if(sum >= l && sum <= u){ ansl = st, ansr = en; break; } } if(ansl == -1){ return {}; } w.clear(); vector<int> ans; for(i = ansl; i <= ansr; i++){ ans.pb(idx[i]); } return ans; }

Compilation message (stderr)

molecules.cpp:5: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
    5 | #pragma GCC optimization ("O3")
      | 
molecules.cpp:6: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
    6 | #pragma GCC optimization ("unroll-loops")
      |
#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...