제출 #369109

#제출 시각아이디문제언어결과실행 시간메모리
369109flappybirdDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms492 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) { sort(w.begin(), w.end()); 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; }

컴파일 시 표준 에러 (stderr) 메시지

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