Submission #1287910

#TimeUsernameProblemLanguageResultExecution timeMemory
1287910muhammad-ahmadDetecting Molecules (IOI16_molecules)C++20
0 / 100
2 ms336 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); int s = 0; for (int l = 0, r = 0; r < n; r++){ s += w[r]; while (s > u){ s -= w[l]; l++; } if (s <= u && s >= l){ vector<int> ans; for (int j = l; j <= r; j++) ans.push_back(w[j]); return ans; } } }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:21:1: warning: control reaches end of non-void function [-Wreturn-type]
   21 | }
      | ^
molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...