# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
227609 | 2020-04-28T05:36:27 Z | AASG | Detecting Molecules (IOI16_molecules) | C++11 | 5 ms | 384 KB |
#include<bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int n=w.size();int r1=0,r2=0; vector<pair<long long,int> >r; vector<int> rr; for(int i=0;i<n;i++){ r.push_back(make_pair(w[i],i)); } sort(r.begin(),r.end()); long long int A[n]; A[0]=r[0].first; for(int i=1;i<n;i++)A[i]=A[i-1]+r[i].first; long long rt=0; int p1=0,p2=n-1;bool x=true; for(int i=n-1;i>=0 && x;i--){ p1=-1;p2=n;int p3; while(abs(p1-p2)!=1){ p3=(p1+p2)/2; if(A[i]-A[p3]>=l && A[i]-A[p3]<=u){ r1=i;r2=p3;x=false;break; } else if(A[i]-A[p3]>u){p1=p3;} else if(A[i]-A[p3]<l){p2=p3;} } } if(n==1 && A[0]>=l && A[0]<=u)rr.push_back(r[0].second); for(int i=min(r1,r2)+1;i<=max(r1,r2);i++){ rr.push_back(r[i].second); } sort(rr.begin(),rr.end()); return rr; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 5 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 4 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 5 ms | 384 KB | Contestant can not find answer, jury can |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 128 KB | OK (n = 12, answer = YES) |
2 | Correct | 4 ms | 384 KB | OK (n = 12, answer = YES) |
3 | Correct | 4 ms | 256 KB | OK (n = 12, answer = NO) |
4 | Correct | 4 ms | 256 KB | OK (n = 12, answer = NO) |
5 | Incorrect | 5 ms | 256 KB | Contestant can not find answer, jury can |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 5 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 4 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 5 ms | 384 KB | Contestant can not find answer, jury can |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 5 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 4 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 5 ms | 384 KB | Contestant can not find answer, jury can |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 5 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 4 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 5 ms | 384 KB | Contestant can not find answer, jury can |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 5 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 4 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 5 ms | 384 KB | Contestant can not find answer, jury can |
5 | Halted | 0 ms | 0 KB | - |