submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s017531235
p03806
C
#include <stdio.h> #define inf 4001 int main(void) { int N; int Ma, Mb; int a[41], b[41], c[41]; static int dp[41][401][401]; int i, ca, cb; int amax = 0; int bmax = 0; int ans; int tmp1; int tmp2; scanf("%d %d %d", &N, &Ma, &Mb); for(i = 0; i < N; i++) { scanf("%d %d %d", &a[i], &b[i], &c[i]); amax += a[i]; bmax += b[i]; } for(i = 0; i < N; i++) { for(ca = 0; ca <= amax; ca++) { for(cb = 0; cb <= bmax; cb++) { dp[i][ca][cb] = inf; } } } dp[0][a[0]][b[0]] = c[0]; dp[0][0][0] = 0; for(i = 1; i < N; i++) { for(ca = 0; ca <= amax; ca++) { for(cb = 0; cb <= bmax; cb++) { // iを入れる if(ca >= a[i] && cb >= b[i]) { tmp1 = dp[i-1][ca-a[i]][cb-b[i]] + c[i]; } else { tmp1 = inf; } // iをいれない tmp2 = dp[i-1][ca][cb]; if(tmp1 < tmp2) { dp[i][ca][cb] = tmp1; } else { dp[i][ca][cb] = tmp2; } } } } ans = inf; for(ca = 0; ca <= amax; ca++) { for(cb = 0; cb <= bmax; cb++) { if(ca*Mb == cb*Ma && dp[N-1][ca][cb] != 0) { if(ans > dp[N-1][ca][cb]) { ans = dp[N-1][ca][cb]; } } } } if(ans == inf) { printf("%d\n", -1); } else { printf("%d\n", and); } return 0; }
main.c: In function 'main': main.c:67:20: error: 'and' undeclared (first use in this function); did you mean 'ans'? 67 | printf("%d\n", and); | ^~~ | ans main.c:67:20: note: each undeclared identifier is reported only once for each function it appears in
s579359839
p03806
C++
#include <iostream> 2.using namespace std; 3.const int INF = 10000 ; 4.int main(void){ 5. int N , Ma , Mb ; 6. int a[45] , b[45] , c[45] ; 7. cin >> N >> Ma >> Mb ; 8. for(int i=1;i<=N;i++){ 9. cin >> a[i] >> b[i] >> c[i] ; 10. } 11. 12. int dp[N+1][500][500] ; 13. for(int i=1;i<=N;i++){ 14. for(int j=0;j<500;j++){ 15. for(int k=0;k<500;k++){ 16. dp[i][j][k] = INF ; 17. } 18. } 19. } 20. 21. for(int i=1;i<=N;i++){ 22. dp[i][0][0] = 0 ; 23. } 24. for(int i=1;i<N;i++){ 25. 26. for(int j=0;j<500;j++){ 27. 28. for(int k=0;k<500;k++){ 29. 30. if(a[i]>j || b[i]>k){ 31. dp[i+1][j][k] = dp[i][j][k] ; 32. }else{ 33. dp[i+1][j][k] = min(dp[i][j][k] , dp[i][j-a[i]][k-b[i]] + c[i]) ; 34. } 35. 36. } 37. } 38. } 39. 40. int ans = INF ; 41. 42. for(int i=1;i<=40;i++){ 43. ans = min(ans , dp[N][i*Ma][i*Mb]) ; 44. } 45. if(ans >= INF){ 46. cout << -1 << endl ; 47. }else{ 48. cout << ans << endl ; 49. } 50. 51.}
a.cc:2:1: error: expected unqualified-id before numeric constant 2 | 2.using namespace std; | ^~~~~~~ a.cc:3:1: error: expected unqualified-id before numeric constant 3 | 3.const int INF = 10000 ; | ^~~~~~~ a.cc:4:1: error: expected unqualified-id before numeric constant 4 | 4.int main(void){ | ^~~~~
s077912440
p03806
C++
#include <iostream> #include <vector> using namespace std; #define INF 1e9; int N,a,b,c,Ma,Mb; int dp[2][401][401]; int main(){ cin >> N >> Ma >> Mb; for(int k=0;k<2;++k) for(int i=0;i<=400;++i){ for(int j=0;j<=400;++j){ dp[k][i][j] = INF; } } dp[0][0][0] = dp[1][0][0] = 0; int cur = 1; while(N--){ cin >> a >> b >> c; for(int i=0;i<=400;++i){ for(int j=0;j<=400;++j){ if(i >= a && j >= b){ dp[cur][i][j] = min(dp[(cur+1)%2][i][j],dp[(cur+1)%2][i-a][j-b]+c); } } } ++cur; cur %= 2; } ++cur; cur%=2; int res = INF; for(int i=1;i*Ma<=400;++i){ if(i*Mb <= 400) res = min(res,dp[cur][i*Ma][i*Mb]); } if(res == INF) cout << -1 << endl; else cout << res << endl; }
a.cc: In function 'int main()': a.cc:36:22: error: expected primary-expression before ')' token 36 | if(res == INF) cout << -1 << endl; | ^
s435210359
p03806
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pp; void read(int& x){ scanf("%d",&x); } template<typename T,typename... Args> void read(T& a,Args&... b){ read(a); read(b...); } #define all(x) (x).begin(),(x).end() #define pb push_back const ll inf = (1ll<<60); int n, Ma, Mb; int a[50]; int b[50]; int c[50]; void in(){ read(n, Ma, Mb); for(int i=0; i<n; ++i) read(a[i], b[i], c[i]); } int hn; map<ll, ll> ml, mr; ll ans=inf; void dfs0(int p=0, int sa=0, int sb=0, int sc=0){ if(p == hn){ ll x=sb*1LL*Ma - sa*1LL*Mb; if(ml.find(x) == ml.end()) ml[x]=inf; ml[x]=min(ml[x], ll(sc)); if(sb*1LL*Ma == sa*1LL*Mb && sa){ ans=min(ans, sc); } return; } dfs0(p+1, sa, sb, sc); dfs0(p+1, sa+a[p], sb+b[p], sc+c[p]); } void dfs1(int p=hn, int sa=0, int sb=0, int sc=0){ if(p == n){ ll x=-(sb*1LL*Ma - sa*1LL*Mb); if(ml.find(x) != ml.end() && sc+ml[x]) ans=min(ans, sc+ml[x]); return; } dfs1(p+1, sa, sb, sc); dfs1(p+1, sa+a[p], sb+b[p], sc+c[p]); } int main() { in(); hn=n/2; dfs0(); dfs1(); if(ans == inf) ans=-1; printf("%lld\n", ans); return 0; }
a.cc: In function 'void dfs0(int, int, int, int)': a.cc:35:32: error: no matching function for call to 'min(ll&, int&)' 35 | ans=min(ans, sc); | ~~~^~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:35:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 35 | ans=min(ans, sc); | ~~~^~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:35:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 35 | ans=min(ans, sc); | ~~~^~~~~~~~~
s364507578
p03806
C++
<?php class main { function run () { fscanf(STDIN, "%d %d %d", $n, $ma, $mb); $drug = array(); for ($i = 0; $i < $n; $i++) { fscanf(STDIN, "%d %d %d", $a, $b, $c); $drug[$i]["a"] = $a; $drug[$i]["b"] = $b; $drug[$i]["c"] = $c; } $price_map = array(); $maxa = $n * 10; $maxb = $n * 10; $maxc = $n * 100; for ($i = 0; $i < $n; $i++) { for ($a = 0; $a < $maxa; $a++) { for ($b = 0; $b < $maxb; $b++) { $price_map[$i][$a][$b] = $maxc; } } } $price_map[0][0][0] = 0; for ($i = 0; $i < $n; $i++) { for ($a = 0; $a < $maxa; $a++) { for ($b = 0; $b < $maxb; $b++) { if ($price_map[$i][$a][$b] < $maxc) { $price_map[$i + 1][$a][$b] = $drug[$i]["c"]; $price_map[$i + 1][$a + $drug[$i]["a"]][$b + $drug[$i]["b"]] = $price_map[$i][$a][$b] + $drug[$i]["c"]; } } } } $min_c = $maxc; for ($i = 0; $i < $n; $i++) { for ($a = 0; $a < $maxa; $a++) { for ($b = 0; $b < $maxb; $b++) { if ($price_map[$i][$a][$b] < $maxc) { $min_c = $price_map[$i][$a][$b]; } } } } if ($min_c == $maxc) { echo "-1"; } else { echo $min_c; } } } $object = new main(); $object->run();
a.cc:1:1: error: expected unqualified-id before '<' token 1 | <?php | ^ a.cc:53:1: error: '$object' does not name a type 53 | $object = new main(); | ^~~~~~~ a.cc:54:1: error: '$object' does not name a type 54 | $object->run(); | ^~~~~~~
s268193632
p03806
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; struct node{ int a, b, c; }a[1000100]; int n, ma, mb; ll dp[60][500][500]; bool check(int cura, int curb){ if(cura == 0 && cura == curb){ return false; } return ma*curb == mb*cura; } ll cool(){ for(int i = 0;i<60;i+=1){ for(int j=0 ; j<500 ; j++){ for(int k=0 ; k<500 ; k++){ dp[i][j][k] = (ll)1e18; } } } for(int i = 0 ;i<n-1;i+=1) { for(int j = 0 ;j<500;j+=1){ for(int k = 0 ;k<500;k+=1){ dp[i+1][j][k] = min(dp[i+1][j][k],dp[i][j][k]); if(j + a[i].a < 499 && k + a[i].b < 499){ dp[i+1][j+a[i].a][k+a[i].b] = min(a[i].c + dp[i][j][k],dp[i+1][j+a[i].a][k+a[i].b]); } } } } ll ans = (ll)1e18; for(int j = 0;j<499;j+=1){ for(int k = 0;k<499;k+=1){ if(check(j,k)){ ans =min(ans,dp[n-1][j][k]); } } } return ans; //:) } int main(){ ios::sync_with_stdio(false); cin.tie(0); cin >> n >> ma >> mb; for(int i=0 ; i<n ; i++){ cin >> a[i].a >> a[i].b >> a[i].c; } memset(m, -1, sizeof(m)); ll r = cool(); if(r > (ll)1e12){ cout << "-1\n"; } else { cout << r; } return 0; }
a.cc: In function 'int main()': a.cc:67:16: error: 'm' was not declared in this scope; did you mean 'tm'? 67 | memset(m, -1, sizeof(m)); | ^ | tm
s786763299
p03806
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; struct node{ int a, b, c; }a[1000100]; int n, ma, mb; int m[60][510][510]; ll dp[60][500][500]; bool check(int cura, int curb){ if(cura == 0 && cura == curb){ return false; } return ma*curb == mb*cura; } ll cool(){ for(int i = 0;i<60;i+=1){ for(int j=0 ; j<500 ; j++){ for(int k=0 ; k<500 ; k++){ dp[i][j][k] = (ll)1e18; } } } for(int i = 0 ;i<n-1;i+=1) { for(int j = 0 ;j<500;j+=1) { for(int k = 0 ;k<500;k+=1){ dp[i+1][j][k] = min(dp[i+1][j][k],dp[i][j][k]); if(j + a[i].a < 499 && k + a[i].b < 499){ dp[i+1][j+a[i].a][k+a[i].b] = min(a[i].c + dp[i][j][k],dp[i+1][j+a[i].a][k+a[i].b]); } } } ll ans = (ll)1e18; for(int j = 0;j<499;j+=1) { for(int k = 0;k<499;k+=1) { if(check(j,k)) { ans =min(ans,dp[n-1][j][k]); } } } return ans; //:) } ll memo(int curr, int wa, int wb){ if(curr == n){ if(check(wa, wb)){ return 0; } else { return (ll)1e16; } } if(m[curr][wa][wb] != -1){ return m[curr][wa][wb]; } ll ans = (ll)1e18; ans = min(ans, a[curr].c + memo(curr+1, wa+a[curr].a, wb+a[curr].b)); ans = min(ans, memo(curr+1, wa, wb)); m[curr][wa][wb] = ans; return ans; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cin >> n >> ma >> mb; for(int i=0 ; i<n ; i++){ cin >> a[i].a >> a[i].b >> a[i].c; } memset(m, -1, sizeof(m)); //ll r = memo(0, 0, 0); ll r = cool(); if(r > (ll)1e12){ cout << "-1\n"; } else { cout << r; } return 0; }
a.cc: In function 'll cool()': a.cc:70:34: error: a function-definition is not allowed here before '{' token 70 | ll memo(int curr, int wa, int wb){ | ^ a.cc:88:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 88 | int main(){ | ^~ a.cc:88:9: note: remove parentheses to default-initialize a variable 88 | int main(){ | ^~ | -- a.cc:88:9: note: or replace parentheses with braces to value-initialize a variable a.cc:88:11: error: a function-definition is not allowed here before '{' token 88 | int main(){ | ^ a.cc:104:2: error: expected '}' at end of input 104 | } | ^ a.cc:23:10: note: to match this '{' 23 | ll cool(){ | ^ a.cc:104:2: warning: control reaches end of non-void function [-Wreturn-type] 104 | } | ^
s687919261
p03806
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; struct node{ int a, b, c; }a[1000100]; int n, ma, mb; int m[60][510][510]; ll dp[60][500][500]; bool check(int cura, int curb){ if(cura == 0 && cura == curb){ return false; } return ma*curb == mb*cura; } ll cool(){ for(int i = 0;i<60;i+=1){ for(int j=0 ; j<500 ; j++){ for(int k=0 ; k<500 ; k++){ dp[i][j][k] = (ll)1e18; } } } for(int i = 0 ;i<n-1;i+=1) { for(int j = 0 ;j<500;j+=1) { for(int k = 0 ;k<500;k+=1) dp[i+1][j][k] = min(dp[i+1][j][k],dp[i][j][k]); if(j + a[i].a < 499 && k + a[i].b < 499){ dp[i+1][j+a[i].a][k+a[i].b] = min(a[i].c + dp[i][j][k],dp[i+1][j+a[i].a][k+a[i].b]); } } } ll ans = (ll)1e18; for(int j = 0;j<499;j+=1) { for(int k = 0;k<499;k+=1) { if(check(j,k)) { ans =min(ans,dp[n-1][j][k]); } } } return ans; //:) } ll memo(int curr, int wa, int wb){ if(curr == n){ if(check(wa, wb)){ return 0; } else { return (ll)1e16; } } if(m[curr][wa][wb] != -1){ return m[curr][wa][wb]; } ll ans = (ll)1e18; ans = min(ans, a[curr].c + memo(curr+1, wa+a[curr].a, wb+a[curr].b)); ans = min(ans, memo(curr+1, wa, wb)); m[curr][wa][wb] = ans; return ans; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cin >> n >> ma >> mb; for(int i=0 ; i<n ; i++){ cin >> a[i].a >> a[i].b >> a[i].c; } memset(m, -1, sizeof(m)); //ll r = memo(0, 0, 0); ll r = cool(); if(r > (ll)1e12){ cout << "-1\n"; } else { cout << r; } return 0; }
a.cc: In function 'll cool()': a.cc:43:24: error: 'k' was not declared in this scope 43 | if(j + a[i].a < 499 && k + a[i].b < 499){ | ^
s626979775
p03806
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; struct node{ int a, b, c; }a[1000100]; int n, ma, mb; int m[60][510][510]; ll dp[60][500][500]; bool check(int cura, int curb){ if(cura == 0 && cura == curb){ return false; } return ma*curb == mb*cura; } ll cool(){ for(int i = 0;i<60;i+=1){ for(int j=0 ; j<500 ; j++){ for(int k=0 ; i<500 ; k++{ dp[i][j][k] = (ll)1e18; } } } for(int i = 0 ;i<n-1;i+=1) { for(int j = 0 ;j<500;j+=1) { for(int k = 0 ;k<500;k+=1) dp[i+1][j][k] = min(dp[i+1][j][k],dp[i][j][k]); if(j + a[i].a < 499 && k + a[i].b < 499){ dp[i+1][j+a[i].a][k+a[i].b] = min(a[i].c + dp[i][j][k],dp[i+1][j+a[i].a][k+a[i].b]); } } } ll ans = (ll)1e18; for(int j = 0;j<499;j+=1) { for(int k = 0;k<499;k+=1) { if(check(j,k)) { ans =min(ans,dp[n-1][j][k]); } } } return ans; //:) } ll memo(int curr, int wa, int wb){ if(curr == n){ if(check(wa, wb)){ return 0; } else { return (ll)1e16; } } if(m[curr][wa][wb] != -1){ return m[curr][wa][wb]; } ll ans = (ll)1e18; ans = min(ans, a[curr].c + memo(curr+1, wa+a[curr].a, wb+a[curr].b)); ans = min(ans, memo(curr+1, wa, wb)); m[curr][wa][wb] = ans; return ans; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cin >> n >> ma >> mb; for(int i=0 ; i<n ; i++){ cin >> a[i].a >> a[i].b >> a[i].c; } memset(m, -1, sizeof(m)); //ll r = memo(0, 0, 0); ll r = cool(); if(r > (ll)1e12){ cout << "-1\n"; } else { cout << r; } return 0; }
a.cc: In function 'll cool()': a.cc:27:50: error: expected ')' before '{' token 27 | for(int k=0 ; i<500 ; k++{ | ~ ^ | ) a.cc:43:24: error: 'k' was not declared in this scope 43 | if(j + a[i].a < 499 && k + a[i].b < 499){ | ^
s476648143
p03806
C++
#include<bits/stdc++.h> using namespace std; #define pb push_back #define ll long long #define int long long #define F first #define S second const ll INF = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000; const int inf = 1000 * 1000 * 1000; // Bedone harf ! const int N = 40, M = 10; int a[N], b[N], c[N]; int n, ma, mb, dp[N][N * M + 30][N * M + 30]; int32_t main(){ ios::sync_with_stdio(false);cin.tie(0); for(int z = 0; z <= n; z++) for(int i = 0; i <= N * M; i++) for(int j = 0; j <= N * M; j++) dp[z][i][j] = INF; dp[0][0][0] = 0; int n, ma, mb; cin >> n >> ma >> mb; for(int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i]; for(int i = 0; i < n; i++) for(int x = 0; x <= N * M; x++) for(int y = 0; y <= N * M; y++) if(dp[i][x][y] != INF){ dp[i + 1][x][y] = min(dp[i + 1][x][y], dp[i][x][y]); dp[i + 1][x + a[i]][y + b[i]] = min(dp[i + 1][x + a[i]][y + b[i]], dp[i][x][y] + c[i]); // ghalat nist ? :-? int ans = INF; for(int i = 1; i <= N * M; i++) for(int j = 1; j <= N * M; j++) if(ma * j == mb * i) ans = min(ans, dp[n][i][j]); if(ans == INF) cout << -1 << '\n'; else cout << ans << '\n'; return 0; }
a.cc: In function 'int32_t main()': a.cc:52:2: error: expected '}' at end of input 52 | } | ^ a.cc:20:15: note: to match this '{' 20 | int32_t main(){ | ^
s663995318
p03806
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int ratioA = sc.nextInt(); int ratioB = sc.nextInt(); int[] a = new int[N]; int[] b = new int[N]; int[] c = new int[N]; int sumA = 0; int sumB = 0; for(int i = 0; i < N; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt(); c[i] = sc.nextInt(); sumA += a[i]; sumB += b[i]; } int[][][] dp = new int[401][401][N]; for(int i = 0; i < N; i++) { for(int j = 0; j < 401; j++) { for(int k = 0; k < 401; k++) { dp[j][k][i] = -1; } } } dp[a[0]][b[0]][0] = c[0]; for(int i = 1; i < N; i++) { for(int j = 0; j < 401; j++) { for(int k = 0; k < 401; k++) { if(a[i] <= j && b[i] <= k) { int m = Integer.MAX_VALUE; if(a[i] == j && b[i] == k) { m = c[i]; } else { if(dp[j - a[i]][k - b[i]][i - 1] != -1) m = c[i] + dp[j - a[i]][k - b[i]][i - 1]; } if(dp[j][k][i - 1] == -1) { if(m == Integer.MAX_VALUE) { dp[j][k][i] = -1; } else { dp[j][k][i] = m; } } else { dp[j][k][i] = Math.min(m, dp[j][k][i - 1]); } } else { dp[j][k][i] = dp[j][k][i - 1]; } } } } int cost = Integer.MAX_VALUE; for(int i = 1; i <= Math.min(sumA / ratioA, sumB / ratioB); i++) { if(dp[ratioA * i][ratioB * i][N - 1] != -1) { cost = Math.min(cost, dp[ratioA * i][ratioB * i]); } } int res = ""; if(cost != Integer.MAX_VALUE) { res = cost; } else { res = -1; } System.out.println(res); } }
Main.java:58: error: no suitable method found for min(int,int[]) cost = Math.min(cost, dp[ratioA * i][ratioB * i]); ^ method Math.min(int,int) is not applicable (argument mismatch; int[] cannot be converted to int) method Math.min(long,long) is not applicable (argument mismatch; int[] cannot be converted to long) method Math.min(float,float) is not applicable (argument mismatch; int[] cannot be converted to float) method Math.min(double,double) is not applicable (argument mismatch; int[] cannot be converted to double) Main.java:61: error: incompatible types: String cannot be converted to int int res = ""; ^ 2 errors
s984698323
p03806
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int ratioA = sc.nextInt(); int ratioB = sc.nextInt(); int[] a = new int[N]; int[] b = new int[N]; int[] c = new int[N]; int sumA = 0; int sumB = 0; for(int i = 0; i < N; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt(); c[i] = sc.nextInt(); sumA += a[i]; sumB += b[i]; } int[][][] dp = new int[401][401][N]; for(int i = 0; i < N; i++) { for(int j = 0; j < 401; j++) { for(int k = 0; k < 401; k++) { dp[j][k][i] = -1; } } } dp[a[0]][b[0]][0] = c[0]; for(int i = 1; i < N; i++) { for(int j = 0; j < 401; j++) { for(int k = 0; k < 401; k++) { if(a[i] <= j && b[i] <= k) { int m = Integer.MAX_VALUE; if(a[i] == j && b[i] == k) { m = c[i]; } else { if(dp[j - a[i]][k - b[i]] != -1) m = c[i] + dp[j - a[i]][k - b[i]]; } if(dp[j][k][i - 1] == -1) { if(m == Integer.MAX_VALUE) { dp[j][k][i] = -1; } else { dp[j][k][i] = m; } } else { dp[j][k][i] = Math.min(m, dp[j][k][i - 1]); } } else { dp[j][k][i] = dp[j][k][i - 1]; } } } } int cost = Integer.MAX_VALUE; for(int i = 1; i <= Math.min(sumA / ratioA, sumB / ratioB); i++) { if(dp[ratioA * i][ratioB * i] != -1) { cost = Math.min(cost, dp[ratioA * i][ratioB * i]); } } int res = ""; if(cost != Integer.MAX_VALUE) { res = cost; } else { res = -1; } System.out.println(res); } }
Main.java:38: error: bad operand types for binary operator '!=' if(dp[j - a[i]][k - b[i]] != -1) m = c[i] + dp[j - a[i]][k - b[i]]; ^ first type: int[] second type: int Main.java:38: error: bad operand types for binary operator '+' if(dp[j - a[i]][k - b[i]] != -1) m = c[i] + dp[j - a[i]][k - b[i]]; ^ first type: int second type: int[] Main.java:57: error: bad operand types for binary operator '!=' if(dp[ratioA * i][ratioB * i] != -1) { ^ first type: int[] second type: int Main.java:58: error: no suitable method found for min(int,int[]) cost = Math.min(cost, dp[ratioA * i][ratioB * i]); ^ method Math.min(int,int) is not applicable (argument mismatch; int[] cannot be converted to int) method Math.min(long,long) is not applicable (argument mismatch; int[] cannot be converted to long) method Math.min(float,float) is not applicable (argument mismatch; int[] cannot be converted to float) method Math.min(double,double) is not applicable (argument mismatch; int[] cannot be converted to double) Main.java:61: error: incompatible types: String cannot be converted to int int res = ""; ^ 5 errors
s560782044
p03806
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int ratioA = sc.nextInt(); int ratioB = sc.nextInt(); int[] a = new int[N]; int[] b = new int[N]; int[] c = new int[N]; int sumA = 0; int sumB = 0; for(int i = 0; i < N; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt(); c[i] = sc.nextInt(); sumA += a[i]; sumB += b[i]; } int[][][] dp = new int[401][401][N]; for(int i = 0; i < N; i++) { for(int j = 0; j < 401; j++) { for(int k = 0; k < 401; k++) { dp[j][k][i] = -1; } } } dp[a[0]][b[0]][0] = c[0]; for(int i = 1; i < N; i++) { for(int j = 0; j < 401; j++) { for(int k = 0; k < 401; k++) { if(a[i] <= j && b[i] <= k) { int a = Integer.MAX_VALUE; if(a[i] == j && b[i] == k) { a = c[i]; } else { if(dp[j - a[i]][k - b[i]] != -1) a = c[i] + dp[j - a[i]][k - b[i]]; } if(dp[j][k][i - 1] == -1) { if(a == Integer.MAX_VALUE) { dp[j][k][i] = -1; } else { dp[j][k][i] = a; } } else { dp[j][k][i] = Math.min(a, dp[j][k][i - 1]); } } else { dp[j][k][i] = dp[j][k][i - 1]; } } } } int cost = Integer.MAX_VALUE; for(int i = 1; i <= Math.min(sumA / ratioA, sumB / ratioB); i++) { if(dp[ratioA * i][ratioB * i] != -1) { cost = Math.min(cost, dp[ratioA * i][ratioB * i]); } } int res = ""; if(cost != Integer.MAX_VALUE) { res = cost; } else { res = -1; } System.out.println(res); } }
Main.java:34: error: variable a is already defined in method main(String[]) int a = Integer.MAX_VALUE; ^ Main.java:35: error: array required, but int found if(a[i] == j && b[i] == k) { ^ Main.java:38: error: array required, but int found if(dp[j - a[i]][k - b[i]] != -1) a = c[i] + dp[j - a[i]][k - b[i]]; ^ Main.java:38: error: bad operand types for binary operator '!=' if(dp[j - a[i]][k - b[i]] != -1) a = c[i] + dp[j - a[i]][k - b[i]]; ^ first type: int[] second type: int Main.java:38: error: array required, but int found if(dp[j - a[i]][k - b[i]] != -1) a = c[i] + dp[j - a[i]][k - b[i]]; ^ Main.java:38: error: bad operand types for binary operator '+' if(dp[j - a[i]][k - b[i]] != -1) a = c[i] + dp[j - a[i]][k - b[i]]; ^ first type: int second type: int[] Main.java:57: error: bad operand types for binary operator '!=' if(dp[ratioA * i][ratioB * i] != -1) { ^ first type: int[] second type: int Main.java:58: error: no suitable method found for min(int,int[]) cost = Math.min(cost, dp[ratioA * i][ratioB * i]); ^ method Math.min(int,int) is not applicable (argument mismatch; int[] cannot be converted to int) method Math.min(long,long) is not applicable (argument mismatch; int[] cannot be converted to long) method Math.min(float,float) is not applicable (argument mismatch; int[] cannot be converted to float) method Math.min(double,double) is not applicable (argument mismatch; int[] cannot be converted to double) Main.java:61: error: incompatible types: String cannot be converted to int int res = ""; ^ 9 errors
s772205336
p03806
C++
#include <iostream> using namespace std; int n, a, b, ans = 1e9; int A[100], B[100], C[100]; int dp[555][555]; int main() { cin >> n >> a >> b; double d = a/b; for(int i=1; i <= n; i++) cin >> A[i] >> B[i] >> C[i]; for(int i=0; i <= 400; i++) for(int h=0; h <= 400; h++) dp[i][h] = 1e9; dp[0][0] = 0; for(int i=1; i <= n; i++) for(int h=400; h >= 0; h--) for(int j=400; j >= 0; j--) if(dp[h][j] != 1e9) { int x = h+A[i]; int y = j+B[i]; if(dp[x][y] > dp[h][j]+C[i]) dp[x][y] = dp[h][j]+C[i]; } for(int i=1; i <= 400; i++) if (x*i <= 400 && y*i <= 400) ans = min(ans, cp[x*i][y*i]); if(ans == 1e9) ans = -1; cout << ans; }
a.cc: In function 'int main()': a.cc:33:21: error: 'x' was not declared in this scope 33 | if (x*i <= 400 && y*i <= 400) | ^ a.cc:33:35: error: 'y' was not declared in this scope 33 | if (x*i <= 400 && y*i <= 400) | ^ a.cc:34:32: error: 'cp' was not declared in this scope; did you mean 'dp'? 34 | ans = min(ans, cp[x*i][y*i]); | ^~ | dp
s880875574
p03806
C++
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define MOD 1000000007 #define rep(i,n) for(i=0;i<n;i++) #define loop(i,a,n) for(i=a;i<n;i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) typedef vector<int> vi; typedef pair<int,int> pii; int main(void) { int i,j,k; int n,ma,mb; cin>>n>>ma>>mb; ll dp[2][405][405]; rep(i,2)rep(j,405)rep(k,405) dp[i][j][k]=INF; dp[0][0][0]=0; rep(i,n){ int a,b,c; cin>>a>>b>>c; rep(j,405)rep(k,405) if(dp[i%2][j][k]<INF){ dp[(i+1)%2][j][k]=dp[i%2][j][k]; if(j+a<405 && k+b<405) dp[(i+1)%2][j+a][k+b]=min(dp[(i+1)%2][j+a][k+b],dp[i%2][j][k]+c); dp[i%2][j][k]=INF; } } int ans=INF; for(i=1;i*max(ma,mb)<405;i++) ans=min(ans,dp[n%2][i*ma][i*mb]); if(ans<INF) cout<<ans<<endl; else cout<<-1<<endl; }
a.cc: In function 'int main()': a.cc:55:12: error: no matching function for call to 'min(int&, long long int&)' 55 | ans=min(ans,dp[n%2][i*ma][i*mb]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:55:12: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 55 | ans=min(ans,dp[n%2][i*ma][i*mb]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:55:12: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 55 | ans=min(ans,dp[n%2][i*ma][i*mb]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
s284777780
p03806
C++
#include<iostream> using namespace std; int N, A, B; int a[50], b[50], c[50]; const int inf=1001001; int memo[41][401][401]; int rec(int i, int _a, int _b){ if(memo[i][_a][_b]!=inf) return memo[i][_a][_b]; if(_a==0&&_b==0) return 0; if(i==N) return inf; int ret=inf; ret=min(ret, rec(i+1, _a, _b)); if(_a-a[i]>=0&&_b-b[i]>=0) ret=min(ret, rec(i+1, _a-a[i], _b-b[i])+c[i]); return memo[i][_a][_b]=ret; } int main(){ cin>> N>> A>> B; int x=0, y=0; for(int i=0; i<N; i++){ cin>> a[i]>> b[i]>> c[i]; x+=a[i]; y+=b[i]; } for(int i=0; i<41; i++){ for(int j=0; j<401; j++){ for(int k=0; k<401; k++){ memo[i][j][k]=inf; } } } int mi=inf; for(int k=1; max(k*A, k*B)<=40*10; k++){ if(k*A>x||b*A>y) continue; mi=min(mi, rec(0, k*A, k*B)); } if(mi==inf){ cout<< -1<< endl; }else{ cout<< mi<< endl; } return 0; }
a.cc: In function 'int main()': a.cc:39:18: error: invalid operands of types 'int [50]' and 'int' to binary 'operator*' 39 | if(k*A>x||b*A>y) continue; | ~^~ | | | | | int | int [50]
s488323809
p03806
C++
#include<bits/stdc++.h> using namespace std; int n,ma,mb; int a[40],b[40],c[40]; map<pair<int,int>,int> min_cost; void res(int cur,pair<int,int> m,int used[]){ //for(int i=0; i<n; i++)cout<<used[i]<<' ';cout<<endl; if(min_cost[make_pair(m.first,m.second)]==0){ min_cost[make_pair(m.first,m.second)]=cur; //cout<<'a'<<endl; } else if(min_cost[make_pair(m.first,m.second)]>cur){ min_cost[make_pair(m.first,m.second)]=cur; }else{ //cout<<'b'<<endl; return; } for(int i=0; i<n; i++){ if(!used[i]){ used[i]=true; res(cur+c[i],make_pair(m.first+a[i],m.second+b[i]),used); used[i]=false; } } } int main(){ cin>>n>>ma>>mb; int used[n];for(int i=0; i<n; i++)used[i]=0; for(int i=0; i<n; i++){ int in1,in2,in3; cin>>in1>>in2>>in3; a[i]=in1;b[i]=in2;c[i]=in3; } res(0,make_pair(0,0),used); bool flag=true; for(int i=1; i<401; i++){ if(min_cost[make_pair(ma*i,mb*i)]!=0){ flag=false; cout<<min_cost[make_pair(ma*i,mb*i)]<<endl; break; } } if(flag){ cout<<-1<<endl; return; } //cout<<min_cost[make_pair(3,3)]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:49:9: error: return-statement with no value, in function returning 'int' [-fpermissive] 49 | return; | ^~~~~~
s215517179
p03806
C++
#include<iostream> #include<vector> #include<string> using namespace std; #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++) #define rep(i,n) FOR((i),0,(n)) typedef long long ll; const int INF=1e9+7; const int MAX_N=43; int a[MAX_N],b[MAX_N],c[MAX_N]; int dp[450][450][43]; int main(){ rep(i,450)rep(j,450)rep(k,43)dp[i][j][k]=INF; int n,m_a,m_b; cin>>n>>m_a>>m_b; rep(i,n)cin>>a[i]>>b[i]>>c[i]; dp[0][0][0]=0; rep(l,n){ rep(i,400)rep(j,400){dp[i][j][l+1]=min(dp[i][j][l+1];dp[i][j][l]),dp[i+a[l]][j+b[l]][l+1]=min(dp[i+a[l]][j+b[l]][l],dp[i][j][l]+c[l])}} } int ans=INF; for(int i=1;i*(max(m_a,m_b))<450;i++){ ans=min(ans,dp[i*m_a][i*m_b][n]); } rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]); if(ans==INF)ans=-1; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:22:53: error: expected ')' before ';' token 22 | rep(i,400)rep(j,400){dp[i][j][l+1]=min(dp[i][j][l+1];dp[i][j][l]),dp[i+a[l]][j+b[l]][l+1]=min(dp[i+a[l]][j+b[l]][l],dp[i][j][l]+c[l])}} | ~ ^ | ) a.cc:22:65: error: expected ';' before ')' token 22 | rep(i,400)rep(j,400){dp[i][j][l+1]=min(dp[i][j][l+1];dp[i][j][l]),dp[i+a[l]][j+b[l]][l+1]=min(dp[i+a[l]][j+b[l]][l],dp[i][j][l]+c[l])}} | ^ | ; a.cc: At global scope: a.cc:25:9: error: expected unqualified-id before 'for' 25 | for(int i=1;i*(max(m_a,m_b))<450;i++){ | ^~~ a.cc:25:21: error: 'i' does not name a type 25 | for(int i=1;i*(max(m_a,m_b))<450;i++){ | ^ a.cc:25:42: error: 'i' does not name a type 25 | for(int i=1;i*(max(m_a,m_b))<450;i++){ | ^ a.cc:6:20: error: expected unqualified-id before 'for' 6 | #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++) | ^~~ a.cc:7:18: note: in expansion of macro 'FOR' 7 | #define rep(i,n) FOR((i),0,(n)) | ^~~ a.cc:28:9: note: in expansion of macro 'rep' 28 | rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]); | ^~~ a.cc:6:39: error: expected constructor, destructor, or type conversion before '<' token 6 | #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++) | ^ a.cc:7:18: note: in expansion of macro 'FOR' 7 | #define rep(i,n) FOR((i),0,(n)) | ^~~ a.cc:28:9: note: in expansion of macro 'rep' 28 | rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]); | ^~~ a.cc:6:47: error: expected constructor, destructor, or type conversion before '++' token 6 | #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++) | ^~ a.cc:7:18: note: in expansion of macro 'FOR' 7 | #define rep(i,n) FOR((i),0,(n)) | ^~~ a.cc:28:9: note: in expansion of macro 'rep' 28 | rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]); | ^~~ a.cc:6:39: error: expected constructor, destructor, or type conversion before '<' token 6 | #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++) | ^ a.cc:7:18: note: in expansion of macro 'FOR' 7 | #define rep(i,n) FOR((i),0,(n)) | ^~~ a.cc:28:19: note: in expansion of macro 'rep' 28 | rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]); | ^~~ a.cc:6:47: error: expected constructor, destructor, or type conversion before '++' token 6 | #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++) | ^~ a.cc:7:18: note: in expansion of macro 'FOR' 7 | #define rep(i,n) FOR((i),0,(n)) | ^~~ a.cc:28:19: note: in expansion of macro 'rep' 28 | rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]); | ^~~ a.cc:29:9: error: expected unqualified-id before 'if' 29 | if(ans==INF)ans=-1; | ^~ a.cc:30:9: error: 'cout' does not name a type 30 | cout<<ans<<endl; | ^~~~ a.cc:31:1: error: expected declaration before '}' token 31 | } | ^
s823582356
p03806
C++
#include<iostream> #include<vector> #include<string> using namespace std; #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++) #define rep(i,n) FOR((i),0,(n)) typedef long long ll; const int INF=1e9+7; const int MAX_N=43; int a[MAX_N],b[MAX_N],c[MAX_N]; int dp[450][450][43]; int main(){ rep(i,450)rep(j,450)rep(k,43)dp[i][j][k]=INF; int n,m_a,m_b; cin>>n>>m_a>>m_b; rep(i,n)cin>>a[i]>>b[i]>>c[i]; dp[0][0][0]=0; rep(l,n){ rep(i,400){rep(j,400){dp[i][j][l+1]=min(dp[i][j][l+1],dp[i][j][l]),dp[i+a[l]][j+b[l]][l+1]=min(dp[i+a[l]][j+b[l]][l],dp[i][j][l]+c[l])}}; } int ans=INF; for(int i=1;i*(max(m_a,m_b))<450;i++){ ans=min(ans,dp[i*m_a][i*m_b][n]); } rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]); if(ans==INF)ans=-1; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:22:151: error: expected ';' before '}' token 22 | rep(i,400){rep(j,400){dp[i][j][l+1]=min(dp[i][j][l+1],dp[i][j][l]),dp[i+a[l]][j+b[l]][l+1]=min(dp[i+a[l]][j+b[l]][l],dp[i][j][l]+c[l])}}; | ^ | ;
s338296782
p03806
C++
#include <iostream> #include <iomanip> #include <string> #include <vector> #include <queue> #include <algorithm> #include <utility> #include <cmath> #include <bitset> #include <map> #include <cstring> #include <cstdlib> #define INF_LL 9000000000000000000 #define INF 2000000000 #define REP(i, n) for(int i = 0;i < (n);i++) #define FOR(i, a, b) for(int i = (a);i < (b);i++) using namespace std; typedef long long ll; typedef pair<int, int> PII; class Union_find{ private: vector<int> par; vector<int> rank; int n; public: Union_find(int a){ n = a; for(int i = 0;i < n;i++){ par.push_back(i); rank.push_back(0); } } int find(int x){ if(par[x] == x){ return x; }else{ return par[x] = find(par[x]); } } void unite(int x, int y){ x = find(x); y = find(y); if(x == y) return; if(rank[x] < rank[y]){ par[x] = y; }else{ par[y] = x; if(rank[x] == rank[y]) rank[x]++; } } bool same(int x, int y){ return find(x) == find(y); } }; int flag[10] = {}; int N, M; vector<int> G[9]; int dfs(int x, int be, int cnt){ if(cnt == N) return 1; ll res = 0; REP(i, G[x].size()){ if(flag[G[x][i]]) continue; flag[G[x][i]] = true; res += dfs(G[x][i], x, cnt+1); flag[G[x][i]] = false; } return res; } int dp[41][401][401]; int main(void){ int N, Ma, Mb; int a[41], b[41], c[41]; REP(i, 41) REP(j, 401) REP(k, 401) dp[i][j][k] = INF; cin >> N >> Ma >> Mb; REP(i, N){ cin >> a[i] >> b[i] >> c[i]; } dp[0][0][0] = 0; REP(i, N){ REP(j, N*10+1){ REP(k, N*10+1){ if(j >= a[i] && k >= b[i]) dp[i+1][j][k] = min(dp[i][j][k], dp[i][j-a[i]][k-b[i]]+c[i]); } } } int res = INF; REP(k, N+1){ REP(i, N*10+1){ REP(j, N*10+1){ if(dp[N][i][j] != INF dp[N][i][j] != 0 && i*Mb - j*Ma == 0){ res = min(res, dp[k][i][j]); } } } } if(res == INF) cout << -1 << endl; else cout << res << endl; }
a.cc: In function 'int main()': a.cc:106:47: error: expected ')' before 'dp' 106 | if(dp[N][i][j] != INF dp[N][i][j] != 0 && i*Mb - j*Ma == 0){ | ~ ^~
s588786102
p03806
Java
import java.util.*; import java.io.*; public class Coin { static int n; static int m1,m2; static final long INF=1000000000000000000L; static long min=INF; static int[] a; static int[] b; static int[] c; static long[][][] dp=new long[41][401][401]; public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st=new StringTokenizer(br.readLine()); n=Integer.parseInt(st.nextToken()); m1=Integer.parseInt(st.nextToken()); m2=Integer.parseInt(st.nextToken()); a=new int[n]; b=new int[n]; c=new int[n]; for(int i=0;i<n;i++){ st=new StringTokenizer(br.readLine()); a[i]=Integer.parseInt(st.nextToken()); b[i]=Integer.parseInt(st.nextToken()); c[i]=Integer.parseInt(st.nextToken()); } long sum=dfs(0,0,0); System.out.println(sum==INF ? -1:sum); } static long dfs(int index,int c_a,int c_b){ long ret; if(dp[index][c_a][c_b]!=0){ ret=dp[index][c_a][c_b]; } else if(index==n){ ret= INF; } else if((c_b!=0 && c_a!=0)&& (long)m1*c_b==(long)m2*c_a){ ret= 0; } else{ ret=Math.min(dfs(index+1,c_a+a[index],c_b+b[index])+c[index],dfs(index+1,c_a,c_b)); } dp[index][c_a][c_b]=ret; return ret; } }
Main.java:4: error: class Coin is public, should be declared in a file named Coin.java public class Coin { ^ 1 error
s822605146
p03806
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; int main() { int n, ma, mb; cin >> n >> ma >> mb; int a[n], b[n], c[n]; for(int i = 0; i < n; i++){ cin >> a[i] >> b[i] >> c[i]; } int is_ok = false; int min = 5000; for (int i = 0; i < n; i++) { int suma = 0, sumb = 0, sumc = 0; for (int j = i; j < n; j++) { suma += a[j]; sumb += b[j]; sumc += c[j]; if (suma * mb == sumb * ma) { if (min > sumc) { min = sumc; is_ok = true; } } } if (is_ok) { break; } } if (is_ok) { cout << min << endl; } else { cout << -1 << endl; } return 0;
a.cc: In function 'int main()': a.cc:42:14: error: expected '}' at end of input 42 | return 0; | ^ a.cc:7:12: note: to match this '{' 7 | int main() { | ^
s728833515
p03806
C++
#include <iostream> #include <algorithm> #include <cmath> #include <string> #include <array> #include <vector> #include <functional> using namespace std; int main(void) { double N, Ma, Mb, i, j, count = 0; vector<double> a(N); vector<double> b(N); vector<int> c(N); cin >> N >> Ma >> Mb; for (i = 0; i < N; i++) { cin >> a[i] >> b[i] >> c[i]; } for (i = 0; i < N; i++) { for (j = 0; j < N; j++) { if ((a[i] + a[j]) / (b[i] + a[j]) == Ma / Mb) { count = max(count, c[i] + c[j]); } } } if (count > 0) { cout << count << endl; } else { cout << -1 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:23:44: error: no matching function for call to 'max(double&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 23 | count = max(count, c[i] + c[j]); | ~~~^~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:23:44: note: deduced conflicting types for parameter 'const _Tp' ('double' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 23 | count = max(count, c[i] + c[j]); | ~~~^~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:23:44: note: mismatched types 'std::initializer_list<_Tp>' and 'double' 23 | count = max(count, c[i] + c[j]); | ~~~^~~~~~~~~~~~~~~~~~~~
s879442091
p03806
C++
// // Created by tattsun on 2017/02/11. // #include <iostream> #include <vector> #include <algorithm> #define DRUGS_NUM_MAX 40 #define TOTAL_COST_MAX DRUGS_NUM_MAX * 1000 using namespace std; struct Drug { int a; int b; int cost; }; int n; int ma; int mb; Drug drugs[DRUGS_NUM_MAX]; int min(int a, int b) { if(a < b) return a; return b; } int gcd(int a, int b) { while(a != b) { if(a < b) b -= a; else a -= b; } return a; } int total_cost(vector<bool>& used_drugs) { int c = 0; for(int i=0; i<n; i++) { if(used_drugs[i]) c += drugs[i].cost; } return c; } bool is_achieved(vector<bool>& used_drugs) { int a = 0, b = 0; for(int i=0; i<n; i++) { if(used_drugs[i]) { a += drugs[i].a; b += drugs[i].b; } } int g = gcd(a, b); a = a / g; b = b / g; return a == ma && b == mb; } vector<vector<bool>> dp; vector<int> cost; int _solve(int d, vector<bool>& used_drugs) { used_drugs[d] = true; for(int i=0; i<dp.size(); i++) { bool ok = true; for(int j=0; j < dp[i].size(); j++) { if(dp[i][j] != used_drugs[j]) { ok = false; } } if(ok) return cost[i]; } int min_cost = TOTAL_COST_MAX; if(is_achieved(used_drugs)) min_cost = total_cost(used_drugs); for(int i=0; i<n; i++) { if(used_drugs[i] == true) { continue; } int c = _solve(i, used_drugs); if(c == -1) continue; min_cost = min(min_cost, c); } used_drugs[d] = false; dp.push_back(used_drugs); dp.push_back(cost); if(min_cost == TOTAL_COST_MAX) return -1; else return min_cost; } int solve() { vector<bool> used_drugs; for(int i=0; i<n; i++) { used_drugs.push_back(false); } int min_cost = TOTAL_COST_MAX; for(int i=0; i<n; i++) { int c = _solve(i, used_drugs); min_cost = min(min_cost, c); } if(min_cost == TOTAL_COST_MAX) return -1; return min_cost; } int main() { cin >> n >> ma >> mb; int g = gcd(ma, mb); ma = ma / g; mb = mb / g; int a, b, cost; for(int i=0; i<n; i++) { cin >> a >> b >> cost; drugs[i].a = a; drugs[i].b = b; drugs[i].cost = cost; } cout << solve() << endl; }
a.cc: In function 'int _solve(int, std::vector<bool>&)': a.cc:94:17: error: no matching function for call to 'std::vector<std::vector<bool> >::push_back(std::vector<int>&)' 94 | dp.push_back(cost); | ~~~~~~~~~~~~^~~~~~ In file included from /usr/include/c++/14/vector:66, from a.cc:6: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; value_type = std::vector<bool>]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<std::vector<bool> >::value_type&' {aka 'const std::vector<bool>&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >; value_type = std::vector<bool>]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<std::vector<bool> >::value_type&&' {aka 'std::vector<bool>&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~
s786836506
p03806
C++
#include <iostream> #include <string> #include <vector> #include <cmath> #include <algorithm> #include <cstdlib> #include <ctime> #include <cstdio> #include <functional> #include <set> #include <sstream> #include <cctype> #include <stack> #include <queue> #include <cstring> #include <map> #include <list> #include <cassert> using namespace std; int gcd(int x,int y){ return y==0?x:gcd(y,x%y); } int dp[41][401][401]; int main(){ int n,ma,mb; cin>>n>>ma>>mb; vector<int> a(n),b(n),c(n); for(int i=0;i<40;i++){ for(int j=0;j<401;j++){ for(int k=0;k<401;k++) dp[i][j][k]=1e8; } } for(int j=0;j<401;j++){ for(int k=0;k<401;k++) dp[0][j][k]=0; } for(int i=0;i<n;i++){ cin>>a[i]>>b[i]>>c[i]; int g=gcd(a[i],b[i]); a[i]/=g,b[i]/=g; } for(int i=0;i<n;i++){ for(int j=0;j<=400;j++){ for(int k=0;k<=400;k++){ if(j-a[i]>=0 && k-b[i]>=0){ int g=gcd(j,k); int j2=j/g,k2=k/g; g=gcd(j-a[i],k-b[i]); dp[i+1][j2][k2]=min(dp[i+1][j2][k2],dp[i][(j-a[i])/g][(k-b[i])/g]+c[i]); }else{ dp[i+1][j2][k2]=dp[i][j][k]; } } } } int res=1e8; for(int i=1;i<=100;i++){ res=min(res,dp[n][i*ma][i*mb]); } if(res==1e8) res=-1; cout<<res<<endl; }
a.cc: In function 'int main()': a.cc:60:49: error: 'j2' was not declared in this scope; did you mean 'j'? 60 | dp[i+1][j2][k2]=dp[i][j][k]; | ^~ | j a.cc:60:53: error: 'k2' was not declared in this scope; did you mean 'k'? 60 | dp[i+1][j2][k2]=dp[i][j][k]; | ^~ | k
s962405008
p03806
C++
#include <iostream> using namespace std; int main(){ int n, ma, mb; cin >> n >> ma >> mb; int a[n], b[n], c[n]; for(int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i]; int minic = 1e9; for(int i = 1; i < (1 << n); i++){ int suma = 0, sumb = 0, sumc = 0, ii = i, count = 0; while(ii){ if(ii & 1){ suma += a[count]; sumb += b[count]; sumc += c[count]; } ii >>= 1; count++; } if(suma % ma == 0 && sumb % mb == 0 && ma * b == mb * a){ minic = min(minic, sumc); } } cout << (minic == 1e9 ? -1 : minic) << endl; }
a.cc: In function 'int main()': a.cc:21:59: error: invalid operands of types 'int' and 'int [n]' to binary 'operator*' 21 | if(suma % ma == 0 && sumb % mb == 0 && ma * b == mb * a){ | ~~ ^ ~ | | | | int int [n] a.cc:21:69: error: invalid operands of types 'int' and 'int [n]' to binary 'operator*' 21 | if(suma % ma == 0 && sumb % mb == 0 && ma * b == mb * a){ | ~~ ^ ~ | | | | int int [n]
s434415909
p03806
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); long N = Integer.parseInt(sc.next()); int Ma = Integer.parseInt(sc.next()); int Mb = Integer.parseInt(sc.next()); int[][] abc = new int[N][2]; int a; int b; int c; int answer=-1; for(int i = 0;i<N;i++){ abc[i][0]=Integer.parseInt(sc.next()); abc[i][1]=Integer.parseInt(sc.next()); abc[i][2]=Integer.parseInt(sc.next()); } for(long i = 1;i<(1+2^N);i++){ a=0;b=0;c=0; for(int j = 0;j<N;j++){ if(((i-(i/(2^j))*(2^j))/(2^(j-1)))==0){ a=a+abc[j][0]; b=b+abc[j][1]; c=c+abc[j][2]; } } if((Ma*b-Mb*a)==0){ if(answer==-1){ answer=c; } else{ answer=Math.min(answer, c); } } } System.out.println(answer); sc.close(); } //private static final int imax = 110; }
Main.java:11: error: incompatible types: possible lossy conversion from long to int int[][] abc = new int[N][2]; ^ 1 error
s364655194
p03806
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); long N = Integer.parseInt(sc.next()); int Ma = Integer.parseInt(sc.next()); int Mb = Integer.parseInt(sc.next()); int[][] abc; int a; int b; int c; int answer=-1; for(int i = 0;i<N;i++){ abc[i][0]=Integer.parseInt(sc.next()); abc[i][1]=Integer.parseInt(sc.next()); abc[i][2]=Integer.parseInt(sc.next()); } for(long i = 1;i<(1+2^N);i++){ a=0;b=0;c=0; for(int j = 0;j<N;j++){ if(((i-(i/(2^j))*(2^j))/(2^(j-1)))==0){ a=a+abc[j][0]; b=b+abc[j][1]; c=c+abc[j][2]; } } if((Ma*b-Mb*a)==0){ if(answer==-1){ answer=c; } else{ answer=Math.min(answer, c); } } } System.out.println(answer); sc.close(); } //private static final int imax = 110; }
Main.java:17: error: variable abc might not have been initialized abc[i][0]=Integer.parseInt(sc.next()); ^ Main.java:25: error: variable abc might not have been initialized a=a+abc[j][0]; ^ 2 errors
s353118678
p03806
C++
#include <iostream> using namespace std; int n,ma,mb; int m; int flag; int a[40]; int b[40]; int c[40]; void saiki(int k,int A,int B,int C) { int w=0; A += a[k]; B += b[k]; C += c[k]; //cerr << C << endl; if(A%ma==0&&(w=A/ma)) { if(B==mb*w) { if(min>C) { flag=1; min = C; } } } for(int i=k+1;i<n;i++) { saiki(i,A,B,C); } return; } int main() { m = 1000000; flag = 0; cin >> n>>ma>>mb; for(int i=0;i<n;i++) { cin >>a[i]>>b[i]>>c[i]; } for(int i=0;i<n;i++) { saiki(0,0,0,0); } if(flag==1) { cout << min << endl; }else{ cout << -1 <<endl; } return 0; }
a.cc: In function 'void saiki(int, int, int, int)': a.cc:23:31: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>' 23 | if(min>C) | ~~~^~ a.cc:26:39: error: overloaded function with no contextual type information 26 | min = C; | ^ a.cc: In function 'int main()': a.cc:51:22: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 51 | cout << min << endl; | ~~~~~^~~~~~ In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::_
s487865505
p03806
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); long N = Integer.parseInt(sc.next()); int Ma = Integer.parseInt(sc.next()); int Mb = Integer.parseInt(sc.next()); int[][] abc; int a; int b; int c; int answer=-1; for(int i = 0;i<N;i++){ abc[i][0]=Integer.parseInt(sc.next()); abc[i][1]=Integer.parseInt(sc.next()); abc[i][2]=Integer.parseInt(sc.next()); } for(long i = 1;i<(1+2^N);i++){ a=0;b=0;c=0; for(int j = 0;j<N;j++){ if(((i-(i/(2^j))*(2^j))/(2^(j-1)))==0){ a=a+abc[i][0]; b=b+abc[i][1]; c=c+abc[i][2]; } } if((Ma*b-Mb*a)==0){ if(answer==-1){ answer=c; } else{ answer=Math.min(answer, c); } } } System.out.println(answer); sc.close(); } //private static final int imax = 110; }
Main.java:25: error: incompatible types: possible lossy conversion from long to int a=a+abc[i][0]; ^ Main.java:26: error: incompatible types: possible lossy conversion from long to int b=b+abc[i][1]; ^ Main.java:27: error: incompatible types: possible lossy conversion from long to int c=c+abc[i][2]; ^ 3 errors
s166748112
p03806
C++
#include <iostream> using namespace std; int n,ma,mb; int min; int flag; int a[40]; int b[40]; int c[40]; void saiki(int k,int A,int B,int C) { int w=0; A += a[k]; B += b[k]; C += c[k]; //cerr << C << endl; if(A%ma==0&&(w=A/ma)) { if(B==mb*w) { if(min>C) { flag=1; min = C; } } } for(int i=k+1;i<n;i++) { saiki(i,A,B,C); } return; } int main() { min = 1000000; flag = 0; cin >> n>>ma>>mb; for(int i=0;i<n;i++) { cin >>a[i]>>b[i]>>c[i]; } for(int i=0;i<n;i++) { saiki(0,0,0,0); } if(flag==1) { cout << min << endl; }else{ cout << -1 <<endl; } return 0; }
a.cc: In function 'void saiki(int, int, int, int)': a.cc:23:28: error: reference to 'min' is ambiguous 23 | if(min>C) | ^~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:5: note: 'int min' 6 | int min; | ^~~ a.cc:26:33: error: reference to 'min' is ambiguous 26 | min = C; | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:5: note: 'int min' 6 | int min; | ^~~ a.cc: In function 'int main()': a.cc:38:9: error: reference to 'min' is ambiguous 38 | min = 1000000; | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:5: note: 'int min' 6 | int min; | ^~~ a.cc:51:25: error: reference to 'min' is ambiguous 51 | cout << min << endl; | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:5: note: 'int min' 6 | int min; | ^~~
s190291739
p03806
C++
#include <bits/stdc++.h> using namespace std; const int dx[]={1,0,-1,0,1,-1,-1,1}; const int dy[]={0,1,0,-1,1,1,-1,-1}; const int INF = 1e9; const long long LINF = 1e18; const double EPS = 1e-8; #define pb push_back #define mk make_pair #define fr first #define sc second #define ll long long #define reps(i,j,k) for(int i = (j); i < (k); ++i) #define rep(i,j) reps(i,0,j) #define all(a) (a).begin(),(a).end() #define MOD 1000000007 typedef pair<int,int> Pii; typedef pair<Pii,int> P; typedef vector<int> vi; vector < P > memo; void calc(const vi &a,const vi &b,const vi &c, int prev, P p){ if(prev == a.size()){ return ; } p.fr.fr += a[prev]; p.fr.sc += b[prev]; p.sc += c[prev]; calc(a,b,c,prev+1,p); memo.pb(p); p.fr.fr -= a[prev]; p.fr.sc -= b[prev]; p.sc -= c[prev]; calc(a,b,c,prev+1,p); return ; } int main(){ int N; cin >> N; int Ma,Mb; cin >> Ma >> Mb; vector < Pii > M; rep(i,500){ M.pb(mk(Ma*(i+1),Mb*(i+1))); } int a[50],b[50],c[50]; vi a1,b1,c1; vi a2,b2,c2; rep(i,N){ cin >> a[i] >> b[i] >> c[i]; if(i < N/2){ a1.pb(a[i]); b1.pb(b[i]); c1.pb(c[i]); } else{ a2.pb(a[i]); b2.pb(b[i]); c2.pb(c[i]); } } P ini = mk(mk(0,0),0); memo.pb(ini); calc(a1,b1,c1,0,ini); vector < P > sum1 = memo; sort(sum1.begin(),sum1.end()); memo.clear(); memo.pb(ini); calc(a2,b2,c2,0,ini); vector < P > sum2 = memo; sort(sum2.begin(),sum2.end()); map < Pii,int > tar; rep(i,sum2.size()){ p = tar[mk(sum2[i].fr.fr,sum2[i].fr.sc)]; if(p == 0){ p = INF; } tar[mk(sum2[i].fr.fr,sum2[i].fr.sc)] = min(INF,sum2[i].sc); } // puts("sum1"); // rep(i,sum1.size()){ // cout << sum1[i].fr.fr << " " << sum1[i].fr.sc << " " << sum1[i].sc << endl; // } // puts("sum2"); // rep(i,sum2.size()){ // cout << sum2[i].fr.fr << " " << sum2[i].fr.sc << " " << sum2[i].sc << endl; // } int ans = INF; rep(i,sum1.size()){ rep(j,M.size()){ Pii m = M[j]; P p = sum1[i]; if(m.fr < p.fr.fr && m.sc < p.fr.sc)break; if(m.fr < p.fr.fr || m.sc < p.fr.sc)continue; m.fr -= p.fr.fr; m.sc -= p.fr.sc; if(tar[m] != 0 || (m.fr == 0 && m.sc == 0)){ ans = min(ans,p.sc + tar[m]); } } //cout << ans << endl; } if(ans == INF){ ans = -1; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:76:9: error: 'p' was not declared in this scope 76 | p = tar[mk(sum2[i].fr.fr,sum2[i].fr.sc)]; | ^
s570712772
p03806
C++
#include <iostream> #include <cstdio> #include <fstream> #include <algorithm> #include <vector> #include <string> #include <set> #include <map> #include <utility> #include <stack> #include <queue> #include <sstream> #include <fstream> #include <cmath> #include <cstring> using namespace std; #define int long long const int mod = 1000000007; int dp[1000][1000][50] = {}; signed main(){ int N, Ma, Mb; int a[100] = {}, b[100] = {}, c[100] = {}; cin >> N >> Ma >> Mb; for (int i = 0; i < N; i++) { int a, b, c; cin >> a >> b >> c; for (int i = 999; i >= 0; i--) { for (int j = 999; j >= 0; j--) { for (int k = N; k >= 0; k--) { if (dp[i][j][k] != 0) { dp[i + a][j + b][k + 1] = dp[i][j][k]+ c; } } } } dp[a][b][1] = c; } int m = 999999999999; for (int i = 999; i >= 0; i--) { for (int j = 999; j >= 0; j--) { for (int k = N; k >= 0; k--) { if (dp[i][j][k] != 0) { if (fabs(double(i/j) - (double)(Ma/Mb)) < DBL_EPSILON) { m = min(m, dp[i][j][k]); } } } } } if (m == 999999999999) { cout << "-1" << endl; return 0; } cout << m << endl; return 0; }
a.cc: In function 'int main()': a.cc:45:83: error: 'DBL_EPSILON' was not declared in this scope 45 | if (fabs(double(i/j) - (double)(Ma/Mb)) < DBL_EPSILON) { | ^~~~~~~~~~~
s520922971
p03806
C++
#include <iostream> #include <string> #include <queue> #include <stack> #include <algorithm> #include <list> #include <vector> #include <complex> #include <utility> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <bitset> #include <ctime> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <cassert> #include <cstddef> #include <iomanip> #include <numeric> #include <tuple> #include <sstream> #include <fstream> using namespace std; #define REP(i, n) for (int (i) = 0; (i) < (n); (i)++) #define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++) #define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--) #define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--) #define DEBUG(C) cerr << #C << " = " << C << endl; using LL = long long; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<LL>; using VVL = vector<VL>; using VD = vector<double>; using VVD = vector<VD>; using PII = pair<int, int>; using PDD = pair<double, double>; using PLL = pair<LL, LL>; using VPII = vector<PII>; template<typename T> using VT = vector<T>; #define ALL(a) begin((a)), end((a)) #define RALL(a) rbegin((a)), rend((a)) #define SORT(a) sort(ALL((a))) #define RSORT(a) sort(RALL((a))) #define REVERSE(a) reverse(ALL((a))) #define MP make_pair #define FORE(a, b) for (auto &&a : (b)) #define FIND(s, e) ((s).find(e) != (s).end()) #define EB emplace_back template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;} template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;} const int INF = 1e9; const int MOD = INF + 7; const LL LLINF = 1e18; const long double EPS = 1e-9; const int MAX = 50; int N, Ma, Mb; int a[MAX], b[MAX], c[MAX]; int dp[MAX][1000][1000]; int main(void) { scanf("%d%d%d", &N, &Ma, &Mb); REP(i, N) { scanf("%d%d%d", a + i, b + i, c + i); } REP(i, MAX)REP(j, 1000) REP(k, 1000) { dp[i][j][k] = LLINF; } dp[0][0][0] = 0; REP(i, N) { REP(j, 1000) REP(k, 1000) { chmin(dp[i + 1][j][k], dp[i][j][k]); if (a[i] + j < 1000 && b[i] + k < 1000) { chmin(dp[i + 1][a[i] + j][b[i] + k], dp[i][j][k] + c[i]); } } } int ma = Ma, mb = Mb; LL ans = LLINF; while (ma < 1000 && mb < 1000) { chmin(ans, dp[N][ma][mb]); ma += Ma; mb += Mb; } if (ans == LLINF) ans = -1; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:75:23: warning: overflow in conversion from 'LL' {aka 'long long int'} to 'int' changes value from '1000000000000000000' to '-1486618624' [-Woverflow] 75 | dp[i][j][k] = LLINF; | ^~~~~ a.cc:89:14: error: no matching function for call to 'chmin(LL&, int&)' 89 | chmin(ans, dp[N][ma][mb]); | ~~~~~^~~~~~~~~~~~~~~~~~~~ a.cc:57:34: note: candidate: 'template<class T> bool chmin(T&, T)' 57 | template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;} | ^~~~~ a.cc:57:34: note: template argument deduction/substitution failed: a.cc:89:14: note: deduced conflicting types for parameter 'T' ('long long int' and 'int') 89 | chmin(ans, dp[N][ma][mb]); | ~~~~~^~~~~~~~~~~~~~~~~~~~
s934014675
p03806
C++
#include <iostream> #include <cstdio> #include <fstream> #include <algorithm> #include <vector> #include <string> #include <set> #include <map> #include <utility> #include <stack> #include <queue> #include <sstream> #include <fstream> #include <cmath> #include <cstring> using namespace std; #define int long long const int mod = 1000000007; int dp[1000][1000][50] = {}; signed main(){ int N, Ma, Mb; int a[100] = {}, b[100] = {}, c[100] = {}; cin >> N >> Ma >> Mb; for (int i = 0; i < N; i++) { int a, b, c; cin >> a >> b >> c; for (int i = 999; i >= 0; i--) { for (int j = 999; j >= 0; j--) { for (int k = N; k >= 0; k--) { if (dp[i][j][k] != 0&&l\k!=1) { dp[i + a][j + b][k + 1] = dp[i][j][k]+ c; } } } } dp[a][b][1] = c; } int m = 999999999999; for (int i = 999; i >= 0; i--) { for (int j = 999; j >= 0; j--) { for (int k = N; k >= 0; k--) { if (dp[i][j][k] != 0) { if ((double)(i / j) == (double)(Ma / Mb)) { m = min(m, dp[i][j][k]); } } } } } if (m == 999999999999) { cout << "-1" << endl; return 0; } cout << m << endl; return 0; }
a.cc:32:64: error: stray '\' in program 32 | if (dp[i][j][k] != 0&&l\k!=1) { | ^ a.cc: In function 'int main()': a.cc:32:63: error: 'l' was not declared in this scope 32 | if (dp[i][j][k] != 0&&l\k!=1) { | ^ a.cc:32:64: error: expected ')' before 'k' 32 | if (dp[i][j][k] != 0&&l\k!=1) { | ~ ^~ | )
s541080719
p03806
C++
#include <stdio.h> /* i-1番目まで調べて、物質aがAグラム、bがBグラムのときの最低価格をp[i][A][B]と置く。 A,Bは0から400まで、iは0から41まで p[i][A][B] = 5000と置いておけば十分。 漸化式は、 p[i][A][B] = min(p[i-1][A-a[i-1]][B-b[i-1]] + c[i-1] , p[i-1][A][B]) p[0][0][0] = 0, 残りはp[0][A][B] = 5000。 */ int a[40]; b[40]; c[40]; int p[41][401][401]; int memo[41][401][401]; int min(int i, int j){ if(i<j){return i;}else{return j;} } int dp(int i,int A,int B){ int PP; if(memo[i][A][B] == 1){ return p[i][A][B]; } if(A<0){return 5000;} if(B<0){return 5000;} PP = min(dp(i-1,A-a[i-1],B-b[i-1]) + c[i-1] , dp(i-1,A,B)); memo[i][A][B] = 1; p[i][A][B] = PP; return PP; } int main() { int N,Ma,Mb,i,j,k,ans; scanf("%d %d %d",&N,&Ma,&Mb); for(i=0;i<N;i++){ scanf("%d %d %d",&a[i],&b[i],&c[i]); } for(i=0;i<41;i++){ for(j=0;j<401;j++){ for(k=0;k<401;k++){ memo[i][j][k] = 0; p[i][j][k] = 5000; } } } for(j=0;j<401;j++){ for(k=0;k<401;k++){ memo[0][j][k] = 1; } } p[0][0][0] = 0; ans = 5000; for(i=1;(i*Ma<=400) && (i*Mb<=400); i++){ ans = min(ans, dp(N+1,Ma*i,Mb*i)); } if(ans==5000){ printf("-1\n"); }else{ printf("%d\n",ans); } }
a.cc:16:12: error: 'b' does not name a type 16 | int a[40]; b[40]; c[40]; | ^ a.cc:16:19: error: 'c' does not name a type 16 | int a[40]; b[40]; c[40]; | ^ a.cc: In function 'int dp(int, int, int)': a.cc:33:36: error: 'b' was not declared in this scope 33 | PP = min(dp(i-1,A-a[i-1],B-b[i-1]) + c[i-1] , dp(i-1,A,B)); | ^ a.cc:33:46: error: 'c' was not declared in this scope 33 | PP = min(dp(i-1,A-a[i-1],B-b[i-1]) + c[i-1] , dp(i-1,A,B)); | ^ a.cc: In function 'int main()': a.cc:44:41: error: 'b' was not declared in this scope 44 | scanf("%d %d %d",&a[i],&b[i],&c[i]); | ^ a.cc:44:47: error: 'c' was not declared in this scope 44 | scanf("%d %d %d",&a[i],&b[i],&c[i]); | ^
s791808675
p03806
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <cassert> #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define rep(i,n) FOR(i,0,n) #define DEBUG(x) cout<<#x<<": "<<x<<endl #define vint vector<int> #define vdouble vector<double> #define vstring vector<string> using namespace std; #include<map> #include<set> #include<queue> typedef long long ll; typedef unsigned long long ull; const int MAX_G = 401; int N, MA, MB; int A[40]; int B[40]; int C[40]; int G[MAX_G][MAX_G]; int main() { cin >> N >> MA >> MB; rep(i, N){ cin >> A[i] >> B[i] >> C[i]; } rep(i, MAX_G) rep(j, MAX_G) { G[i][j] = 999999; } G[0][0] = 0; rep(i, N){ rep(a, MAX_G) rep(b, MAX_G) { if (G[a][b] != 999999){ int aa = a + A[i]; int bb = b + B[i]; G[aa][bb] = min(G[aa][bb], G[a][b] + C[i]); } } } if (ret == 999999) ret = -1; cout << ret << endl; return 0; }
a.cc: In function 'int main()': a.cc:56:13: error: 'ret' was not declared in this scope; did you mean 'rep'? 56 | if (ret == 999999) ret = -1; | ^~~ | rep a.cc:57:17: error: 'ret' was not declared in this scope; did you mean 'rep'? 57 | cout << ret << endl; | ^~~ | rep
s700233630
p03806
Java
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.*; /** * Created by rakshit on 10/2/17. * Java is Love , 4 Forces.. :) */ public class omp { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public Reader(String file_name) throws IOException { din = new DataInputStream(new FileInputStream(file_name)); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String readLine() throws IOException { byte[] buf = new byte[64]; // line length int cnt = 0, c; while ((c = read()) != -1) { if (c == '\n') break; buf[cnt++] = (byte) c; } return new String(buf, 0, cnt); } public int nextInt() throws IOException { int ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public long nextLong() throws IOException { long ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public double nextDouble() throws IOException { double ret = 0, div = 1; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (c == '.') { while ((c = read()) >= '0' && c <= '9') { ret += (c - '0') / (div *= 10); } } if (neg) return -ret; return ret; } private void fillBuffer() throws IOException { bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) buffer[0] = -1; } private byte read() throws IOException { if (bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; } public void close() throws IOException { if (din == null) return; din.close(); } } public static void main(String args[]) throws IOException { OutputStream outputstream=System.out; Reader in=new Reader(); PrintWriter out=new PrintWriter (outputstream); Task solver=new Task(); solver.solve(in,out); in.close(); } static class Task { public final int k=123456; public final int mod=1000000000; public void solve(Reader in , PrintWriter out) throws IOException { int n,l,r; n=in.nextInt(); l=in.nextInt(); r=in.nextInt(); int a[]=new int [n]; int b[]=new int [n]; int c[]=new int [n]; for(int i=0;i<n;i++) { a[i]=in.nextInt(); b[i]=in.nextInt(); c[i]=in.nextInt(); } int Asum=0,Bsum=0,store=0; SortedSet<Integer>check=new TreeSet<>(); for(int i=1;i<=n;i++) { for(int j=0;j<n-i+1;j++) { Asum=sum(a,j,i); Bsum=sum(b,j,i); if(Asum*r==Bsum*l) { store=sum(c,j,i); check.add(store); } } } if(check.size()==0) { out.println(-1); } else { out.println(check.first()); } out.flush(); } public int sum(int a[],int n,int m) { int sum=0; for(int i=n;i<n+m;i++) { sum+=a[i]; } return sum; } public static long max(long a,long b) { if(a>b) { return a; } else { return b; } } private static long gcd(long a,long b) { if(a==0) return b; else return gcd(b%a,a); } private static long lcm(long a, long b) { return (a*b)/gcd(a,b); } private static boolean prime(int n) { if(n==1 || (n%2==0 && n!=2)) return false; else if(n==2 || n==3) { return true; } else { int res=0; for(int i=3;i<=(int)Math.sqrt(n) ;i+=2) { if(n%i==0) { res++; break; } } if(res>0) { return false; } else { return true; } } } } }
Main.java:12: error: class omp is public, should be declared in a file named omp.java public class omp { ^ 1 error
s793824161
p03806
C++
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <map> #include <unordered_map> #include <set> #include <climits> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N, Ma, Mb; cin >> N >> Ma >> Mb; vector<int> a(N), b(N), c(N); for(int i=0; i<N; i++) cin >> a[i] >> b[i] >> c[i]; int N1 = N / 2; int N2 = N - N1; vector<pair<int, int>> G1(1 << N1), G2(1 << N2); G2.back() = pair<int, int>(0, 0); for(int i=0; i< 1<<N1; i++){ int aa = 0, bb = 0, cc = 0; for(int j=0; j<N1; j++){ if(i & 1<<j){ aa += a[j]; bb += b[j]; cc += c[j]; } } int tmp = aa * Mb - bb * Ma; G1[i] = pair<int, int>(tmp, cc); } for(int i=0; i< 1<<N2; i++){ int aa = 0, bb = 0, cc = 0; for(int j=0; j<N2; j++){ if(i & 1<<j){ aa += a[j]; bb += b[j]; cc += c[j]; } } int tmp = bb * Ma - aa * Mb; G2[i] = pair<int, int>(tmp, cc); } sort(G2.begin(), G2.end()); const int INF = 1000000000; int ans = INF; for(int i=1; i<G1.size(); i++){ pair<int, int> p = pair<int, int>(G1[i], 0); auto itr = lower_bound(G2.begin(), G2.end(), p); if(itr == G2.end() || G1[i].first != itr->first) continue; ans = min(ans, G1[i].second + itr->second); } if(ans == INF) cout << -1 << endl; else cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:53:51: error: no matching function for call to 'std::pair<int, int>::pair(__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type&, int)' 53 | pair<int, int> p = pair<int, int>(G1[i], 0); | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 913 | explicit constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 902 | constexpr pair(pair<_U1, _U2>&& __p) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair.h:891:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && (! _ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 891 | explicit constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:891:28: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:890:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 890 | bool>::type=false> | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && _ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 881 | constexpr pair(_U1&& __x, _U2&& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:881:19: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:880:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 880 | bool>::type=true> | ^~~~ /usr/include/c++/14/bits/stl_pair.h:869:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_Iter, int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_U2, _T2> > >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 869 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:869:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:866:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 866 | bool> = false> | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::is_convertible<_Iter, int> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U2, _T2> >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 856 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:856:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:853:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 853 | bool> = true> | ^~~~ /usr/include/c++/14/bits/stl_pair.h:843:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<int>, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_Iter, int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, __zero_as_null_pointer_constant, ...) [with typename std::enable_if<std::__and_<std::__not_<std::is_reference<_U1> >, std::is_pointer<_T2>, std::is_constructible<_T1, _U1>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_Iter, _Iterator> > >::value, bool>::type <anonymous> = _U1; _T1 = int; _T2 = int]' 843 | pair(_U1&& __x, __zero_as_null_pointer_constant, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:843:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:840:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 840 | bool> = false> | ^~~~~ /usr/include/c++/14/bits/stl_pair.h:830:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<int>, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::is_convertible<_Iter, int> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, __zero_as_null_pointer_constant, ...) [with typename std::enable_if<std::__and_<std::__not_<std::is_reference<_U1> >, std::is_pointer<_T2>, std::is_constructible<_T1, _U1>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_Iter, _Iterator> >::value, bool>::type <anonymous> = _U1; _T1 = int; _T2 = int]' 830 | pair(_U1&& __x, __zero_as_null_pointer_constant, ...) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:830:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_pair.h:827:38: error: no type named 'type' in 'struct std::enable_if<false, bool>' 827 | bool> = true> | ^~~~ /usr/include/c++/14/bits/stl_pair.h:789:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]' 789 | explicit constexpr pair(const pair<_U1, _U2>& __p) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:789:28: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_pair
s954196494
p03806
C++
#include <stdio.h> #include <algorithm> #include <vector> struct PatternA { int a, b, c; PatternA(int a0, int b0, int c0) : a(a0), b(b0), c(c0) {} PatternA() : a(0), b(0), c(0) {} bool operator<(const PatternA& o) const { if (a * o.b == o.a * b) { return c < o.c; } else { return a*o.b < o.a*b; } } }; struct PatternB { int a, b, c; PatternB(int a0, int b0, int c0) : a(a0), b(b0), c(c0) {} PatternB() : a(0), b(0), c(0) {} bool operator<(const PatternB& o) const { if (a * o.b == o.a * b) { return c < o.c; } else { return a*o.b > o.a*b; } } }; int main() { int n, ma, mb; int a[40], b[40], c[40]; scanf("%d%d%d", &n, &ma, &mb); for (int i = 0; i < n; i++) { scanf("%d%d%d", &a[i], &b[i], &c[i]); } std::vector<PatternA> va; std::vector<PatternB> vb; int pan = std::min(20, n); int pbn = n - pan; for (int i = 0; i < (1<<pan); i++) { PatternA p; for (int j = 0; j < pan; j++) { if (i&(1 << j)) { p.a += a[j]; p.b += b[j]; p.c += c[j]; } } va.push_back(p); } for (int i = 0; i < (1<<pbn); i++) { PatternB p; for (int j = 0; j < pan; j++) { if (i&(1 << j)) { p.a += a[j]; p.b += b[j]; p.c += c[j]; } } vb.push_back(p); } std::sort(va.begin(), va.end()); std::sort(vb.begin(), vb.end()); int ia = 0; int ib = 0; int ret = INT_MAX; while (ia < (int)va.size() && ib < (int)vb.size()) { int aa = va[ia].a + vb[ib].a; int bb = va[ia].b + vb[ib].b; int cc = va[ia].c + vb[ib].c; if (aa * mb == bb * ma && aa*mb > 0) { ret = std::min(ret, cc); ia++; continue; } if (aa * mb < bb * ma) { if (ia < (int)va.size() - 1) { ia++; continue; } else if (ib < (int)vb.size() - 1) { ib++; continue; } else { break; } } else { if (ib < (int)vb.size() - 1) { ib++; continue; } else if (ia < (int)va.size() - 1) { ia++; continue; } else { break; } } } if (ret == INT_MAX) { ret = -1; } printf("%d\n", ret); return 0; }
a.cc: In function 'int main()': a.cc:70:19: error: 'INT_MAX' was not declared in this scope 70 | int ret = INT_MAX; | ^~~~~~~ a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include <vector> +++ |+#include <climits> 4 |
s205725268
p03806
C++
#include <bits/stdc++.h> using namespace std; long long dp[1001][1001]; int main(void){ int N,Ma,Mb; cin >> N >> Ma >> Mb; vector<int> a(N),b(N),c(N); for(int i=0;i<N;i++){ cin >> a[i] >> b[i] >> c[i]; } for(int i=0;i<=1000;i++)for(int j=0;j<=1000;j++) dp[i][j] = 1e18; dp[0][0] = 0; for(int i=0;i<=1000;i++){ for(int j=0;j<=1000;j++){ for(int k=0;k<N;k++){ if(i+a[k] > 1000 || j+b[k] > 1000)continue; dp[i+a[k]][j+b[k]] = min(dp[i][j] + c[k],dp[i+a[k]][j+b[k]]); } } } int ret = 1e18; for(int i=1;i<100;i++){ ret = min(ret,dp[Ma*i][Mb*i]); } if(ret == 1e18)cout << -1 << endl; else cout << ret << endl; return 0; }
a.cc: In function 'int main()': a.cc:27:19: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow] 27 | int ret = 1e18; | ^~~~ a.cc:29:26: error: no matching function for call to 'min(int&, long long int&)' 29 | ret = min(ret,dp[Ma*i][Mb*i]); | ~~~^~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:29:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 29 | ret = min(ret,dp[Ma*i][Mb*i]); | ~~~^~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:29:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 29 | ret = min(ret,dp[Ma*i][Mb*i]); | ~~~^~~~~~~~~~~~~~~~~~~~
s958783203
p03807
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,odd=0,even=0; cin >> n; int a[n]; for(int i=0;i<n;i++){ cin >> a[i]; if(a[i]%2==0)even++; else odd++; } if(odd%2==1)cout << "NO" << endl; else cout << "YES" << endl; sort(a,a+n);
a.cc: In function 'int main()': a.cc:14:15: error: expected '}' at end of input 14 | sort(a,a+n); | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s931030596
p03807
C++
#pragma GCC optimize("O3") #pragma GCC target("avx") #include < bits / stdc++.h > #define int long long #define ll long long using ull = unsigned long long; using namespace std; #define dump(x) \ if (dbg) { \ cerr << #x << " = " << (x) << endl; \ } #define overload4(_1, _2, _3, _4, name, ...) name #define FOR1(n) for (ll i = 0; i < (n); ++i) #define FOR2(i, n) for (ll i = 0; i < (n); ++i) #define FOR3(i, a, b) for (ll i = (a); i < (b); ++i) #define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c)) #define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__) #define FORR(i, a, b) for (int i = (a); i <= (b); ++i) #define bit(n, k) ((n >> k) & 1) /*nのk bit目*/ namespace mydef { const int INF = 1ll << 60; const int MOD = 1e9 + 7; template <class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } else return 0; } template <class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } else return 0; } void Yes(bool flag = true) { if (flag) cout << "Yes" << endl; else cout << "No" << endl; } void No(bool flag = true) { Yes(!flag); } void YES(bool flag = true) { if (flag) cout << "YES" << endl; else cout << "NO" << endl; } void NO(bool flag = true) { YES(!flag); } template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); } bool dbg = false; } // namespace mydef using namespace mydef; #define pb push_back #define mp make_pair #define eb emplace_back #define lb lower_bound #define ub upper_bound #define all(v) (v).begin(), (v).end() #define SZ(x) ((int)(x).size()) #define vi vector<int> #define vvi vector<vector<int>> #define vp vector<pair<int, int>> #define vvp vector<vector<pair<int, int>>> #define pi pair<int, int> //#define P pair<int, int> //#define V vector<int> //#define S set<int> #define asn ans static struct IO { char tmp[1 << 10]; // fast input routines char cur; //#define nextChar() (cur = getc_unlocked(stdin)) //#define peekChar() (cur) inline char nextChar() { return cur = getc_unlocked(stdin); } inline char peekChar() { return cur; } inline operator bool() { return peekChar(); } inline static bool isBlank(char c) { return (c < '-' && c); } inline bool skipBlanks() { while (isBlank(nextChar())) ; return peekChar() != 0; } inline IO& operator>>(char& c) { c = nextChar(); return *this; } inline IO& operator>>(char* buf) { if (skipBlanks()) { if (peekChar()) { *(buf++) = peekChar(); while (!isBlank(nextChar())) *(buf++) = peekChar(); } *(buf++) = 0; } return *this; } inline IO& operator>>(string& s) { if (skipBlanks()) { s.clear(); s += peekChar(); while (!isBlank(nextChar())) s += peekChar(); } return *this; } inline IO& operator>>(double& d) { if ((*this) >> tmp) sscanf(tmp, "%lf", &d); return *this; } #define defineInFor(intType) \ inline IO& operator>>(intType& n) { \ if (skipBlanks()) { \ int sign = +1; \ if (peekChar() == '-') { \ sign = -1; \ n = nextChar() - '0'; \ } else \ n = peekChar() - '0'; \ while (!isBlank(nextChar())) { \ n += n + (n << 3) + peekChar() - 48; \ } \ n *= sign; \ } \ return *this; \ } defineInFor(int) defineInFor(unsigned int) // defineInFor(long long) // fast output routines //#define putChar(c) putc_unlocked((c), stdout) inline void putChar(char c) { putc_unlocked(c, stdout); } inline IO& operator<<(char c) { putChar(c); return *this; } inline IO& operator<<(const char* s) { while (*s) putChar(*s++); return *this; } inline IO& operator<<(const string& s) { for (int i = 0; i < (int)s.size(); ++i) putChar(s[i]); return *this; } char* toString(double d) { sprintf(tmp, "%lf%c", d, '\0'); return tmp; } inline IO& operator<<(double d) { return (*this) << toString(d); } #define defineOutFor(intType) \ inline char* toString(intType n) { \ char* p = (tmp + 30); \ if (n) { \ bool isNeg = 0; \ if (n < 0) \ isNeg = 1, n = -n; \ while (n) \ *--p = (n % 10) + '0', n /= 10; \ if (isNeg) \ *--p = '-'; \ } else \ *--p = '0'; \ return p; \ } \ inline IO& operator<<(intType n) { return (*this) << toString(n); } defineOutFor(signed) defineOutFor(long long) #define endl ('\n') #define cout __io__ #define cin __io__ } __io__; //https://gist.github.com/sananth12/dc6e9c1e02563b1c5004 //when int is not defined as long long, erase some comments //Don't forget to erase cin.tie(nullptr); and ios::sync_with_stdio(false); void solve() { } signed main() { int N; int cnt = 0; cin >> N; for (int i = 0; i < N; i++) { int a; cin >> a; cnt += a % 2; } YES(cnt % 2 == 0); solve(); return 0; }
a.cc:3:10: fatal error: bits / stdc++.h : No such file or directory 3 | #include < bits / stdc++.h > | ^~~~~~~~~~~~~~~~~~~ compilation terminated.
s207941574
p03807
C++
#include<bits/stdc++.h> #define FRU freopen("out.txt","w",stdout) #define FRO freopen("in.txt","r",stdin) #define pb push_back #define mp make_pair #define ff first #define ss second #define mem(ara,n) memset(ara,n,sizeof ara) #define loop(i,j,n) for(i=j;i<n;i++) #define rloop(i,j,n) for(i=n;i>=j;i--) #define INF 2147483647 #define ll long long #define pii pair<int,int> #define eps 1e-9 #define mii map<int,int> #define vi vector<int> #define all(n) n.begin(),n.end() #define inf INF #define INFLL 9223372036854775807 using namespace std; int main() { int i,j,k,tc,t,n,m,cnt=0,a; cin>>n int ara[100005]; for(i=0;i<n;i++) { cin>>ara[i]; if(ara[i]%2==1)cnt++; } if(cnt%2&& tc>1)cout<<"NO\n"; else cout<<"YES\n"; }
a.cc: In function 'int main()': a.cc:24:11: error: expected ';' before 'int' 24 | cin>>n | ^ | ; 25 | int ara[100005]; | ~~~ a.cc:28:14: error: 'ara' was not declared in this scope 28 | cin>>ara[i]; | ^~~
s800619146
p03807
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; for(int i = 1;i<=N;i++){ int A; cin>>A; ans += A; } if((ans)%2==0){ cout<<"YES"<<endl; }else{ cout<<"NO"<<endl; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:9:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 9 | ans += A; | ^~~ | abs a.cc:11:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 11 | if((ans)%2==0){ | ^~~ | abs a.cc:16:14: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | cout<<ans<<endl; | ^~~ | abs
s526312936
p03807
C++
#include<iostream> using namespace std; int main() { int N, a[100000]; cin >> N; REP(i, N) cin >> a[i]; int oddNum = 0; REP(i, N) { if(a[i]%2 == 1) oddNum++; } cout << (oddNum % 2 == 0? "Yes": "No") << endl; }
a.cc: In function 'int main()': a.cc:8:9: error: 'i' was not declared in this scope 8 | REP(i, N) cin >> a[i]; | ^ a.cc:8:5: error: 'REP' was not declared in this scope 8 | REP(i, N) cin >> a[i]; | ^~~
s573786931
p03807
C++
int main() { int N, a[100000]; cin >> N; REP(i, N) cin >> a[i]; int oddNum = 0; REP(i, N) { if(a[i]%2 == 1) oddNum++; } cout << (oddNum % 2 == 0? "Yes": "No") << endl; }
a.cc: In function 'int main()': a.cc:4:5: error: 'cin' was not declared in this scope 4 | cin >> N; | ^~~ a.cc:5:9: error: 'i' was not declared in this scope 5 | REP(i, N) cin >> a[i]; | ^ a.cc:5:5: error: 'REP' was not declared in this scope 5 | REP(i, N) cin >> a[i]; | ^~~ a.cc:11:5: error: 'cout' was not declared in this scope 11 | cout << (oddNum % 2 == 0? "Yes": "No") << endl; | ^~~~ a.cc:11:47: error: 'endl' was not declared in this scope 11 | cout << (oddNum % 2 == 0? "Yes": "No") << endl; | ^~~~
s340748870
p03807
C++
int main() { int N, a[100000]; cin >> N; REP(i, N) cin >> a[i]; int oddNum = 0; REP(i, N) { if(a[i]%2 == 1) oddNum++; } cout >> (oddNum%2 == 0? "Yes": "No") >> endl; }
a.cc: In function 'int main()': a.cc:5:5: error: 'cin' was not declared in this scope 5 | cin >> N; | ^~~ a.cc:6:9: error: 'i' was not declared in this scope 6 | REP(i, N) cin >> a[i]; | ^ a.cc:6:5: error: 'REP' was not declared in this scope 6 | REP(i, N) cin >> a[i]; | ^~~ a.cc:12:5: error: 'cout' was not declared in this scope 12 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^~~~ a.cc:12:45: error: 'endl' was not declared in this scope 12 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^~~~
s042078910
p03807
C++
#include<iostream> using namespace std; int main() { int N, a[100000]; cin >> N; REP(i, N) cin >> a[i]; int oddNum = 0; REP(i, N) { if(a[i]%2 == 1) oddNum++; } cout >> (oddNum%2 == 0? "Yes": "No") >> endl; }
a.cc: In function 'int main()': a.cc:7:9: error: 'i' was not declared in this scope 7 | REP(i, N) cin >> a[i]; | ^ a.cc:7:5: error: 'REP' was not declared in this scope 7 | REP(i, N) cin >> a[i]; | ^~~ a.cc:13:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char*') 13 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ~~~~ ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | const char* | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:13:40: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 13 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:13:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 13 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:13:40: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 13 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:13:40: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 13 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:13:40: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 13 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:13:40: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 13 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:13:40: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 13 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:13:40: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 13 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = const char*]': a.cc:13:40: required from here 13 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s972367601
p03807
C++
int main() { int N, a[100000]; cin >> N; REP(i, N) cin >> a[i]; int oddNum = 0; REP(i, N) { if(a[i]%2 == 1) oddNum++; } cout >> (oddNum%2 == 0? "Yes": "No") >> endl; }
a.cc: In function 'int main()': a.cc:3:5: error: 'cin' was not declared in this scope 3 | cin >> N; | ^~~ a.cc:4:9: error: 'i' was not declared in this scope 4 | REP(i, N) cin >> a[i]; | ^ a.cc:4:5: error: 'REP' was not declared in this scope 4 | REP(i, N) cin >> a[i]; | ^~~ a.cc:10:5: error: 'cout' was not declared in this scope 10 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^~~~ a.cc:10:45: error: 'endl' was not declared in this scope 10 | cout >> (oddNum%2 == 0? "Yes": "No") >> endl; | ^~~~
s785413949
p03807
C++
int main(){ int n; cin >> n; int a[n]; int odd = 0,even = 0; for(int i = 0; i < n; i++){ cin >> a[i]; if(a[i] % 2 == 0) even++; else if (a[i] % 2 == 1) odd++; } if(odd % 2 == 0){ cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:3:5: error: 'cin' was not declared in this scope 3 | cin >> n; | ^~~ a.cc:12:9: error: 'cout' was not declared in this scope 12 | cout << "YES" << endl; | ^~~~ a.cc:12:26: error: 'endl' was not declared in this scope 12 | cout << "YES" << endl; | ^~~~ a.cc:14:9: error: 'cout' was not declared in this scope 14 | cout << "NO" << endl; | ^~~~ a.cc:14:25: error: 'endl' was not declared in this scope 14 | cout << "NO" << endl; | ^~~~
s177969395
p03807
C++
int main(){ int n; cin >> n; int a[n]; int odd = 0,even = 0; for(int i = 0; i < n; i++){ cin >> a[i]; if(a[i] % 2 == 0) even++; else if (a[i] % 2 == 1) odd++; } if(odd % 2 == 0){ cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:3:5: error: 'cin' was not declared in this scope 3 | cin >> n; | ^~~ a.cc:12:9: error: 'cout' was not declared in this scope 12 | cout << "YES" << endl; | ^~~~ a.cc:12:26: error: 'endl' was not declared in this scope 12 | cout << "YES" << endl; | ^~~~ a.cc:14:9: error: 'cout' was not declared in this scope 14 | cout << "NO" << endl; | ^~~~ a.cc:14:25: error: 'endl' was not declared in this scope 14 | cout << "NO" << endl; | ^~~~
s949335246
p03807
C++
#include<iostream> using namespace std; int arr[2]; int main(){ int >> N; cin >> N; for(int i=1 ; i<=N; i++){ int num ; cin >> num; arr[num%2]++; } if(arr[1] % 2 == 1){ cout << "No" << endl; } else{ cout << "Yes" << endl; } }
a.cc: In function 'int main()': a.cc:8:9: error: expected unqualified-id before '>>' token 8 | int >> N; | ^~ a.cc:9:12: error: 'N' was not declared in this scope 9 | cin >> N; | ^
s214985396
p03807
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int>a(n); for (int i = 0; i < n; i++)cin >> a.at(i); int A = 0; //偶数 int B = 0; //奇数 for (int i = 0; i < n; i++) if(a.at(i)%2==0)A++; else B++; } if(A%2==0||(A==1&&B==0))cout << "Yes" <<endl; else cout << "No" <<endl; }
a.cc:15:5: error: expected unqualified-id before 'if' 15 | if(A%2==0||(A==1&&B==0))cout << "Yes" <<endl; | ^~ a.cc:16:5: error: expected unqualified-id before 'else' 16 | else cout << "No" <<endl; | ^~~~ a.cc:17:1: error: expected declaration before '}' token 17 | } | ^
s812662245
p03807
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int>a(n); for (int i = 0; i < n; i++)cin >> a.at(i); int a = 0; //偶数 int b = 0; //奇数 for (int i = 0; i < n; i++) if(a.at(i)%2==0)a++; else b++; } if(a%2==0||(a==1&&b==0))cout << "Yes" <<endl; else cout << "No" <<endl; }
a.cc: In function 'int main()': a.cc:9:9: error: conflicting declaration 'int a' 9 | int a = 0; //偶数 | ^ a.cc:6:16: note: previous declaration as 'std::vector<int> a' 6 | vector<int>a(n); | ^ a.cc:12:22: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 12 | if(a.at(i)%2==0)a++; | ~^~ a.cc: At global scope: a.cc:15:5: error: expected unqualified-id before 'if' 15 | if(a%2==0||(a==1&&b==0))cout << "Yes" <<endl; | ^~ a.cc:16:5: error: expected unqualified-id before 'else' 16 | else cout << "No" <<endl; | ^~~~ a.cc:17:1: error: expected declaration before '}' token 17 | } | ^
s771416629
p03807
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) int main(){ int N; cin >> N; vector<int> vec(N); rep(i,n){ cin >> vec[i]; } int count = 0; rep(i,n){ if(vec[i]%2 == 1) count++; } if(count%2 == 0) cout << "YES" << endl; else cout << "NO" << endl; }
a.cc: In function 'int main()': a.cc:9:9: error: 'n' was not declared in this scope 9 | rep(i,n){ | ^ a.cc:3:33: note: in definition of macro 'rep' 3 | #define rep(i,n) for(int i=0; i<n; i++) | ^ a.cc:14:9: error: 'n' was not declared in this scope 14 | rep(i,n){ | ^ a.cc:3:33: note: in definition of macro 'rep' 3 | #define rep(i,n) for(int i=0; i<n; i++) | ^
s111037600
p03807
C++
#include <bits/stdc++.h> #include <cstdlib> #include <cmath> #include <algorithm> #define rep(i,n) for (long long i=0; i < (n); ++i) #define rep2(i,n,m) for(long long i=n;i<=m;i++) #define ALL(a) (a).begin(),(a).end() using namespace std; using ll = long long; using P = pair<int,int>; const ll INF=1e18 ; inline void chmax(ll& a,ll b){a=max(a,b);} inline void chmin(ll& a,ll b){a=min(a,b);} int main() { ll n ; cin >> n ; vector<ll> A(n) ; rep(i,n) cin >>A[i] ; ll ans=0 ; rep(i,n) if(A[i]%2==1) ans++ ; if(ans%2==0) cout<< "Yes"<<endl ; else cout <<"No<<endl ; return 0; }
a.cc:22:15: warning: missing terminating " character 22 | else cout <<"No<<endl ; | ^ a.cc:22:15: error: missing terminating " character 22 | else cout <<"No<<endl ; | ^~~~~~~~~~~ a.cc: In function 'int main()': a.cc:23:7: error: expected primary-expression before 'return' 23 | return 0; | ^~~~~~
s601452206
p03807
C++
#include <bits/stdc++.h> using namespace std; int main() { int N cin >> N int A; int sum = 0; for(int i = 0;i < N;i++){ int A[i] sum += A[i]; } if(sum % 2 == 0){ cout << "YES" << endl; } else{ cout << "NO" << endl; } }
a.cc: In function 'int main()': a.cc:6:5: error: expected initializer before 'cin' 6 | cin >> N | ^~~ a.cc:10:21: error: 'N' was not declared in this scope 10 | for(int i = 0;i < N;i++){ | ^ a.cc:12:4: error: expected initializer before 'sum' 12 | sum += A[i]; | ^~~
s126435181
p03807
C++
#include <bits/stdc++.h> using namespace std; int main() { int N cin >> N int A; int sum == 0; for(int i = 0;i < N;i++){ int A[i] sum += A[i]; } if(sum % 2 == 0){ cout << "YES" << endl; } else{ cout << "NO" << endl; } }
a.cc: In function 'int main()': a.cc:6:5: error: expected initializer before 'cin' 6 | cin >> N | ^~~ a.cc:8:11: error: expected initializer before '==' token 8 | int sum == 0; | ^~ a.cc:10:21: error: 'N' was not declared in this scope 10 | for(int i = 0;i < N;i++){ | ^ a.cc:12:4: error: expected initializer before 'sum' 12 | sum += A[i]; | ^~~ a.cc:15:6: error: 'sum' was not declared in this scope 15 | if(sum % 2 == 0){ | ^~~
s213945799
p03807
C++
#include <bits/stdc++.h> using namespace std; int main() { int N cin >> N int A; int sum == 0; for(int i = 0;i < N;i++){ sum += A[i]; } if(sum % 2 == 0){ cout << "YES" << endl; } else{ cout << "NO" << endl; } }
a.cc: In function 'int main()': a.cc:6:5: error: expected initializer before 'cin' 6 | cin >> N | ^~~ a.cc:8:11: error: expected initializer before '==' token 8 | int sum == 0; | ^~ a.cc:10:21: error: 'N' was not declared in this scope 10 | for(int i = 0;i < N;i++){ | ^ a.cc:11:4: error: 'sum' was not declared in this scope 11 | sum += A[i]; | ^~~ a.cc:11:11: error: 'A' was not declared in this scope 11 | sum += A[i]; | ^ a.cc:14:6: error: 'sum' was not declared in this scope 14 | if(sum % 2 == 0){ | ^~~
s269427678
p03807
C++
//#include <tourist> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p; const int INF = 1e9; const ll LINF = ll(1e18); const int MOD = 1000000007; const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}; const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl #define rep(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() #define debug(v) \ cout << #v << ":"; \ for (auto x : v) \ { \ cout << x << ' '; \ } \ cout << endl; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } //cout<<fixed<<setprecision(15);有効数字15桁 //-std=c++14 //-std=gnu++17 ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { cin.tie(0);a ios::sync_with_stdio(false); int n; cin>>n; vector<ll>a(n); rep(i,n)cin>>a[i]; int odd=0; rep(i,n){if(a[i]%2)odd++;} if(odd%2==0)YES; else NO; }
a.cc: In function 'int main()': a.cc:51:16: error: 'a' was not declared in this scope 51 | cin.tie(0);a | ^
s584989140
p03807
C++
//#include <tourist> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p; const int INF = 1e9; const ll LINF = ll(1e18); const int MOD = 1000000007; const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}; const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl #define rep(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() #define debug(v) \ cout << #v << ":"; \ for (auto x : v) \ { \ cout << x << ' '; \ } \ cout << endl; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } //cout<<fixed<<setprecision(15);有効数字15桁 //-std=c++14 //-std=gnu++17 ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { cin.tie(0);a ios::sync_with_stdio(false); int n; cin>>n; vector<ll>a(n); rep(i,n)cin>>a[i]; int odd=0; rep(i,n)if(a[i]%2)odd++; if(odd%2==0)YES; else NO; }
a.cc: In function 'int main()': a.cc:51:16: error: 'a' was not declared in this scope 51 | cin.tie(0);a | ^
s104081722
p03807
C++
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define intll int long long const int INF = 1e9; const int MOD = 1e9 + 7; int main() { int n ; cin >> n ; int odd = 0 ; rep(i,n){ int c ; cin >> c ; if(c%2 == 1){ odd++; } if(odd%2 == 0) cout << "Yes" ; else cout << "No" ; }
a.cc: In function 'int main()': a.cc:26:2: error: expected '}' at end of input 26 | } | ^ a.cc:10:12: note: to match this '{' 10 | int main() { | ^
s168238127
p03807
C++
#include<bits/stdc++.h> using namespace std; int n,a[100001],ans=0; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; ans+=a[i]; } if(ans%2==0)cout<<"YES"<<endl;。 else cout<<"NO"<<endl; return 0; }
a.cc:10:35: error: extended character 。 is not valid in an identifier 10 | if(ans%2==0)cout<<"YES"<<endl;。 | ^ a.cc: In function 'int main()': a.cc:10:35: error: '\U00003002' was not declared in this scope 10 | if(ans%2==0)cout<<"YES"<<endl;。 | ^~
s558442558
p03807
C++
#include<bits/stdc++.h> using namespace std; int n,a[100001],ans=0; int main(){ cin>>n;//读入n for(int i=1;i<=n;i++){ cin>>a[i]; ans+=a[i]; } if(ans%2==0)cout<<"YES"<<endl;。 else cout<<"NO"<<endl; return 0; }
a.cc:10:35: error: extended character 。 is not valid in an identifier 10 | if(ans%2==0)cout<<"YES"<<endl;。 | ^ a.cc: In function 'int main()': a.cc:10:35: error: '\U00003002' was not declared in this scope 10 | if(ans%2==0)cout<<"YES"<<endl;。 | ^~
s285171650
p03807
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; odd_count = 0; int a; for (int i = 0; i < N; i++) { cin >> a; if(a % 2) odd_count++; } if (odd_count % 2) { cout << "No" << endl; } else { cout << "Yes" << endl; } }
a.cc: In function 'int main()': a.cc:8:3: error: 'odd_count' was not declared in this scope 8 | odd_count = 0; | ^~~~~~~~~
s337117348
p03807
C++
using namespace std; int main(){ int n; long long a[100005]; cin >> n; long long ans=0; for (int i=1;i<=n;i++){ cin >> a[i]; ans+=a[i]; } if (ans%2==0) cout << "YES\n"; else cout << "NO\n"; }
a.cc: In function 'int main()': a.cc:5:6: error: 'cin' was not declared in this scope 5 | cin >> n; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:11:20: error: 'cout' was not declared in this scope 11 | if (ans%2==0) cout << "YES\n"; | ^~~~ a.cc:11:20: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:12:11: error: 'cout' was not declared in this scope 12 | else cout << "NO\n"; | ^~~~ a.cc:12:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s483075467
p03807
C++
#include <iostream> using namespace std; int main() { long int n, a, sum = 0; cin >> n; for (int i = 1; i <= n; i++) { cin >> a; if (a % 2 == 0) { sum++; } else { ans++; } } if(ans % 2 == 1) { cout << "NO" << endl; } else { cout << "YES" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | ans++; | ^~~ | abs a.cc:19:12: error: 'ans' was not declared in this scope; did you mean 'abs'? 19 | if(ans % 2 == 1) | ^~~ | abs
s592821489
p03807
C++
#include <iostream> using namespace std; int main() { long int n, a, sum = 0; cin >> n; for (int i = 1; i <= n; i++) { cin >> a; if (a % 2 == 0) { sum++; } else { ans++; } } if(ans % 2 == 1) { cout << "NO" << endl; } else { cout << "YES" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | ans++; | ^~~ | abs a.cc:19:12: error: 'ans' was not declared in this scope; did you mean 'abs'? 19 | if(ans % 2 == 1) | ^~~ | abs
s583003175
p03807
C++
#include<bits/stdc++.h> using namespace std; int a[1][100]; int mian() { int n; cin>>n; int jsq=0; for(int i=0;i<n;i++) { cin>>a[1][i]; jsq=jsq+a[1][i]; } if(jsq%2==1) cout<<"NO"; else cout<<"YES"; return 0; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s705758613
p03807
C++
#include<iostream> using namespace std; int main() { int x,cnt=0; cin>>x;//直接忽略第一个数 while(cin>>x)cnt+=x%2; cout<<cnt%2?"NO":"YES"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:31: error: invalid operands of types 'const char [4]' and '<unresolved overloaded function type>' to binary 'operator<<' 8 | cout<<cnt%2?"NO":"YES"<<endl; | ~~~~~^~~~~~
s703417013
p03807
C++
#include<iostream> using namespace std; int main() { int x,cnt=0; cin>>x;//直接忽略第一个数 while(cin>>x)cnt+=x%2; cout<<cnt%2?"NO","YES"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:31: error: invalid operands of types 'const char [4]' and '<unresolved overloaded function type>' to binary 'operator<<' 8 | cout<<cnt%2?"NO","YES"<<endl; | ~~~~~^~~~~~ a.cc:8:37: error: expected ':' before ';' token 8 | cout<<cnt%2?"NO","YES"<<endl; | ^ | : a.cc:8:37: error: expected primary-expression before ';' token
s084164623
p03807
C++
#include<iostream> int main() { int x,cnt=0; std::cin>>x//直接忽略第一个数 while(std::cin>>x)cnt+=x%2; std::cout<<(cnt%2?"NO","YES"); return 0; }
a.cc: In function 'int main()': a.cc:5:20: error: expected ';' before 'while' 5 | std::cin>>x//直接忽略第一个数 | ^ | ; 6 | while(std::cin>>x)cnt+=x%2; | ~~~~~ a.cc:7:37: error: expected ':' before ')' token 7 | std::cout<<(cnt%2?"NO","YES"); | ^ | : a.cc:7:37: error: expected primary-expression before ')' token
s260964628
p03807
C++
#include<cstdio> int main() { int x,cnt=0; scanf("%d",&x);//直接忽略第一个数 while(~scanf("%d",&x))cnt+=x%2; printf("%s\n",(cnt%2?"NO","YES")); return 0; }
a.cc: In function 'int main()': a.cc:7:40: error: expected ':' before ')' token 7 | printf("%s\n",(cnt%2?"NO","YES")); | ^ | : a.cc:7:40: error: expected primary-expression before ')' token
s778171250
p03807
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> data(N); for(int i = 0; i < N; i++){ cin >> data.at(i); } int sum = 0; for(int i = 0; i < n; i++){ sum += data.at(i); } if(sum%2 == 0) cout << "YES" << endl; else cout << "NO" << endl; }
a.cc: In function 'int main()': a.cc:12:22: error: 'n' was not declared in this scope 12 | for(int i = 0; i < n; i++){ | ^
s729025901
p03807
C++
#include<iostream> #include<algorithm> using namespace std; int n,a[100001],ans=0;。 int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; ans+=a[i]; } if(ans%2==0)cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
a.cc:4:23: error: extended character 。 is not valid in an identifier 4 | int n,a[100001],ans=0;。 | ^ a.cc:4:23: error: '\U00003002' does not name a type 4 | int n,a[100001],ans=0;。 | ^~
s932178894
p03807
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(void){ int n,a[200000]; int even=0; scanf("%d",&n); for(count=1;count<=n;count++){ scanf("%d",&a[count]); } for(count=1;count<=n;count++){ if(a[count]%2==1){even++;} } if(even%2!=0){printf("NO");} else{printf("YES");} }
main.c: In function 'main': main.c:8:5: error: 'count' undeclared (first use in this function) 8 | for(count=1;count<=n;count++){ | ^~~~~ main.c:8:5: note: each undeclared identifier is reported only once for each function it appears in
s236198392
p03807
C++
import java.util.*; import static java.lang.Integer.*; import static java.lang.Long.*; import static java.lang.Math.*; import static java.lang.System.*; public class Main { public static void main(String[] args) { int i,j; Scanner sc = new Scanner(in); int n = parseInt(sc.next()); int[] a = new int[n]; int odd=0; int even=0; for (i = 0; i < a.length; i++) { a[i] = parseInt(sc.next()); if(a[i]%2==0) { even++; } else { odd++; } } sc.close(); boolean f=false; if(odd%2==1) { f=false; } else if((even+odd/2)%2==0) { f=true; } else { f=false; } out.println(f?"YES":"NO"); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import static java.lang.Integer.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import static java.lang.Long.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import static java.lang.Math.*; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import static java.lang.System.*; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: expected unqualified-id before 'public' 7 | public class Main { | ^~~~~~
s970151108
p03807
C++
#include<bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) #define ll long long using namespace std; int main(){ int n;cin>>n; int ec=0;oc=0; rep(i,n){ int t;cin>>t; if(t%2==0)ec++; else oc++; } if(oc%2 && ec>0) cout<<"NO"<<endl; else cout<<"YES"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:12: error: 'oc' was not declared in this scope; did you mean 'ec'? 10 | int ec=0;oc=0; | ^~ | ec
s949026820
p03807
C++
#include<iostream> #include<vector> using namespace std; int main(){ int a,d=0; cin>>a; vector<int>s(a); for(int i=0;i<a;i++){ cin>>s[i]; if(s[i]%2==1)d++; } if(b%2==0)cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:15: error: 'i\U0000ff1ca' was not declared in this scope 8 | for(int i=0;i<a;i++){ | ^~~~ a.cc:12:7: error: 'b' was not declared in this scope 12 | if(b%2==0)cout<<"YES"<<endl; | ^
s501571447
p03807
C++
#include<iostream> #include<vector> using namespace std; int main(){ int a,d=0; cin>>a; vector<int>s(a); for(int i=0;i<a;i++){ cin>>s[i]; if(s[i]%2==1)d++; } if(b%2==0)cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:15: error: 'i\U0000ff1ca' was not declared in this scope 8 | for(int i=0;i<a;i++){ | ^~~~ a.cc:8:24: error: '\U0000ff5b' was not declared in this scope 8 | for(int i=0;i<a;i++){ | ^~ a.cc:10:10: error: 'i' was not declared in this scope 10 | if(s[i]%2==1)d++; | ^ a.cc:11:5: error: '\U0000ff5d' was not declared in this scope 11 | } | ^~ a.cc:13:3: error: 'else' without a previous 'if' 13 | else cout<<"NO"<<endl; | ^~~~
s234460138
p03807
C++
#include<iostream> #include<vector> using namespace std; int main(){ int a,d=0; vector<int>s(a); for(int i=0;i<a;i++){ cin>>s[i]; if(s[i]%2==1)d++; } if(b%2==0)cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:15: error: 'i\U0000ff1ca' was not declared in this scope 7 | for(int i=0;i<a;i++){ | ^~~~ a.cc:7:24: error: '\U0000ff5b' was not declared in this scope 7 | for(int i=0;i<a;i++){ | ^~ a.cc:9:10: error: 'i' was not declared in this scope 9 | if(s[i]%2==1)d++; | ^ a.cc:10:5: error: '\U0000ff5d' was not declared in this scope 10 | } | ^~ a.cc:12:3: error: 'else' without a previous 'if' 12 | else cout<<"NO"<<endl; | ^~~~
s316086613
p03807
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int count = 0; for(int i = 0; i < n; i++){ cin >> a; if(a % 2 == 1) count++; } if(count % 2 == 0){ cout << "YES"; }else{ cout << "NO"; } }
a.cc: In function 'int main()': a.cc:9:12: error: 'a' was not declared in this scope 9 | cin >> a; | ^
s840139825
p03807
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int count = 0; for(int i = 0; i < n; i++){ cin >> a; (a % 2 == 1) count++; } if(count % 2 == 0){ cout << "YES"; }else{ cout << "NO"; } }
a.cc: In function 'int main()': a.cc:9:12: error: 'a' was not declared in this scope 9 | cin >> a; | ^
s603969553
p03807
C++
#include <bits/stdc++.h> typedef long long ll; #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, m, n) for(int i = m;i < n;i++) using namespace std; int gcd(int a, int b) { if (b==0) return a; else return gcd(b, a%b); } int lcm(int a, int b) { return a * b / gcd(a, b); } int main(){ ll N; cin>>N; vector<ll> A(N); ll sum=0; REP(i,N){ cint>>A[i]; if((A[i])%2==1) sum++; } if(sum%2==0){ cout<<"YES"<<endl; } else cout<<"NO"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:23:17: error: 'cint' was not declared in this scope; did you mean 'uint'? 23 | cint>>A[i]; | ^~~~ | uint
s682433484
p03807
C++
#include"bits/stdc++.h" #include"math.h" using namespace std; #define rep(i,n) for(int i=0;i<n;i++) typedef long long ll; int main(){ int n; cin >> n; vector<int> a(n); rep(i,n) cin >> a[i]; vector<int> b(n); int c=0; rep(i,n) b[i]=a[i]%2;c+=b[i]; if(c%2==0)cout << "YES" << endl; else cout << "NO" << endl;}
a.cc: In function 'int main()': a.cc:12:29: error: 'i' was not declared in this scope 12 | rep(i,n) b[i]=a[i]%2;c+=b[i]; | ^
s806244218
p03807
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<map> #include<set> #include<cstdio> #include<cmath> #include<numeric> #include<queue> #include<stack> #include<cstring> #include<limits> #include<functional> #include<unordered_set> #define rep(i,a) for(int i=(int)0;i<(int)a;++i) #define pb push_back #define eb emplace_back using ll=long long; constexpr ll mod = 1e9 + 7; constexpr ll INF = 1LL << 50; constexpr double pi=3.14159265358979; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } using namespace std; vector< bool > prime_table(int n) { vector< bool > prime(n + 1, true); if(n >= 0) prime[0] = false; if(n >= 1) prime[1] = false; for(int i = 2; i * i <= n; i++) { if(!prime[i]) continue; for(int j = i + i; j <= n; j += i) { prime[j] = false; } } return prime; } void solve(){ int n; cin>>n; int cnt=0; rep(i,n){ cin>>x; if(x%2)++cnt; } if(cnt%2)cout<<"YES\n"; else cout<<"NO\n"; return; } signed main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); solve(); return 0; }
a.cc: In function 'void solve()': a.cc:59:12: error: 'x' was not declared in this scope 59 | cin>>x; | ^
s446340349
p03807
C++
#include<bits/stdc++.h> #definr rep(i,n) for(int i=0;i<(n);++i) using namespace std; int main(){ int n,odd = 0,even = 0;cin >> n; rep(i,n){int a;cin >> a;if(a%2 == 0)even += 1;else odd += 1;} if(even*2 == odd)cout << "YES" << endl; else cout << "NO" << endl; return 0; }
a.cc:2:2: error: invalid preprocessing directive #definr; did you mean #define? 2 | #definr rep(i,n) for(int i=0;i<(n);++i) | ^~~~~~ | define a.cc: In function 'int main()': a.cc:7:7: error: 'i' was not declared in this scope 7 | rep(i,n){int a;cin >> a;if(a%2 == 0)even += 1;else odd += 1;} | ^ a.cc:7:3: error: 'rep' was not declared in this scope 7 | rep(i,n){int a;cin >> a;if(a%2 == 0)even += 1;else odd += 1;} | ^~~
s069960175
p03807
C++
#include <bits/stdc++.h> using namespace std; int main(void){ int n,f; cin >> n; for(int i=0;i<n;i++){ cin >> f >> s; if(f%2==1) count++; } if(count%2==1){ cout << "NO" << endl; } else{ cout << "YES" << endl; } }
a.cc: In function 'int main()': a.cc:8:17: error: 's' was not declared in this scope 8 | cin >> f >> s; | ^ a.cc:9:21: error: no post-increment operator for type 9 | if(f%2==1) count++; | ^~ a.cc:11:11: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator%' 11 | if(count%2==1){ | ~~~~~^~
s233786104
p03807
C
#include<stdio.h> int main(){ int odd=0,even=0,tmp,N; scanf("%d",&N); for(i=0;i<N;i++){ scanf("%d",&tmp); if(tmp%2 == 0) even++; else odd++; } if(odd%2==1){ puts("NO"); return 0; } even+=(odd/2); if(even%2==0) puts("YES"); else puts("NO"); return 0; }
main.c: In function 'main': main.c:6:7: error: 'i' undeclared (first use in this function) 6 | for(i=0;i<N;i++){ | ^ main.c:6:7: note: each undeclared identifier is reported only once for each function it appears in
s585691429
p03807
C++
#define INF LLONG_MAX #define ll long long #define ull unsigned long long #define rep(i,n) for(int i=0; i<n; ++i) #define MOD 1000000007 using namespace std; #include<stdio.h> template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;} template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;} inline void cinV(string &a){char buf[100000000]; scanf("%s", buf); a = buf;} inline void cinV(int &a){scanf("%d", &a);} int main() { int N; string NS; cinV(NS); N = atoi(NS.c_str()); int odd = 0; rep(i, N) { int A; cinV(A); if(A%2) ++odd; } printf("%s\n", odd%2?"NO":"YES"); }
a.cc:11:13: error: variable or field 'cinV' declared void 11 | inline void cinV(string &a){char buf[100000000]; scanf("%s", buf); a = buf;} | ^~~~ a.cc:11:18: error: 'string' was not declared in this scope 11 | inline void cinV(string &a){char buf[100000000]; scanf("%s", buf); a = buf;} | ^~~~~~ a.cc:9:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' 8 | #include<stdio.h> +++ |+#include <string> 9 | template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;} a.cc:11:26: error: 'a' was not declared in this scope 11 | inline void cinV(string &a){char buf[100000000]; scanf("%s", buf); a = buf;} | ^ a.cc: In function 'int main()': a.cc:15:10: error: 'string' was not declared in this scope 15 | int N; string NS; cinV(NS); N = atoi(NS.c_str()); | ^~~~~~ a.cc:15:10: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' a.cc:15:26: error: 'NS' was not declared in this scope; did you mean 'N'? 15 | int N; string NS; cinV(NS); N = atoi(NS.c_str()); | ^~ | N a.cc:15:35: error: 'atoi' was not declared in this scope 15 | int N; string NS; cinV(NS); N = atoi(NS.c_str()); | ^~~~
s931737883
p03807
C++
#define INF LLONG_MAX #define ll long long #define ull unsigned long long #define rep(i,n) for(int i=0; i<n; ++i) #define MOD 1000000007 using namespace std; template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;} template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;} inline void cinV(string &a){char buf[100000000]; scanf("%s", buf); a = buf;} inline void cinV(int &a){scanf("%d", &a);} int main() { int N; string NS; cinV(NS); N = atoi(NS.c_str()); int odd = 0; rep(i, N) { int A; cinV(A); if(A%2) ++odd; } printf("%s\n", odd%2?"NO":"YES"); }
a.cc:10:13: error: variable or field 'cinV' declared void 10 | inline void cinV(string &a){char buf[100000000]; scanf("%s", buf); a = buf;} | ^~~~ a.cc:10:18: error: 'string' was not declared in this scope 10 | inline void cinV(string &a){char buf[100000000]; scanf("%s", buf); a = buf;} | ^~~~~~ a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' +++ |+#include <string> 1 | a.cc:10:26: error: 'a' was not declared in this scope 10 | inline void cinV(string &a){char buf[100000000]; scanf("%s", buf); a = buf;} | ^ a.cc: In function 'void cinV(int&)': a.cc:11:26: error: 'scanf' was not declared in this scope 11 | inline void cinV(int &a){scanf("%d", &a);} | ^~~~~ a.cc: In function 'int main()': a.cc:14:10: error: 'string' was not declared in this scope 14 | int N; string NS; cinV(NS); N = atoi(NS.c_str()); | ^~~~~~ a.cc:14:10: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' a.cc:14:26: error: 'NS' was not declared in this scope; did you mean 'N'? 14 | int N; string NS; cinV(NS); N = atoi(NS.c_str()); | ^~ | N a.cc:14:35: error: 'atoi' was not declared in this scope 14 | int N; string NS; cinV(NS); N = atoi(NS.c_str()); | ^~~~ a.cc:20:3: error: 'printf' was not declared in this scope 20 | printf("%s\n", odd%2?"NO":"YES"); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 |
s237922054
p03807
C++
package main import ( "bufio" "fmt" "io" "math" "os" "strconv" "strings" ) func main() { solve(os.Stdin, os.Stdout) } type ReaderEx struct { baseScanner *bufio.Scanner words []string nextWordIdx func() int initWordIdx func() } func NewScannerEx(stdin io.Reader) *ReaderEx { var this ReaderEx var idx int this.baseScanner = bufio.NewScanner(stdin) this.baseScanner.Buffer(make([]byte, 0), 1E+8) this.nextWordIdx = func() int { cur := idx idx++ return cur } this.initWordIdx = func() { idx = 0 } return &this } func (me *ReaderEx) ScanAndSplit() (isScanned bool) { isScanned = me.baseScanner.Scan() me.words = strings.Fields(me.baseScanner.Text()) me.initWordIdx() return } func (me *ReaderEx) Scan() (ok bool) { ok = me.baseScanner.Scan() return } func (me *ReaderEx) getString() string { return me.baseScanner.Text() } func (me *ReaderEx) getInt() int { n, err := strconv.Atoi(me.baseScanner.Text()) defer func() { if err != nil { panic(err) } }() return n } func (me *ReaderEx) nextBytes() []byte { return []byte(me.words[me.nextWordIdx()]) } func (me *ReaderEx) nextString() string { return me.words[me.nextWordIdx()] } type StringArray []string func (me *ReaderEx) nextStringArray() StringArray { return me.words[me.nextWordIdx():] } func (me StringArray) toStrings() []string { return me } func (me StringArray) toInts() []int { strValues := me.toStrings() values := make([]int, len(strValues)) for i, v := range strValues { n, err := strconv.Atoi(v) if err != nil { panic(err) } values[i] = n } return values } func (me *ReaderEx) nextInt() int { n, err := strconv.Atoi(me.words[me.nextWordIdx()]) defer func() { if err != nil { panic(fmt.Sprintf("getInt(%d)", n)) } }() return n } func pow(x, y, mod int) (ans int) { ans = 1 for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 { if y&bit != 0 { ans *= x if mod > 0 { ans %= mod } } if bit <= 1 { return } ans *= ans if mod > 0 { ans %= mod } } } type factType struct { prime int count int } func fact(n int) (facts []factType) { for i := 2; i*i <= n; i++ { if n%i == 0 { fa := factType{prime: i} for n%fa.prime == 0 { n /= fa.prime fa.count++ } facts = append(facts, fa) } } if n > 1 { facts = append(facts, factType{prime: n, count: 1}) } return facts } func dec2bin(n int) (ret []bool) { for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 { ret = append(ret, n&bit != 0) if bit <= 1 { return } } } func abs(v int) int { if v < 0 { v = -v } return v } type kv struct { key int value int } func toInt(b bool) (i int) { if b { i = 1 } else { i = 0 } return } func toBool(i int) (b bool) { if i != 0 { b = true } else { b = false } return } func solve(stdin io.Reader, stdout io.Writer) { r := NewScannerEx(stdin) r.Scan() r.getInt() r.ScanAndSplit() a := r.nextStringArray().toInts() ok := 1 for _, v := range a { ok ^= toInt(v%2 == 1) } fmt.Fprintln(stdout, []string{"NO", "YES"}[ok]) }
a.cc:1:1: error: 'package' does not name a type 1 | package main | ^~~~~~~ a.cc:18:1: error: 'type' does not name a type; did you mean 'typeof'? 18 | type ReaderEx struct { | ^~~~ | typeof a.cc:25:1: error: 'func' does not name a type 25 | func NewScannerEx(stdin io.Reader) *ReaderEx { | ^~~~ a.cc:41:6: error: expected constructor, destructor, or type conversion before '(' token 41 | func (me *ReaderEx) ScanAndSplit() (isScanned bool) { | ^ a.cc:49:6: error: expected constructor, destructor, or type conversion before '(' token 49 | func (me *ReaderEx) Scan() (ok bool) { | ^ a.cc:53:6: error: expected constructor, destructor, or type conversion before '(' token 53 | func (me *ReaderEx) getString() string { | ^ a.cc:57:6: error: expected constructor, destructor, or type conversion before '(' token 57 | func (me *ReaderEx) getInt() int { | ^ a.cc:68:6: error: expected constructor, destructor, or type conversion before '(' token 68 | func (me *ReaderEx) nextBytes() []byte { | ^ a.cc:71:6: error: expected constructor, destructor, or type conversion before '(' token 71 | func (me *ReaderEx) nextString() string { | ^ a.cc:75:1: error: 'type' does not name a type; did you mean 'typeof'? 75 | type StringArray []string | ^~~~ | typeof a.cc:81:6: error: expected constructor, destructor, or type conversion before '(' token 81 | func (me StringArray) toStrings() []string { | ^ a.cc:85:6: error: expected constructor, destructor, or type conversion before '(' token 85 | func (me StringArray) toInts() []int { | ^ a.cc:97:6: error: expected constructor, destructor, or type conversion before '(' token 97 | func (me *ReaderEx) nextInt() int { | ^ a.cc:108:1: error: 'func' does not name a type 108 | func pow(x, y, mod int) (ans int) { | ^~~~ a.cc:128:1: error: 'type' does not name a type; did you mean 'typeof'? 128 | type factType struct { | ^~~~ | typeof a.cc:133:1: error: 'func' does not name a type 133 | func fact(n int) (facts []factType) { | ^~~~ a.cc:150:1: error: 'func' does not name a type 150 | func dec2bin(n int) (ret []bool) { | ^~~~ a.cc:161:1: error: 'func' does not name a type 161 | func abs(v int) int { | ^~~~ a.cc:168:1: error: 'type' does not name a type; did you mean 'typeof'? 168 | type kv struct { | ^~~~ | typeof a.cc:173:1: error: 'func' does not name a type 173 | func toInt(b bool) (i int) { | ^~~~ a.cc:181:1: error: 'func' does not name a type 181 | func toBool(i int) (b bool) { | ^~~~ a.cc:189:1: error: 'func' does not name a type 189 | func solve(stdin io.Reader, stdout io.Writer) { | ^~~~
s265042543
p03807
C++
#include <bits/stdc++.h> #define INF LLONG_MAX #define ll long long #define ull unsigned long long #define rep(i,n) for(int i=0; i<n; ++i) #define MOD 1000000007 using namespace std; template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;} template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;} inline void cinV(string &a){char buf[1E11L]; scanf("%s", buf); a = buf;} inline void cinV(int &a){scanf("%d", &a);} int main() { int N; string NS; cinV(NS); N = atoi(NS.c_str()); int odd = 0; rep(i, N) { int A; cinV(A); if(A%2) ++odd; } printf("%s\n", odd%2?"NO":"YES"); }
a.cc: In function 'void cinV(std::string&)': a.cc:10:38: error: conversion from 'long double' to 'long unsigned int' in a converted constant expression 10 | inline void cinV(string &a){char buf[1E11L]; scanf("%s", buf); a = buf;} | ^~~~~ a.cc:10:38: error: could not convert '1.0e+11l' from 'long double' to 'long unsigned int' 10 | inline void cinV(string &a){char buf[1E11L]; scanf("%s", buf); a = buf;} | ^~~~~ | | | long double a.cc:10:38: error: size of array 'buf' has non-integral type 'long double'
s573375591
p03807
C++
#include <bits/stdc++.h> #define INF LLONG_MAX #define ll long long #define ull unsigned long long #define rep(i,n) for(int i=0; i<n; ++i) #define MOD 1000000007 using namespace std; template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;} template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;} inline void cinV(string &a){char buf[1E11]; scanf("%s", buf); a = buf;} inline void cinV(int &a){scanf("%d", &a);} int main() { int N; string NS; cinV(NS); N = atoi(NS.c_str()); int odd = 0; rep(i, N) { int A; cinV(A); if(A%2) ++odd; } printf("%s\n", odd%2?"NO":"YES"); }
a.cc: In function 'void cinV(std::string&)': a.cc:10:38: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 10 | inline void cinV(string &a){char buf[1E11]; scanf("%s", buf); a = buf;} | ^~~~ a.cc:10:38: error: could not convert '1.0e+11' from 'double' to 'long unsigned int' 10 | inline void cinV(string &a){char buf[1E11]; scanf("%s", buf); a = buf;} | ^~~~ | | | double a.cc:10:38: error: size of array 'buf' has non-integral type 'double'
s580824437
p03807
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define REP(i, n) for(int i=0; i<n; i++) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } const ll MOD = 1e9+7; int main(){ itn N; cin >> N; int odd, even; odd = even = 0; REP(i,N){ ll a; cin >> a; if(a % 2) odd++; else even++; } if(odd % 2){ cout << "NO" << endl; } else{ cout << "YES" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:5: error: 'itn' was not declared in this scope; did you mean 'int'? 13 | itn N; | ^~~ | int a.cc:14:12: error: 'N' was not declared in this scope 14 | cin >> N; | ^
s476327755
p03807
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> l_l; typedef pair<int , int> i_i; typedef vector<ll> vel; typedef vector<int> vei; typedef vector<char> vec; typedef vector<bool> veb; typedef vector<string> ves; typedef vector<vector<ll>> ve_vel; typedef vector<vector<int>> ve_vei; typedef vector<vector<char>> ve_vec; typedef vector<vector<bool>> ve_veb; typedef vector<vector<string>> ve_ves; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<(int)(n);i++) #define rep2(i,n) for(int i=2;i<(int)(n);i++) #define repk(i,k,n) for(int i=k;i<(int)(n);i++) #define fs first #define sc second #define pub push_back #define puf push_front #define pob pop_back #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define maxel(a) *max_element(all(a)) #define minel(a) *min_element(all(a)) #define acc accumulate #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) #define mod (1000000007) template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vel A(N); int cnt0 = 0; int cnt1 = 0; rep(i,N) { cin >> A[i]; if(A[i] % 2 == 0) cnt0++; else cnt1++; } if(cnt1 % 2 == 0) { cnt0 += cnt1/2; if(cnt1 % 2 == 1) {cout << "NO" << endl; return 0;} while(cnt0 > 0){ cnt0 /= 2; if(cnt0 == 1) {cout << "YES" << endl; return 0;} } cout << "NO" << endl; return 0; } else { if(cnt0 == 0){ while(cnt1 > 0){ cnt1 /= 2; if(cnt1 == 1) {cout << "YES" << endl; return 0;} } cout << "NO" << endl; return 0; } else{ cout << "NO" << endl; return 0; } }
a.cc: In function 'int main()': a.cc:78:2: error: expected '}' at end of input 78 | } | ^ a.cc:38:11: note: to match this '{' 38 | int main(){ | ^
s972398259
p03807
C++
#include<iostream>//C++头文件 #include<algorithm>//标准头文件 #include<Hatsune_Miku>//AC头文件 using namespace std; int n,a[100001],ans=0;//根据题意定义,都在int范围内,ans用来记录和。 int main(){ cin>>n;//读入n for(int i=1;i<=n;i++){ cin>>a[i]; ans+=a[i];//记录总数值 } if(ans%2==0)cout<<"YES"<<endl;//满足题意,输出YES换行。 else cout<<"NO"<<endl;//不行就输出NO //大写!大写!大写! return 0;//结束 }
a.cc:3:9: fatal error: Hatsune_Miku: No such file or directory 3 | #include<Hatsune_Miku>//AC头文件 | ^~~~~~~~~~~~~~ compilation terminated.
s699125673
p03807
C++
#include<iostream> using namespace std; iont n,cnt; int main(){ ios::sync_with_stdio(0); cin>>n; for(int i=1;i<=n;i++){ int a; cin>>a; cnt += (a&1); } puts((cnt&1)?"NO":"YES"); return 0; }
a.cc:4:1: error: 'iont' does not name a type; did you mean 'int'? 4 | iont n,cnt; | ^~~~ | int a.cc: In function 'int main()': a.cc:7:14: error: 'n' was not declared in this scope 7 | cin>>n; | ^ a.cc:11:17: error: 'cnt' was not declared in this scope; did you mean 'int'? 11 | cnt += (a&1); | ^~~ | int a.cc:13:15: error: 'cnt' was not declared in this scope; did you mean 'int'? 13 | puts((cnt&1)?"NO":"YES"); | ^~~ | int
s066599827
p03807
C++
#include <bits/stdc++.h> #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++) #define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--) using ll = long long; using namespace std; ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; } //sort(a, a + N, greater<ll>()) // descend //sort(a, a+N) // ascend /* void comb(vector<vector <ll> > &v) { ll mod=1000000007; rep (i,0,v.size()) { v[i][0] = 1; v[i][i] = 1; } rep (k,1,v.size()) { rep (j,1,k) { v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%mod; } } } /*main内でnCn~nC0 生成 ** vector<vector<ll> > v(n + 1, vector<ll>(n + 1, 0)); comb(v); */ int main() { ll n; cin>>n; ll a[110000]; rep(i,0,n)cin>>a[i]; ll odd=0; ll even=0; rep(i,0,n){ if(a[i]%2) even++; else odd++;; } if(even%2==1))cout<<"NO"; else cout<<"YES"; }
a.cc: In function 'int main()': a.cc:41:22: error: expected primary-expression before ')' token 41 | if(even%2==1))cout<<"NO"; | ^