Submission #1057441

#TimeUsernameProblemLanguageResultExecution timeMemory
1057441kkkkkkkkDetecting Molecules (IOI16_molecules)C++14
19 / 100
1 ms432 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int r, vector<int> a) { int n=a.size(); bool vis[r+1]={0}; queue<int> q[2]; vis[0]=1; q[0].push(0); int index=0; vector<int> rez; for (int i=0;i<n;i++) { while (!q[index].empty()) { int zbir=q[index].front(); q[index].pop(); q[1-index].push(zbir); int nov_zbir=zbir+a[i]; if (nov_zbir>=l&&nov_zbir<=r) { for (int j=0;j<=i;j++) { if (vis[nov_zbir-a[j]]) nov_zbir-=a[j], rez.push_back(j); } return rez; } if (nov_zbir>r||vis[nov_zbir]) continue; q[1-index].push(nov_zbir); vis[nov_zbir]=1; } index=1-index; } return rez; }
#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...