# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
298901 | 2020-09-14T09:52:28 Z | Dovran | Detecting Molecules (IOI16_molecules) | C++11 | 2 ms | 512 KB |
#include <bits/stdc++.h> #define N 1000009 #define pii pair <int, int> #define ff first #define sz() size() #define ss second #define pb push_back #define ll long long using namespace std; int c[N], n; pii p[N]; vector<int> ans; vector<int> find_subset(int l, int r, vector<int> w){ n=w.sz(); for(int i=0; i<n; i++) p[i]={w[i], i}; sort(p, p+n); for(int i=0; i<n; i++) c[p[i].ss]+=c[p[i-1].ss]+p[i].ff; p[-1].ss=-1; for(int i=0; i<n; i++){ if(l<=c[p[n-1].ss]-c[p[n-i-2].ss] and r>=c[p[i].ss]){ // cout<<i<<' '<<c[p[n-1].ss]-c[p[n-i-2].ss]<<' '<<c[p[i].ss]<<'\n'; ll sum=c[p[i].ss]; int in=-1, x=i; for(int j=i+1; j<n; j++){ if(sum>=l and sum<=r) break; in++, x++, sum+=p[j].ff, sum-=p[in].ff; // cout<<sum<<' '<<p[j].ff<<' '<<p[in].ff<<" <--\n"; } if(sum>=l and sum<=r){ for(int j=in+1; j<=x; j++) ans.pb(p[j].ss); // cout<<sum<<' '<<in<<' '<<x<<'\n'; return ans; } } } // ans.pb(0); // return ans; } /* int main(){ int m, l, r, x; vector<int>v; cin>>m>>l>>r; for(int i=0; i<m; i++) cin>>x, v.pb(x); vector<int>asd=find_subset(l, r, v); for(auto i:asd) cout<<i<<' '; }*/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 512 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | OK (n = 12, answer = YES) |
2 | Correct | 1 ms | 256 KB | OK (n = 12, answer = YES) |
3 | Incorrect | 1 ms | 384 KB | Integer 13 violates the range [0, 12] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 512 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 512 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 512 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 512 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |