Submission #1068809

# Submission time Handle Problem Language Result Execution time Memory
1068809 2024-08-21T12:18:44 Z kiethm07 Detecting Molecules (IOI16_molecules) C++11
9 / 100
1 ms 600 KB
#include <bits/stdc++.h>

#define pii pair<int,int>
#define iii pair<int,pii>
#define fi first
#define se second

#define vi vector<int>
#define vii vector<pii>
#define pb(i) push_back(i)
#define all(x) x.begin(),x.end()

#define TEXT "a"

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int inf = 1e9 + 7;
const ld eps = 1e-8;
const double pi = acos(-1);

vector<int> find_subset(int l,int r,vector<int> w){
    int n = w.size();
    vector<pii> a(n);
    for (int i = 0; i < n; i++){
        a[i] = pii(w[i],i);
    }
    sort(all(a));
    vector<ll> suf(n,0);
    suf[n - 1] = a[n - 1].fi - a[0].fi;
    for (int i = n - 2; i >= 0; i--){
        suf[i] = suf[i + 1] + a[i].fi - a[0].fi;
    }
    vector<int> res;
    for (ll x = 1; x <= n; x++){
        ll c = l - x * a[0].fi;
        ll d = r - x * a[0].fi;
        if (d < 0) break;
        if (suf[n - x] < c) continue;
        //cout << x << " " << c << " " << d << " " << sum << "\n";
        for (int j = n - 1; j > n - 1 - x; j--){
            res.push_back(a[j].se);
        }
        break;
    }
    return res;
}
//
//int main(){
//    int l = 15,r = 17;
//    vector<int> w = {6,8,8,7};
//    vi v = find_subset(l,r,w);
//    for (int i : v) cout << i << " "; cout << "\n";
//    l = 14, r = 15;
//    w = {5,5,6,6};
//    v = find_subset(l,r,w);
//    for (int i : v) cout << i << " "; cout << "\n";
//    l = 10, r = 20;
//    w = {15,17,16,18};
//    v = find_subset(l,r,w);
//    for (int i : v) cout << i << " "; cout << "\n";
//    return 0;
//}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 1 ms 348 KB OK (n = 2, answer = YES)
5 Correct 0 ms 348 KB OK (n = 2, answer = YES)
6 Correct 0 ms 348 KB OK (n = 3, answer = YES)
7 Correct 0 ms 348 KB OK (n = 3, answer = YES)
8 Correct 0 ms 348 KB OK (n = 3, answer = YES)
9 Correct 0 ms 348 KB OK (n = 3, answer = YES)
10 Correct 0 ms 348 KB OK (n = 3, answer = YES)
11 Correct 0 ms 344 KB OK (n = 3, answer = YES)
12 Correct 0 ms 348 KB OK (n = 3, answer = YES)
13 Correct 0 ms 348 KB OK (n = 3, answer = NO)
14 Correct 0 ms 600 KB OK (n = 3, answer = YES)
15 Correct 0 ms 348 KB OK (n = 3, answer = YES)
16 Correct 0 ms 436 KB OK (n = 3, answer = NO)
17 Correct 0 ms 348 KB OK (n = 3, answer = NO)
18 Correct 0 ms 376 KB OK (n = 100, answer = NO)
19 Correct 0 ms 344 KB OK (n = 100, answer = YES)
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB sum of weights should be in [302..304] but it is 306
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 1 ms 348 KB OK (n = 2, answer = YES)
5 Correct 0 ms 348 KB OK (n = 2, answer = YES)
6 Correct 0 ms 348 KB OK (n = 3, answer = YES)
7 Correct 0 ms 348 KB OK (n = 3, answer = YES)
8 Correct 0 ms 348 KB OK (n = 3, answer = YES)
9 Correct 0 ms 348 KB OK (n = 3, answer = YES)
10 Correct 0 ms 348 KB OK (n = 3, answer = YES)
11 Correct 0 ms 344 KB OK (n = 3, answer = YES)
12 Correct 0 ms 348 KB OK (n = 3, answer = YES)
13 Correct 0 ms 348 KB OK (n = 3, answer = NO)
14 Correct 0 ms 600 KB OK (n = 3, answer = YES)
15 Correct 0 ms 348 KB OK (n = 3, answer = YES)
16 Correct 0 ms 436 KB OK (n = 3, answer = NO)
17 Correct 0 ms 348 KB OK (n = 3, answer = NO)
18 Correct 0 ms 376 KB OK (n = 100, answer = NO)
19 Correct 0 ms 344 KB OK (n = 100, answer = YES)
20 Incorrect 0 ms 348 KB sum of weights should be in [302..304] but it is 306
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 1 ms 348 KB OK (n = 2, answer = YES)
5 Correct 0 ms 348 KB OK (n = 2, answer = YES)
6 Correct 0 ms 348 KB OK (n = 3, answer = YES)
7 Correct 0 ms 348 KB OK (n = 3, answer = YES)
8 Correct 0 ms 348 KB OK (n = 3, answer = YES)
9 Correct 0 ms 348 KB OK (n = 3, answer = YES)
10 Correct 0 ms 348 KB OK (n = 3, answer = YES)
11 Correct 0 ms 344 KB OK (n = 3, answer = YES)
12 Correct 0 ms 348 KB OK (n = 3, answer = YES)
13 Correct 0 ms 348 KB OK (n = 3, answer = NO)
14 Correct 0 ms 600 KB OK (n = 3, answer = YES)
15 Correct 0 ms 348 KB OK (n = 3, answer = YES)
16 Correct 0 ms 436 KB OK (n = 3, answer = NO)
17 Correct 0 ms 348 KB OK (n = 3, answer = NO)
18 Correct 0 ms 376 KB OK (n = 100, answer = NO)
19 Correct 0 ms 344 KB OK (n = 100, answer = YES)
20 Incorrect 0 ms 348 KB sum of weights should be in [302..304] but it is 306
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 1 ms 348 KB OK (n = 2, answer = YES)
5 Correct 0 ms 348 KB OK (n = 2, answer = YES)
6 Correct 0 ms 348 KB OK (n = 3, answer = YES)
7 Correct 0 ms 348 KB OK (n = 3, answer = YES)
8 Correct 0 ms 348 KB OK (n = 3, answer = YES)
9 Correct 0 ms 348 KB OK (n = 3, answer = YES)
10 Correct 0 ms 348 KB OK (n = 3, answer = YES)
11 Correct 0 ms 344 KB OK (n = 3, answer = YES)
12 Correct 0 ms 348 KB OK (n = 3, answer = YES)
13 Correct 0 ms 348 KB OK (n = 3, answer = NO)
14 Correct 0 ms 600 KB OK (n = 3, answer = YES)
15 Correct 0 ms 348 KB OK (n = 3, answer = YES)
16 Correct 0 ms 436 KB OK (n = 3, answer = NO)
17 Correct 0 ms 348 KB OK (n = 3, answer = NO)
18 Correct 0 ms 376 KB OK (n = 100, answer = NO)
19 Correct 0 ms 344 KB OK (n = 100, answer = YES)
20 Incorrect 0 ms 348 KB sum of weights should be in [302..304] but it is 306
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 1 ms 348 KB OK (n = 2, answer = YES)
5 Correct 0 ms 348 KB OK (n = 2, answer = YES)
6 Correct 0 ms 348 KB OK (n = 3, answer = YES)
7 Correct 0 ms 348 KB OK (n = 3, answer = YES)
8 Correct 0 ms 348 KB OK (n = 3, answer = YES)
9 Correct 0 ms 348 KB OK (n = 3, answer = YES)
10 Correct 0 ms 348 KB OK (n = 3, answer = YES)
11 Correct 0 ms 344 KB OK (n = 3, answer = YES)
12 Correct 0 ms 348 KB OK (n = 3, answer = YES)
13 Correct 0 ms 348 KB OK (n = 3, answer = NO)
14 Correct 0 ms 600 KB OK (n = 3, answer = YES)
15 Correct 0 ms 348 KB OK (n = 3, answer = YES)
16 Correct 0 ms 436 KB OK (n = 3, answer = NO)
17 Correct 0 ms 348 KB OK (n = 3, answer = NO)
18 Correct 0 ms 376 KB OK (n = 100, answer = NO)
19 Correct 0 ms 344 KB OK (n = 100, answer = YES)
20 Incorrect 0 ms 348 KB sum of weights should be in [302..304] but it is 306
21 Halted 0 ms 0 KB -