Submission #1124881

#TimeUsernameProblemLanguageResultExecution timeMemory
1124881sinatbtfardDetecting Molecules (IOI16_molecules)C++20
69 / 100
39 ms3396 KiB
#include <bits/stdc++.h> using namespace std; vector <int> find_subset (int l, int r, vector <int> w){ int sum = 0, n = w.size(); vector <pair <int, int>> a(n); for (int i = 0; i < n; i++) a[i] = {w[i], i}, sum += w[i]; sort(a.begin(), a.end()); vector <int> ans; sum = a[0].first; for (int i = 0, j = 0; j < n;){ if (sum < l) sum += a[++j].first; else if (sum > r) sum -= a[i++].first; else{ for (int k = i; k <= j; k++) ans.push_back(a[k].second); return ans; } } return ans; }

Compilation message (stderr)

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...