Submission #957124

# Submission time Handle Problem Language Result Execution time Memory
957124 2024-04-03T04:30:05 Z vjudge1 Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
#define sst string
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define freeopen   freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define mod 1000000007
#define pb push_back
#define mk make_pair
#define ll long long
#define foor(x,vec) for(auto x:vec ){cout<<x<<" ";}
#define fi first
#define se second
#define MAXN 1000069
#define lld long double
#define cha ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ffl fflush(stdout)
#define pii pair<ll,ll>
ll mvx[]={1,-1,0,0};
ll mvy[]={0,0,-1,1};

vector <int> find_subset(int l,int u,vector<int> a){
    int n=a.size();
    vector<int> ans;
    int sum=0;
    int r=0;
    vector <pair<int,int>> w;
    for(ll i=0;i<n;i++)w[i]={a[i],i};
    sort(w.begin(),w.end());
    for(int i=0;i<n;i++){
        while(sum<l && r<n){
            sum+=w[r].fi;
            r++;
        }
        if(l<=sum && sum<=u && w[r-1].fi-w[i].fi<=u-l){
            for(ll j=i;j<r;j++){
                ans.pb(w[j].se);
            }
            return ans;
            break;
        }
        sum-=a[i];
    }
    return {};
}

/*
---------------------------------------------------go get gold---------------------------------------------------------------------
- If u see the problem dp there's many option to iterate, u can iterate from 1- n or 1 - (possible max number)
- If u see the problem that has unexpected constraint u can divide it into 2 problem
- If u see the problem that can use binary search, then u can use binser + check condition
- in interactive problem there's many trick using binser
- kalo misal mau cari yang sama pake pernah ke visit ga bilangan itu
- kalo problem yang high itu biasanya optimisasi nya pake 2 array
- dp bisa aja kek kamu tenzing balls dimana optimisasi 2 dp
- janlup fibonacci
- kalo binser mending r = 3 * 1e18 aja
- kalo mau dibalik itu pake value nya tinggal diubah ke size
 */
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -