Submission #1123774

#TimeUsernameProblemLanguageResultExecution timeMemory
1123774njoopDetecting Molecules (IOI16_molecules)C++17
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int mn=w[0], mx=w[0]; vector<pair<int, int>> v; vector<int> ans; for(int i: w) { mx = max(mx, i); mn = min(mn, i); } int r = l/mn; for(int i=0; i<w.size(); i++) { v.push_back({w[i]-mn, i}); } sort(v.begin(), v.end()); int sum = 0; for(int i=0; i<r; i++) { sum += v[i].first; } if(sum >= (l-(r*mn)) && sum <= (u-(r*mn))) { for(int i=0; i<r; i++) { ans.push_back(v[i].second); } return ans; } sum = 0; for(int i=v.size()-r; i<v.size(); i++) { sum += v[i].first; } if(sum >= (l-(r*mn)) && sum <= (u-(r*mn))) { for(int i=v.size()-r; i<v.size(); i++) { ans.push_back(v[i].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...