제출 #1319212

#제출 시각아이디문제언어결과실행 시간메모리
1319212yessimkhanDetecting Molecules (IOI16_molecules)C++20
컴파일 에러
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> // solved by bekagg #define ll long long #define ent '\n' #define pb push_back #define all(x) x.begin(),x.end() #define PRaim_bek_abi ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; const int N = 1e5+5; const int MOD = 1e9+7; int p[N]; vector<int> find_subset(int l, int u, vector<int> w){ dp[0] = -1; for (int i = 0; i < w.size(); i++){ for (int j = u; j >= w[i]; j--){ if (p[j] == 0 or p[j - w[i]] == 0){ continue; } p[j] = i; } } for (int i = l; i <= u; i++){ if (p[j] != 0){ vector<int>ans; x = j; while(x){ ans.pb(p[x]); x -= w[p[x]]; } return ans; } } return 0; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:19:5: error: 'dp' was not declared in this scope; did you mean 'p'?
   19 |     dp[0] = -1;
      |     ^~
      |     p
molecules.cpp:31:15: error: 'j' was not declared in this scope
   31 |         if (p[j] != 0){
      |               ^
molecules.cpp:33:13: error: 'x' was not declared in this scope
   33 |             x = j;
      |             ^
molecules.cpp:42:12: error: could not convert '0' from 'int' to 'std::vector<int>'
   42 |     return 0;
      |            ^
      |            |
      |            int
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
      |         ^~~~