답안 #210846

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
210846 2020-03-18T20:21:30 Z tatyam Detecting Molecules (IOI16_molecules) C++17
0 / 100
7 ms 504 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#include "molecules.h"
#define rep(a) for(ll i = 0; i < a; i++)
#define all(a) begin(a), end(a)
#define sum(a) accumulate(all(a), 0LL)

vector<int> find_subset(int l, int u, vector<int> w){
    ll n = w.size();
    vector<ll> a(n);
    iota(all(a), 0);
    sort(all(a), [&](ll a, ll b){ return w[a] < w[b]; });
    if(w[a[0]] > u) return {};
    if(l > sum(w)) return {};
    ll s = 0, at = n;
    vector<int> ans;
    while(s <= u){
        if(l <= s) return ans;
        ans.push_back(a[--at]);
        s += w[ans.back()];
    }
    n = min<ll>(ans.size(), n - ans.size());
    rep(n){
        s -= w[ans[i]];
        ans[i] = w[a[i]];
        s += w[ans[i]];
        if(l <= s) return ans;
    }
    return {};
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 256 KB OK (n = 1, answer = NO)
2 Correct 6 ms 256 KB OK (n = 1, answer = NO)
3 Correct 6 ms 376 KB OK (n = 1, answer = YES)
4 Correct 6 ms 256 KB OK (n = 2, answer = YES)
5 Correct 6 ms 256 KB OK (n = 2, answer = YES)
6 Correct 6 ms 256 KB OK (n = 3, answer = YES)
7 Correct 6 ms 256 KB OK (n = 3, answer = YES)
8 Correct 7 ms 376 KB OK (n = 3, answer = YES)
9 Correct 6 ms 376 KB OK (n = 3, answer = YES)
10 Correct 6 ms 376 KB OK (n = 3, answer = YES)
11 Correct 7 ms 376 KB OK (n = 3, answer = YES)
12 Correct 6 ms 256 KB OK (n = 3, answer = YES)
13 Correct 7 ms 376 KB OK (n = 3, answer = NO)
14 Correct 6 ms 504 KB OK (n = 3, answer = YES)
15 Correct 6 ms 376 KB OK (n = 3, answer = YES)
16 Correct 6 ms 376 KB OK (n = 3, answer = NO)
17 Correct 6 ms 376 KB OK (n = 3, answer = NO)
18 Incorrect 6 ms 376 KB sum of weights should be in [971..971] but it is 996
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 256 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 256 KB OK (n = 1, answer = NO)
2 Correct 6 ms 256 KB OK (n = 1, answer = NO)
3 Correct 6 ms 376 KB OK (n = 1, answer = YES)
4 Correct 6 ms 256 KB OK (n = 2, answer = YES)
5 Correct 6 ms 256 KB OK (n = 2, answer = YES)
6 Correct 6 ms 256 KB OK (n = 3, answer = YES)
7 Correct 6 ms 256 KB OK (n = 3, answer = YES)
8 Correct 7 ms 376 KB OK (n = 3, answer = YES)
9 Correct 6 ms 376 KB OK (n = 3, answer = YES)
10 Correct 6 ms 376 KB OK (n = 3, answer = YES)
11 Correct 7 ms 376 KB OK (n = 3, answer = YES)
12 Correct 6 ms 256 KB OK (n = 3, answer = YES)
13 Correct 7 ms 376 KB OK (n = 3, answer = NO)
14 Correct 6 ms 504 KB OK (n = 3, answer = YES)
15 Correct 6 ms 376 KB OK (n = 3, answer = YES)
16 Correct 6 ms 376 KB OK (n = 3, answer = NO)
17 Correct 6 ms 376 KB OK (n = 3, answer = NO)
18 Incorrect 6 ms 376 KB sum of weights should be in [971..971] but it is 996
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 256 KB OK (n = 1, answer = NO)
2 Correct 6 ms 256 KB OK (n = 1, answer = NO)
3 Correct 6 ms 376 KB OK (n = 1, answer = YES)
4 Correct 6 ms 256 KB OK (n = 2, answer = YES)
5 Correct 6 ms 256 KB OK (n = 2, answer = YES)
6 Correct 6 ms 256 KB OK (n = 3, answer = YES)
7 Correct 6 ms 256 KB OK (n = 3, answer = YES)
8 Correct 7 ms 376 KB OK (n = 3, answer = YES)
9 Correct 6 ms 376 KB OK (n = 3, answer = YES)
10 Correct 6 ms 376 KB OK (n = 3, answer = YES)
11 Correct 7 ms 376 KB OK (n = 3, answer = YES)
12 Correct 6 ms 256 KB OK (n = 3, answer = YES)
13 Correct 7 ms 376 KB OK (n = 3, answer = NO)
14 Correct 6 ms 504 KB OK (n = 3, answer = YES)
15 Correct 6 ms 376 KB OK (n = 3, answer = YES)
16 Correct 6 ms 376 KB OK (n = 3, answer = NO)
17 Correct 6 ms 376 KB OK (n = 3, answer = NO)
18 Incorrect 6 ms 376 KB sum of weights should be in [971..971] but it is 996
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 256 KB OK (n = 1, answer = NO)
2 Correct 6 ms 256 KB OK (n = 1, answer = NO)
3 Correct 6 ms 376 KB OK (n = 1, answer = YES)
4 Correct 6 ms 256 KB OK (n = 2, answer = YES)
5 Correct 6 ms 256 KB OK (n = 2, answer = YES)
6 Correct 6 ms 256 KB OK (n = 3, answer = YES)
7 Correct 6 ms 256 KB OK (n = 3, answer = YES)
8 Correct 7 ms 376 KB OK (n = 3, answer = YES)
9 Correct 6 ms 376 KB OK (n = 3, answer = YES)
10 Correct 6 ms 376 KB OK (n = 3, answer = YES)
11 Correct 7 ms 376 KB OK (n = 3, answer = YES)
12 Correct 6 ms 256 KB OK (n = 3, answer = YES)
13 Correct 7 ms 376 KB OK (n = 3, answer = NO)
14 Correct 6 ms 504 KB OK (n = 3, answer = YES)
15 Correct 6 ms 376 KB OK (n = 3, answer = YES)
16 Correct 6 ms 376 KB OK (n = 3, answer = NO)
17 Correct 6 ms 376 KB OK (n = 3, answer = NO)
18 Incorrect 6 ms 376 KB sum of weights should be in [971..971] but it is 996
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 256 KB OK (n = 1, answer = NO)
2 Correct 6 ms 256 KB OK (n = 1, answer = NO)
3 Correct 6 ms 376 KB OK (n = 1, answer = YES)
4 Correct 6 ms 256 KB OK (n = 2, answer = YES)
5 Correct 6 ms 256 KB OK (n = 2, answer = YES)
6 Correct 6 ms 256 KB OK (n = 3, answer = YES)
7 Correct 6 ms 256 KB OK (n = 3, answer = YES)
8 Correct 7 ms 376 KB OK (n = 3, answer = YES)
9 Correct 6 ms 376 KB OK (n = 3, answer = YES)
10 Correct 6 ms 376 KB OK (n = 3, answer = YES)
11 Correct 7 ms 376 KB OK (n = 3, answer = YES)
12 Correct 6 ms 256 KB OK (n = 3, answer = YES)
13 Correct 7 ms 376 KB OK (n = 3, answer = NO)
14 Correct 6 ms 504 KB OK (n = 3, answer = YES)
15 Correct 6 ms 376 KB OK (n = 3, answer = YES)
16 Correct 6 ms 376 KB OK (n = 3, answer = NO)
17 Correct 6 ms 376 KB OK (n = 3, answer = NO)
18 Incorrect 6 ms 376 KB sum of weights should be in [971..971] but it is 996
19 Halted 0 ms 0 KB -