Submission #394520

#TimeUsernameProblemLanguageResultExecution timeMemory
394520idk321Detecting Molecules (IOI16_molecules)C++11
9 / 100
1 ms284 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; std::vector<int> find_subset(int l, int u, std::vector<int> w) { ll lsum = 0; ll rsum = 0; vector<int> res; for (int i = 0; i < w.size(); i++) { lsum += w[i]; rsum += w[w.size() - 1 - i]; if (lsum <= u && rsum >= l) { int a = 0; int b = a + i; while (res.size() < i + 1) { while (b + 1 < w.size() && lsum - w[a] + w[b + 1] <= u) { lsum = lsum - w[a] + w[b + 1]; a++; b++; } res.push_back(a); a++; } break; } } return res; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:13:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i = 0; i < w.size(); i++)
      |                     ~~^~~~~~~~~~
molecules.cpp:21:31: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |             while (res.size() < i + 1)
      |                    ~~~~~~~~~~~^~~~~~~
molecules.cpp:23:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |                 while (b + 1 < w.size() && lsum - w[a] + w[b + 1] <= u)
      |                        ~~~~~~^~~~~~~~~~
#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...