Submission #229489

# Submission time Handle Problem Language Result Execution time Memory
229489 2020-05-04T16:31:45 Z Tehillah Detecting Molecules (IOI16_molecules) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REPD(i, a, b) for(int i=(int)(a)-1; i>=(int)(b); --i)
#define FOR(it,c) for ( __typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++ )

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 200005;
pair<ll, int> w[N];
int n, l, u;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> l >> u;
    REP(i, 1, n+1) {
    	cin >> w[i].ff;
    	w[i].ss = i;
    }
    sort(w+1, w+n+1);
    REP(i, 1, n+1) w[i].ff += w[i-1].ff;
    int ri = 1, le = 1;
    while(ri <= n) {
    	while(ri <= n && w[ri].ff - w[le-1].ff < l) ++ri;
    	while(le <= ri && ri <= n && w[ri].ff - w[le-1].ff > u) ++le;
    	if(le <= ri && ri <= n && w[ri].ff - w[le-1].ff >= l && w[ri].ff - w[le-1].ff <= u) {
    		REP(i, le, ri+1)
    			cout << w[i].ss-1 << " ";
    		cout << "\n";
    		return 0;
    	} 
    }
    cout << -1 << "\n";
    return 0;
}

Compilation message

/tmp/ccfXytI9.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccdZAB2k.o:molecules.cpp:(.text.startup+0x0): first defined here
/tmp/ccfXytI9.o: In function `main':
grader.cpp:(.text.startup+0x152): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status