답안 #1105882

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1105882 2024-10-28T08:33:31 Z abushbandit_ Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 504 KB
#include "molecules.h"
#include "bits/stdc++.h"

using namespace std;

std::vector<int> find_subset(int a, int b, std::vector<int> w) {
	sort(w.begin(),w.end());
	vector<pair<int,int>> w2;
	int j = 1;
	for(auto i : w) w2.push_back({i,j++});
	sort(w2.begin(),w2.end());
	int n = w.size();
	int resr = 0,resl = n;
	int l = 0;
	int ans = 0;
	int sum = 0;
	for(int r = 0;r < n;r++) {
		sum += w[r];
		if(sum < a) {
			continue;
		}
		while(sum > b && l <= r) {
			sum -= w[l];
			l++;
		}
		if(sum >= a && sum <= b) {
			if(ans < r - l + 1) {
				ans = r - l + 1;
				resr = r,resl = l;
			}
		}
	}
	std::vector<int> res;
	for(int i = resl;i <= resr;i++) {
		res.push_back(w2[i].second);
	}
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 504 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 504 KB OK (n = 12, answer = YES)
2 Correct 1 ms 336 KB OK (n = 12, answer = YES)
3 Correct 1 ms 336 KB OK (n = 12, answer = NO)
4 Correct 1 ms 336 KB OK (n = 12, answer = NO)
5 Incorrect 1 ms 336 KB sum of weights should be in [290..300] but it is 301
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 504 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 504 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 504 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 504 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -