Submission #156291

# Submission time Handle Problem Language Result Execution time Memory
156291 2019-10-04T20:11:32 Z a_player Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 376 KB
    #include <bits/stdc++.h>
     
    #define f first
    #define s second
    #define mp make_pair
    #define pb push_back
     
    using namespace std;
     
    typedef long long ll;
    map<ll,vector<int> > v;
    ll s=0;
    vector<int> find_subset(int l,int u, vector<int> w){
     
    	for(int i=0;i<w.size();i++){
    		v[(ll)w[i]].push_back(i);
    		s+=(ll)w[i];
    		}
    		if(s<(ll)u){
    			vector<int> sol;
    				return sol;
    			}
    	    while(s>l){
    			ll d=s-(ll)u;
    			map<ll,vector<int> >::iterator itt=v.upper_bound(d);
    			if(itt==v.begin()){
                  vector<int> sol;
    				return sol;
    				}
    				itt--;
    				
    			s-=itt->first;
    			itt->second.pop_back();
    			if(itt->second.empty())v.erase(itt);
    			}
    		vector<int> sol;
    		for(map<ll,vector<int> >::iterator it=v.begin();it!=v.end();it++){
    			for(int i=0;i<(int)it->second.size();i++)sol.push_back(it->second[i]);
    			}
    			
    	return sol;
    }

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:15:19: 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 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 364 KB OK (n = 2, answer = YES)
5 Correct 2 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 252 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 364 KB OK (n = 2, answer = YES)
5 Correct 2 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 252 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 364 KB OK (n = 2, answer = YES)
5 Correct 2 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 252 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 364 KB OK (n = 2, answer = YES)
5 Correct 2 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 252 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 376 KB OK (n = 1, answer = NO)
3 Correct 2 ms 376 KB OK (n = 1, answer = YES)
4 Correct 2 ms 364 KB OK (n = 2, answer = YES)
5 Correct 2 ms 376 KB OK (n = 2, answer = YES)
6 Correct 2 ms 256 KB OK (n = 3, answer = YES)
7 Correct 2 ms 252 KB OK (n = 3, answer = YES)
8 Correct 2 ms 376 KB OK (n = 3, answer = YES)
9 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
10 Halted 0 ms 0 KB -