답안 #1116721

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1116721 2024-11-22T08:49:51 Z SalihSahin Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 504 KB
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
#include "molecules.h"

vector<int> find_subset(int l, int u, vector<int> w) {
    int n = w.size();
    vector<pair<int, int> > a(n);
    for(int i = 0; i < n; i++){
        a[i] = {w[i], i};
    }
    sort(a.begin(), a.end());

    vector<int> pre(n+1);
    for(int i = 0; i < n; i++){
        pre[i+1] = pre[i] + a[i].first;
    }

    vector<int> ans;
    int r = 0;
    for(int i = 0; i < n; i++){
        while(r < n && a[r].first - a[i].first <= u - l) r++;
        bool ok = 0;
        for(int cnt = 1; cnt <= (r - i); cnt++){
            int suml = pre[i + cnt] - pre[i];
            int sumr = pre[r] - pre[r - cnt];
            if(sumr >= l && suml <= u) ok = 1;
        }

        if(ok){
            for(int j = i; j < r; j++) ans.pb(a[j].second);
            break;
        }
    }

    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Correct 1 ms 336 KB OK (n = 1, answer = YES)
4 Correct 1 ms 504 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 336 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 504 KB sum of weights should be in [302..304] but it is 606
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Correct 1 ms 336 KB OK (n = 1, answer = YES)
4 Correct 1 ms 504 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 336 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Correct 1 ms 336 KB OK (n = 1, answer = YES)
4 Correct 1 ms 504 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 336 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Correct 1 ms 336 KB OK (n = 1, answer = YES)
4 Correct 1 ms 504 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 336 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Correct 1 ms 336 KB OK (n = 1, answer = YES)
4 Correct 1 ms 504 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 336 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -