Submission #298293

# Submission time Handle Problem Language Result Execution time Memory
298293 2020-09-12T16:59:49 Z sadpotato Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 256 KB
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
 
long long sum ;
int x , n ; 
vector < pair < int , int > > vec ;
vector < int > ans ;
vector < int > y ;
 
vector<int> find_subset ( int l , int u , vector < int > w ) {
    n = w . size ( ) ;
    for ( int i = 0 ; i < n ; i ++ ) {
        vec . push_back ( { w [ i ] , i } ) ;
    }
    sort ( vec . begin ( ) , vec . end ( ) ) ;
    x = 0 ;
    for ( int i = 0 ; i < n ; i ++ ) {
        while ( x < n && sum < l ) {
            sum += vec [ x ] . first ;
            x ++ ;
        }
        if ( sum >= l && sum <= u ) {
            for ( int j = i ; j <= x ; j ++ ) {
                ans . push_back ( vec [ j ] . second ) ;
            }
            return ans ;
        }
        sum -= vec [ i ] . first ;
    }
    return y ;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 2 violates the range [0, 1]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB sum of weights should be in [302..304] but it is 353
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 2 violates the range [0, 1]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 2 violates the range [0, 1]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 2 violates the range [0, 1]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 0 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 2 violates the range [0, 1]
4 Halted 0 ms 0 KB -