Submission #198110

# Submission time Handle Problem Language Result Execution time Memory
198110 2020-01-24T18:10:59 Z Ruxandra985 Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 380 KB
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;

vector <int> sol;
pair <int,int> x[200010];
vector <int> find_subset (int l , int u , vector <int> v){
    int i , sum;
    for (i=0;i<v.size();i++){
        x[i] = make_pair(v[i] , i);
    }
    sort (x + 1 , x + v.size());

    sum = 0;
    for (i = v.size() - 1 ; i ;i--){
        if (sum + x[i].first <= u){
            sum += x[i].first;
            sol.push_back(x[i].second);
        }
        if (sum >= l){
            return sol;
        }
    }
    sol.clear();
    return sol; /// nu se poate;

}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i=0;i<v.size();i++){
              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 352 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 352 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 352 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 352 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 352 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 352 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 352 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 352 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 352 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 352 KB Contestant can not find answer, jury can
4 Halted 0 ms 0 KB -