Submission #172339

# Submission time Handle Problem Language Result Execution time Memory
172339 2020-01-01T10:05:00 Z mohammad Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 504 KB
/*
░░░░██████████████████
░░▄███████▀▀▀▀▀▀███████▄
░▐████▀▒mohammad▒▀██████▄
░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████
░▐██▒▒▒alwrawrah▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
*/
 
#include<bits/stdc++.h>
#include "molecules.h"
using namespace std;
 
typedef long long ll ;
const ll oo = 1e13 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7  ;

vector<pair<int,int>> v;
ll sum = 0 ;
vector<int> ans;

vector<int> find_subset(int l, int u, vector<int> w) {
	int idx = 0;
	for(int i = 0 ; i < w.size() ; ++i) v.push_back({w[i] , i});
	sort(v.begin(), v.end());
	for(int i = 0 ; i < w.size() ; ++i){
		sum += u ;
		while(sum > u) sum -= v[idx++].first;
		if(sum >= l){
			for(int j = idx ; j <= i ; ++j) ans.push_back(j);
			break;
		}
	}
	return ans;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:35:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i < w.size() ; ++i) v.push_back({w[i] , i});
                  ~~^~~~~~~~~~
molecules.cpp:37:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0 ; i < w.size() ; ++i){
                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB sum of weights should be in [302..304] but it is 50
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB sum of weights should be in [10..12] but it is 9
2 Halted 0 ms 0 KB -