Submission #1608729
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define INF 900000000 #define LINF 9000000000000000000 typedef long long ll; typedef pair<int, int> P; int n, m1, m2; int a[40], b[40], c[40]; int ans = INF; void dfs(int x, int y, int idx, int sum) { if (x != 0 && y != 0 && sum != 0 && x/m1 == y/m2) { ans = min(ans, sum); return; } if (idx == n) return; dfs(x,y,idx+1,sum); dfs(x+a[idx],y+b[idx],idx+1,sum+c[idx]); } int main(){ cin.tie(0); ios::sync_with_stdio(false); cin >> n >> m1 >> m2; for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i]; dfs(0,0,0,0); if (ans == INF) cout << '-1' << endl; else cout << ans << end; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Mixing Experiment |
User | moko_freedom |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 698 Byte |
Status | CE |
Compile Error
./Main.cpp:32:26: warning: multi-character character constant [-Wmultichar] if (ans == INF) cout << '-1' << endl; ^ ./Main.cpp: In function ‘int main()’: ./Main.cpp:33:19: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘<unresolved overloaded function type>’) else cout << ans << end; ^ In file included from /usr/include/c++/5/istream:39:0, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from ./Main.cpp:1: /usr/include/c++/5/ostream:108:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std:...