Submission #1244377

#TimeUsernameProblemLanguageResultExecution timeMemory
1244377SpyrosAlivDetecting Molecules (IOI16_molecules)C++17
9 / 100
0 ms328 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define ll long long const int MN = 1e4+5; const int MV = 1e4+5; int dp[MV]; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n = w.size(); vector<pair<ll, int>> vals; for (int i = 0; i < n; i++) vals.push_back({w[i], i}); sort(vals.begin(), vals.end()); ll tot = 0; vector<int> ans; for (int i = n-1; i >= 0; i--) { if (tot + vals[i].first > u) continue; tot += vals[i].first; ans.push_back(vals[i].second); if (tot >= l && tot <= u) return ans; } return {}; }

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...