# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
218472 | 2020-04-02T07:56:51 Z | Sho10 | Detecting Molecules (IOI16_molecules) | C++14 | 5 ms | 384 KB |
/* ID: Sho10 LANG: C++ */ #include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10 #define ll long long int #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define all(a) (a).begin(), (a).end() #define sz size #define f first #define s second #define pb push_back #define er erase #define in insert #define mp make_pair #define pi pair #define rc(s) return cout<<s,0 #define endl '\n' #define mod 1000000007 #define PI 3.14159265359 #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; ll sum=0; vector<pair<ll,ll> >v; vector<int>ans; vector<int> find_subset(int l,int u,vector<int>w){ for(ll i=0;i<w.size();i++) { v.pb(mp(w[i],i)); } sort(v.begin(),v.end()); ll sum=0; ll lx=0,rr=0; while(lx<=rr&&rr<v.size()){ if(sum<l){ sum=sum+v[rr].f; rr++; if(sum>=l&&sum<=u){ break; } }else if(sum>u){ sum=sum-v[lx].f; lx++; if(sum>=l&&sum<=u){ break; } }else if(sum>=l&&sum<=u){ break; } } if(sum<l||sum>u){ ans.pb(0); return ans; } for(ll i=lx;i<rr;i++) ans.pb(v[i].s); if(ans.size()==0){ ans.pb(0); } return ans; } //int32_t main(){ //CODE_START;
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | sum of weights should be in [10..12] but it is 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | OK (n = 12, answer = YES) |
2 | Correct | 5 ms | 256 KB | OK (n = 12, answer = YES) |
3 | Incorrect | 5 ms | 256 KB | sum of weights should be in [307..317] but it is 50 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | sum of weights should be in [10..12] but it is 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | sum of weights should be in [10..12] but it is 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | sum of weights should be in [10..12] but it is 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | sum of weights should be in [10..12] but it is 9 |
2 | Halted | 0 ms | 0 KB | - |