답안 #284604

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
284604 2020-08-27T17:23:56 Z triplem5ds Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 384 KB
#include "molecules.h"
#include "bits/stdc++.h"
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    vector<int> v;
    for(int i = 0; i < w.size(); i++)v.push_back(i);
    sort(v.begin(),v.end(), [&](int x, int y){return w[x] < w[y];});
    if(accumulate(w.begin(),w.end(),0ll) < l || w[v[0]] > u)return vector<int>();
    vector<int> ret;
    int sum = 0;
    for(int j = 0; sum < l; j++){
      sum += w[v[j]];
      ret.push_back(v[j]);
    }
    return ret;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:6:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |     for(int i = 0; i < w.size(); i++)v.push_back(i);
      |                    ~~^~~~~~~~~~
# 결과 실행 시간 메모리 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 Correct 1 ms 256 KB OK (n = 1, answer = YES)
4 Correct 0 ms 256 KB OK (n = 2, answer = YES)
5 Correct 1 ms 256 KB OK (n = 2, answer = YES)
6 Correct 1 ms 384 KB OK (n = 3, answer = YES)
7 Correct 0 ms 256 KB OK (n = 3, answer = YES)
8 Correct 0 ms 384 KB OK (n = 3, answer = YES)
9 Correct 1 ms 256 KB OK (n = 3, answer = YES)
10 Correct 0 ms 256 KB OK (n = 3, answer = YES)
11 Correct 0 ms 256 KB OK (n = 3, answer = YES)
12 Correct 1 ms 256 KB OK (n = 3, answer = YES)
13 Incorrect 1 ms 256 KB sum of weights should be in [6..9] but it is 10
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB sum of weights should be in [302..304] but it is 351
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Correct 1 ms 256 KB OK (n = 1, answer = YES)
4 Correct 0 ms 256 KB OK (n = 2, answer = YES)
5 Correct 1 ms 256 KB OK (n = 2, answer = YES)
6 Correct 1 ms 384 KB OK (n = 3, answer = YES)
7 Correct 0 ms 256 KB OK (n = 3, answer = YES)
8 Correct 0 ms 384 KB OK (n = 3, answer = YES)
9 Correct 1 ms 256 KB OK (n = 3, answer = YES)
10 Correct 0 ms 256 KB OK (n = 3, answer = YES)
11 Correct 0 ms 256 KB OK (n = 3, answer = YES)
12 Correct 1 ms 256 KB OK (n = 3, answer = YES)
13 Incorrect 1 ms 256 KB sum of weights should be in [6..9] but it is 10
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Correct 1 ms 256 KB OK (n = 1, answer = YES)
4 Correct 0 ms 256 KB OK (n = 2, answer = YES)
5 Correct 1 ms 256 KB OK (n = 2, answer = YES)
6 Correct 1 ms 384 KB OK (n = 3, answer = YES)
7 Correct 0 ms 256 KB OK (n = 3, answer = YES)
8 Correct 0 ms 384 KB OK (n = 3, answer = YES)
9 Correct 1 ms 256 KB OK (n = 3, answer = YES)
10 Correct 0 ms 256 KB OK (n = 3, answer = YES)
11 Correct 0 ms 256 KB OK (n = 3, answer = YES)
12 Correct 1 ms 256 KB OK (n = 3, answer = YES)
13 Incorrect 1 ms 256 KB sum of weights should be in [6..9] but it is 10
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Correct 1 ms 256 KB OK (n = 1, answer = YES)
4 Correct 0 ms 256 KB OK (n = 2, answer = YES)
5 Correct 1 ms 256 KB OK (n = 2, answer = YES)
6 Correct 1 ms 384 KB OK (n = 3, answer = YES)
7 Correct 0 ms 256 KB OK (n = 3, answer = YES)
8 Correct 0 ms 384 KB OK (n = 3, answer = YES)
9 Correct 1 ms 256 KB OK (n = 3, answer = YES)
10 Correct 0 ms 256 KB OK (n = 3, answer = YES)
11 Correct 0 ms 256 KB OK (n = 3, answer = YES)
12 Correct 1 ms 256 KB OK (n = 3, answer = YES)
13 Incorrect 1 ms 256 KB sum of weights should be in [6..9] but it is 10
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Correct 1 ms 256 KB OK (n = 1, answer = YES)
4 Correct 0 ms 256 KB OK (n = 2, answer = YES)
5 Correct 1 ms 256 KB OK (n = 2, answer = YES)
6 Correct 1 ms 384 KB OK (n = 3, answer = YES)
7 Correct 0 ms 256 KB OK (n = 3, answer = YES)
8 Correct 0 ms 384 KB OK (n = 3, answer = YES)
9 Correct 1 ms 256 KB OK (n = 3, answer = YES)
10 Correct 0 ms 256 KB OK (n = 3, answer = YES)
11 Correct 0 ms 256 KB OK (n = 3, answer = YES)
12 Correct 1 ms 256 KB OK (n = 3, answer = YES)
13 Incorrect 1 ms 256 KB sum of weights should be in [6..9] but it is 10
14 Halted 0 ms 0 KB -