Submission #369110

#TimeUsernameProblemLanguageResultExecution timeMemory
369110flappybirdDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms384 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef int ll; #define MAX 505050 #define pb push_back ll arr[MAX]; std::vector<int> find_subset(int l, int u, std::vector<int> w) { ll i, j; ll N = w.size(); arr[0] = N; ll c; for (i = N - 1; i >= 0; i--) { c = 0; for (j = l - 1; j >= 0; j--) { if (arr[j] && j + w[i] <= u) { arr[j + w[i]] = i; if (j + w[i] >= l) { j += w[i]; c = 1; break; } } } if (c) break; } vector<ll> v; if (j != -1) { while (j) { v.pb(arr[j]); j -= w[arr[j]]; } } return v; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:28:2: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized]
   28 |  if (j != -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...