Submission #198372

#TimeUsernameProblemLanguageResultExecution timeMemory
198372Ruxandra985Detecting Molecules (IOI16_molecules)C++14
10 / 100
2 ms376 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector <int> sol; pair <int,int> x[200010]; vector <int> find_subset (int l , int u , vector <int> v){ int i , sum , j , k; for (i=0;i<v.size();i++){ x[i] = make_pair(v[i] , i); } sort (x , x + v.size()); sum = 0; j = -1; for (i=0 ; i < v.size() ; i++){ sum -= x[i-1].first; if (j < i){ j = i; sum += x[i].first; } while (j+1 < v.size()){ sum += x[j+1].first; if (sum > u){ sum -= x[j+1].first; break; } if (l <= sum && sum <= u){ for (k = i ; k <= j + 1 ; k++){ sol.push_back(x[k].second); } return sol; } j++; } } sol.clear(); return sol; /// nu se poate; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i=0;i<v.size();i++){
              ~^~~~~~~~~
molecules.cpp:17:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i=0 ; i < v.size() ; i++){
                ~~^~~~~~~~~~
molecules.cpp:23:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while (j+1 < v.size()){
                ~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...