Submission #519755

#TimeUsernameProblemLanguageResultExecution timeMemory
519755yhlasDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms204 KiB
#include "bits/stdc++.h" using namespace std; int n,b,c,p[200005],e,l,r,md,jog,k; vector<int> a,d; vector<int> find_subset(int x, int y, vector<int> v){ sort(v.begin(), v.end()); p[0] = v[0]; for (int i = 1; i < v.size(); i++) p[i] = p[i - 1] + v[i]; for (int i = 0; i < v.size(); i++){ a.push_back(i); if (x <= p[i] and p[i] <= y) return a; } a.clear(); for (int i = 1; i < v.size(); i++){ l = i,r = v.size() - 1,md,jog = -1; while (l <= r){ md = (l + r) / 2; if (y < p[md] - p[i - 1]) r = md - 1; else if (x > p[md] - p[i - 1]) l = md + 1; else{ e = i; jog = md; break; } } if (jog != -1) break; } for (int i = e; i <= jog; i++) a.push_back(i); return a; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |  for (int i = 1; i < v.size(); i++) p[i] = p[i - 1] + v[i];
      |                  ~~^~~~~~~~~~
molecules.cpp:9:20: 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 < v.size(); i++){
      |                  ~~^~~~~~~~~~
molecules.cpp:14:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for (int i = 1; i < v.size(); i++){
      |                  ~~^~~~~~~~~~
molecules.cpp:15:36: warning: right operand of comma operator has no effect [-Wunused-value]
   15 |   l = i,r = v.size() - 1,md,jog = -1;
      |                                    ^
#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...