Submission #1211910

#TimeUsernameProblemLanguageResultExecution timeMemory
1211910countlessDetecting Molecules (IOI16_molecules)C++20
100 / 100
34 ms4268 KiB
#include "molecules.h" #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(); vector<pair<int, int>> p(n); REP(i, 0, n) p[i] = {w[i], i}; sort(all(p)); ll sum = 0; deque<int> st; REP(i, 0, n) { if (sum < L) { sum += p[i].fi; st.push_back(p[i].se); } while (sum > R) { sum -= w[st.front()]; st.pop_front(); } } vector<int> ans; if (sum < L or sum > R) return ans; for (auto &x : st) ans.push_back(x); 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...