Submission #569498

#TimeUsernameProblemLanguageResultExecution timeMemory
569498penguin133Detecting Molecules (IOI16_molecules)C++14
19 / 100
1 ms316 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; int P[200005]; std::vector<int> find_subset(int l, int u, std::vector<int> w) { for(int i=0;i<w.size();i++){ P[i+1] = P[i] + w[i]; } for(int i=0;i<w.size();i++){ int s = i, e = w.size() - 1, ans = s-1; while(s <= e){ int m = (s + e)/2; if(P[m+1] - P[i] > u)e = m - 1; else ans = m, s = m + 1; } if(P[ans+1] - P[i] >= l && P[ans+1] - P[i] <= u){ vector<int>ans1; for(int j=i;j<=ans;j++)ans1.push_back(j); return ans1; } } return {}; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:6:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |     for(int i=0;i<w.size();i++){
      |                 ~^~~~~~~~~
molecules.cpp:9:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |  for(int i=0;i<w.size();i++){
      |              ~^~~~~~~~~
#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...