Submission #1299607

#TimeUsernameProblemLanguageResultExecution timeMemory
1299607bangchanDetecting Molecules (IOI16_molecules)C++20
69 / 100
32 ms5036 KiB
#include "molecules.h" #include <iostream> #include <vector> #include <map> #include <numeric> #include <set> #include <queue> #include <algorithm> #include <limits.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<bool> vb; typedef vector<double> vd; typedef vector<string> vs; typedef vector<char> vc; typedef vector<vi> vvi; typedef pair<int,int> pii; typedef vector<pii> vii; typedef map<int, int> mii; typedef vector<vl> vvl; typedef pair<ll, ll> pll; typedef vector<pll> vpl; #define mod 1000000007 #define inf 10000000000000 #define F first #define S second #define nd '\n' #define forn(i, x, n) for (ll i = x; i < ll(n); i++) #define fornl(i, x, n) for(ll i = x; i >= ll(n); i--) #define cina(x) for(auto &c : x) cin >> c; #define cingra(x, y, n) forn(i, y, n){ll a, b; cin >> a >> b; a--; b--; x[a].pb(b); x[b].pb(a);} #define cingraw(x, y, n) forn(i, y, n){ll a, b, c; cin >> a >> b >> c; a--; b--; x[a].pb({b, c}); x[b].pb({a, c});} #define fnd(x, y) find(x.begin(), x.end(), y) #define srt(x) sort(x.begin(), x.end()) #define debug(x) cout << #x << " = " << x << nd; #define debugv(x, s) cout << #x << " = "; forn(i, 0, s) cout << x[i] << " "; cout << nd; #define fastio ios_base::sync_with_stdio(false), cin.tie(0); #define freop(in, out) freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #define rmod(a, b) (a % mod - b % mod + mod) % mod #define smod(a, b) (a % mod + b % mod) % mod #define mmod(a, b) (a % mod) * (b % mod) % mod #define yes cout << "YES" << nd #define no cout << "NO" << nd #define pb push_back #define all(x) x.begin(), x.end() std::vector<int> find_subset(int l, int u, std::vector<int> w) { vi avocado; int sum = 0; int n = w.size(); vpl mol(n); forn(i, 0, n) mol[i] = {w[i], i}; srt(mol); int a = 0, j = 0; forn(i, 0, n){ sum += mol[i].F; while(sum > u && j <= i){sum -= mol[j].F; j++;} if(sum >= l){ forn(k, j, i + 1) avocado.pb(mol[k].S); return avocado; } } 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...