Submission #1124882

#TimeUsernameProblemLanguageResultExecution timeMemory
1124882sinatbtfardDetecting Molecules (IOI16_molecules)C++20
100 / 100
44 ms3656 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; vector <int> find_subset (int l, int r, vector <int> w){ ll 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...