Submission #1211906

#TimeUsernameProblemLanguageResultExecution timeMemory
1211906countlessDetecting Molecules (IOI16_molecules)C++20
9 / 100
0 ms328 KiB
#include "molecules.h" #include <cstdint> #include <random> #include <bitset> #include <vector> #include <iostream> #include <cassert> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const ll MOD = 998244353; const ll INF = 1e18; const ld EPS = 1e-12; #define endl "\n" #define sp <<" "<< #define REP(i, a, b) for(ll i = a; i < b; i++) #define dbg(x) cout << #x << " = " << x << endl #define mp make_pair #define pb push_back #define fi first #define se second #define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) ((ll)(x).size()) vector<int> find_subset(int l, int r, vector<int> w) { int n = w.size(); sort(rall(w)); int sum = 0; set<pair<int, int>> cum; REP(i, 0, n) { sum += w[i]; cum.insert({w[i], i}); // cerr << sum << endl; if (sum > r) { int diff = sum - r; auto it = cum.lower_bound({diff, 0}); if (it != cum.end()) { sum -= (*it).first; cum.erase(it); } } // cerr << sum << endl; if (l <= sum and sum <= r) { vector<int> ans; for (auto [w, j] : cum) { ans.push_back(j); } return ans; } } vector<int> 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...