Submission #1334666

#TimeUsernameProblemLanguageResultExecution timeMemory
1334666iamhereforfunDetecting Molecules (IOI16_molecules)C++20
0 / 100
0 ms344 KiB
// Starcraft 2 enjoyer //

#include <bits/stdc++.h>

#include "molecules.h"

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")

using namespace std;

#define LSOne(X) ((X) & -(X))

const int N = 5e5 + 5;
const int M = 1e6 + 5;
const int LG = 60;
const int INF = 1e9 + 5;
const int K = 301;
const int B = 150000;
const int MOD = 1e9 + 7;

vector<int> find_subset(int l, int u, vector<int> w)
{
    vector<pair<int, int>> v;
    for (int x = 0; x < w.size(); x++)
    {
        v.push_back({w[x], x + 1});
    }
    sort(v.begin(), v.end());
    long long sl = 0, sr = 0;
    for (int x = 0; x < v.size(); x++)
    {
        sl += v[x].first;
        sr += v[v.size() - 1 - x].first;
        if (sl <= u && sr >= l)
        {
            vector<int> ans;
            long long cur = 0;
            for (int y = 0; y < x + 1; y++)
            {
                cur += v[y].first;
                ans.push_back(v[y].second);
            }
            for (int y = 0; y < x + 1; y++)
            {
                if (cur >= l && cur <= u)
                    break;
                cur += v[v.size() - 1 - y].first;
                cur -= v[y].first;
                cout << cur << "\n";
                ans[y] = v[v.size() - 1 - y].second;
            }
            return ans;
        }
    }
    return {};
}
#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...