Submission #126800

# Submission time Handle Problem Language Result Execution time Memory
126800 2019-07-08T12:17:59 Z losmi247 Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int,int> p;
const int N = 2e5+45;

int n,pf[N];
p a[N];
vector <int> sol;

vector <int> find_subset(int l,int u,vector <int> w){
    n = w.size();
    for(int i = 0; i < n; i++){
        a[i+1].first = w[i];
        a[i].second = i;
    }
    sort(a+1,a+n+1);
    for(int i = 1; i <= n; i++){
        pf[i] = pf[i-1] + a[i].first;
    }
    for(int i = 1; i <= n; i++){
        int l = i,r = n,ans = 0;
        while(l <= r){
            int mid = l+(r-l)/2;
            if(pf[mid]-pf[l-1] <= u){
                ans = mid;
                l = mid+1;
            }
            else{
                r = mid-1;
            }
        }
        if(ans){
            int suma = pf[ans] - pf[l-1];
            if(suma >= l){
                for(int j = i; j <= ans; j++){
                    sol.push_back(a[i].second);
                }
            }
        }
    }
    return sol;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -