답안 #70174

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70174 2018-08-22T12:53:55 Z Vahan Detecting Molecules (IOI16_molecules) C++17
9 / 100
4 ms 632 KB
#include "molecules.h"
#include<algorithm>
#include<vector>
using namespace std;
vector<int> g1,g2;
vector<pair<int,int> > v;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    for(int i=0;i<w.size();i++)
        v.push_back({w[i],i});
    sort(v.begin(),v.end());
    long long s=0;
    for(int i=0;i<v.size();i++)
    {
        s+=v[i].first;
        g1.push_back(v[i].second);
        if(s>=l && s<=u)
            return g1;
        if(s>u)
            break;
    }
    s=0;
    for(int i=v.size()-1;i>=0;i--)
    {
        s+=v[i].first;
        g2.push_back(v[i].second);
        if(s>=l && s<=u)
            return g2;
        if(s>u)
            break;
    }
    return std::vector<int>(0);
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<w.size();i++)
                 ~^~~~~~~~~
molecules.cpp:12:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v.size();i++)
                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB OK (n = 1, answer = NO)
2 Correct 3 ms 492 KB OK (n = 1, answer = NO)
3 Correct 3 ms 544 KB OK (n = 1, answer = YES)
4 Correct 2 ms 544 KB OK (n = 2, answer = YES)
5 Correct 2 ms 544 KB OK (n = 2, answer = YES)
6 Correct 2 ms 544 KB OK (n = 3, answer = YES)
7 Correct 3 ms 544 KB OK (n = 3, answer = YES)
8 Correct 3 ms 572 KB OK (n = 3, answer = YES)
9 Correct 2 ms 624 KB OK (n = 3, answer = YES)
10 Correct 3 ms 624 KB OK (n = 3, answer = YES)
11 Correct 3 ms 632 KB OK (n = 3, answer = YES)
12 Correct 3 ms 632 KB OK (n = 3, answer = YES)
13 Correct 2 ms 632 KB OK (n = 3, answer = NO)
14 Correct 2 ms 632 KB OK (n = 3, answer = YES)
15 Correct 2 ms 632 KB OK (n = 3, answer = YES)
16 Correct 3 ms 632 KB OK (n = 3, answer = NO)
17 Correct 2 ms 632 KB OK (n = 3, answer = NO)
18 Correct 3 ms 632 KB OK (n = 100, answer = NO)
19 Correct 3 ms 632 KB OK (n = 100, answer = YES)
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 632 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB OK (n = 1, answer = NO)
2 Correct 3 ms 492 KB OK (n = 1, answer = NO)
3 Correct 3 ms 544 KB OK (n = 1, answer = YES)
4 Correct 2 ms 544 KB OK (n = 2, answer = YES)
5 Correct 2 ms 544 KB OK (n = 2, answer = YES)
6 Correct 2 ms 544 KB OK (n = 3, answer = YES)
7 Correct 3 ms 544 KB OK (n = 3, answer = YES)
8 Correct 3 ms 572 KB OK (n = 3, answer = YES)
9 Correct 2 ms 624 KB OK (n = 3, answer = YES)
10 Correct 3 ms 624 KB OK (n = 3, answer = YES)
11 Correct 3 ms 632 KB OK (n = 3, answer = YES)
12 Correct 3 ms 632 KB OK (n = 3, answer = YES)
13 Correct 2 ms 632 KB OK (n = 3, answer = NO)
14 Correct 2 ms 632 KB OK (n = 3, answer = YES)
15 Correct 2 ms 632 KB OK (n = 3, answer = YES)
16 Correct 3 ms 632 KB OK (n = 3, answer = NO)
17 Correct 2 ms 632 KB OK (n = 3, answer = NO)
18 Correct 3 ms 632 KB OK (n = 100, answer = NO)
19 Correct 3 ms 632 KB OK (n = 100, answer = YES)
20 Incorrect 2 ms 632 KB Contestant can not find answer, jury can
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB OK (n = 1, answer = NO)
2 Correct 3 ms 492 KB OK (n = 1, answer = NO)
3 Correct 3 ms 544 KB OK (n = 1, answer = YES)
4 Correct 2 ms 544 KB OK (n = 2, answer = YES)
5 Correct 2 ms 544 KB OK (n = 2, answer = YES)
6 Correct 2 ms 544 KB OK (n = 3, answer = YES)
7 Correct 3 ms 544 KB OK (n = 3, answer = YES)
8 Correct 3 ms 572 KB OK (n = 3, answer = YES)
9 Correct 2 ms 624 KB OK (n = 3, answer = YES)
10 Correct 3 ms 624 KB OK (n = 3, answer = YES)
11 Correct 3 ms 632 KB OK (n = 3, answer = YES)
12 Correct 3 ms 632 KB OK (n = 3, answer = YES)
13 Correct 2 ms 632 KB OK (n = 3, answer = NO)
14 Correct 2 ms 632 KB OK (n = 3, answer = YES)
15 Correct 2 ms 632 KB OK (n = 3, answer = YES)
16 Correct 3 ms 632 KB OK (n = 3, answer = NO)
17 Correct 2 ms 632 KB OK (n = 3, answer = NO)
18 Correct 3 ms 632 KB OK (n = 100, answer = NO)
19 Correct 3 ms 632 KB OK (n = 100, answer = YES)
20 Incorrect 2 ms 632 KB Contestant can not find answer, jury can
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB OK (n = 1, answer = NO)
2 Correct 3 ms 492 KB OK (n = 1, answer = NO)
3 Correct 3 ms 544 KB OK (n = 1, answer = YES)
4 Correct 2 ms 544 KB OK (n = 2, answer = YES)
5 Correct 2 ms 544 KB OK (n = 2, answer = YES)
6 Correct 2 ms 544 KB OK (n = 3, answer = YES)
7 Correct 3 ms 544 KB OK (n = 3, answer = YES)
8 Correct 3 ms 572 KB OK (n = 3, answer = YES)
9 Correct 2 ms 624 KB OK (n = 3, answer = YES)
10 Correct 3 ms 624 KB OK (n = 3, answer = YES)
11 Correct 3 ms 632 KB OK (n = 3, answer = YES)
12 Correct 3 ms 632 KB OK (n = 3, answer = YES)
13 Correct 2 ms 632 KB OK (n = 3, answer = NO)
14 Correct 2 ms 632 KB OK (n = 3, answer = YES)
15 Correct 2 ms 632 KB OK (n = 3, answer = YES)
16 Correct 3 ms 632 KB OK (n = 3, answer = NO)
17 Correct 2 ms 632 KB OK (n = 3, answer = NO)
18 Correct 3 ms 632 KB OK (n = 100, answer = NO)
19 Correct 3 ms 632 KB OK (n = 100, answer = YES)
20 Incorrect 2 ms 632 KB Contestant can not find answer, jury can
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB OK (n = 1, answer = NO)
2 Correct 3 ms 492 KB OK (n = 1, answer = NO)
3 Correct 3 ms 544 KB OK (n = 1, answer = YES)
4 Correct 2 ms 544 KB OK (n = 2, answer = YES)
5 Correct 2 ms 544 KB OK (n = 2, answer = YES)
6 Correct 2 ms 544 KB OK (n = 3, answer = YES)
7 Correct 3 ms 544 KB OK (n = 3, answer = YES)
8 Correct 3 ms 572 KB OK (n = 3, answer = YES)
9 Correct 2 ms 624 KB OK (n = 3, answer = YES)
10 Correct 3 ms 624 KB OK (n = 3, answer = YES)
11 Correct 3 ms 632 KB OK (n = 3, answer = YES)
12 Correct 3 ms 632 KB OK (n = 3, answer = YES)
13 Correct 2 ms 632 KB OK (n = 3, answer = NO)
14 Correct 2 ms 632 KB OK (n = 3, answer = YES)
15 Correct 2 ms 632 KB OK (n = 3, answer = YES)
16 Correct 3 ms 632 KB OK (n = 3, answer = NO)
17 Correct 2 ms 632 KB OK (n = 3, answer = NO)
18 Correct 3 ms 632 KB OK (n = 100, answer = NO)
19 Correct 3 ms 632 KB OK (n = 100, answer = YES)
20 Incorrect 2 ms 632 KB Contestant can not find answer, jury can
21 Halted 0 ms 0 KB -