Submission #299367

# Submission time Handle Problem Language Result Execution time Memory
299367 2020-09-14T19:46:32 Z APROHACK Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 384 KB
#include "molecules.h"
#include <bits/stdc++.h>
#define PB push_back
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
	vector<int>respuesta;
	//sort(w.begin(), w.end());
	long long sum=0, n=w.size();
	long long menor=w[0], mayor=w[n-1], nn=0, mm=0;
	set<int>menores, mayores;
	for(int i = 0 ; i < n ; i ++){
		if(w[i]==menor)nn++;
		else mm++;
		if(w[i]==menor)menores.insert(i);
		else mayores.insert(i);
	}
	//cout<<menor<<" "<<mayor;
	for(int i = 0 ; i <= nn ; i ++){
		for(int j = 0 ; j <= mm ; j++){
			if(i*menor+j*mayor>=l&&i*menor+j*mayor<=u){
				long long cont=0;
				for(auto x:menores){
					if(cont==nn)break;
					cont++;
					respuesta.push_back(x);
					//if(cont==nn)break;
				}
				cont=0;
				for(auto x:mayores){
					if(cont==mm)break;
					cont++;
					respuesta.push_back(x);

				}
				return respuesta;
			}
		}
	}
	return respuesta;
    //return std::vector<int>respuesta;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:12: warning: unused variable 'sum' [-Wunused-variable]
    8 |  long long sum=0, n=w.size();
      |            ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Correct 1 ms 384 KB OK (n = 1, answer = YES)
4 Correct 1 ms 384 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 256 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB sum of weights should be in [302..304] but it is 606
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Correct 1 ms 384 KB OK (n = 1, answer = YES)
4 Correct 1 ms 384 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 256 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Correct 1 ms 384 KB OK (n = 1, answer = YES)
4 Correct 1 ms 384 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 256 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Correct 1 ms 384 KB OK (n = 1, answer = YES)
4 Correct 1 ms 384 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 256 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Correct 1 ms 384 KB OK (n = 1, answer = YES)
4 Correct 1 ms 384 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 256 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -