submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s328239101
p00042
C
const int MAX_N = 1000; // n????????§??? const int MAX_W = 5000; // W????????§??? // ??\??? int n, W; int w[MAX_N], v[MAX_N]; // ?????¢?????????????????? // dp[i][j]???i????????\?????????????????????????????????j??\?????????????????????????????¨??????????????????????????§????????¨?????? // -1????????????????±??????§?...
main.c:6:5: error: variably modified 'w' at file scope 6 | int w[MAX_N], v[MAX_N]; | ^ main.c:6:15: error: variably modified 'v' at file scope 6 | int w[MAX_N], v[MAX_N]; | ^ main.c:11:5: error: variably modified 'dp' at file scope 11 | int dp[MAX_N + 1][MAX_W + 1]; | ...
s340269876
p00042
C
const int MAX_N = 1000; // n????????§??? const int MAX_W = 5000; // W????????§??? // ??\??? int n, W; int w[MAX_N], v[MAX_N]; // DP???????????? // dp[i][j]???i????????\?????????????????????????????????j??\?????????????????????????????¨??????????????????????????§????????¨?????? int dp[MAX_N + 1][MAX_W + 1]; void solv...
main.c:6:5: error: variably modified 'w' at file scope 6 | int w[MAX_N], v[MAX_N]; | ^ main.c:6:15: error: variably modified 'v' at file scope 6 | int w[MAX_N], v[MAX_N]; | ^ main.c:10:5: error: variably modified 'dp' at file scope 10 | int dp[MAX_N + 1][MAX_W + 1]; | ...
s323993604
p00042
C
a
main.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input 1 | a | ^
s313072551
p00042
C
t[9999][9999],j;main(p,W,a,b,c){ for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){ for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--){ for(j=0;j<=W;j++){ t[c-1][j]=(j<a)?t[c][j]:(t[c][j]>t[c][j-a]+b)?t[c][j]:(t[c][j-a]+b); } } for(j=0;t[0][j]==t[0][W];j++) } }
main.c:1:1: warning: data definition has no type or storage class 1 | t[9999][9999],j;main(p,W,a,b,c){ | ^ main.c:1:1: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int] main.c:1:15: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 1 | t[9999][9999],j;main(p,W,a,b,c){...
s343232980
p00042
C
t[9999][9999],j;main(p,W,a,b,c){ for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){ for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--){ for(j=0;j<=W;j++){ t[c-1][j]=(j<a)?t[c][j]:(t[c][j]>t[c][j-a]+b)?t[c][j]:(t[c][j-a]+b); } } for(j=0;t[0][j]==t[0][W];j++) } return 0; }
main.c:1:1: warning: data definition has no type or storage class 1 | t[9999][9999],j;main(p,W,a,b,c){ | ^ main.c:1:1: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int] main.c:1:15: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 1 | t[9999][9999],j;main(p,W,a,b,c){...
s126399717
p00042
C
table[9999][9999],j; main(p,W,a,b,c){ for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,table[0][W],j)){ for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--){ for(j=0;j<=W;j++){ table[c-1][j]=(j<a)?table[c][j]:(table[c][j]>table[c][j-a]+b)?table[c][j]:(table[c][j-a]+b); } } for(j=0;table[0][j]==table[0]...
main.c:1:1: warning: data definition has no type or storage class 1 | table[9999][9999],j; | ^~~~~ main.c:1:1: error: type defaults to 'int' in declaration of 'table' [-Wimplicit-int] main.c:1:19: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 1 | table[9999][9999],j; | ...
s378143332
p00042
C
table[9999][9999],j; main(p,W,a,b,c){ for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,table[0][W],j)){ for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--){ for(j=0;j<=W;j++){ table[c-1][j]=(j<a)?table[c][j]:(table[c][j]>table[c][j-a]+b)?table[c][j]:(table[c][j-a]+b); } } for(j=0;table[0][j]==table[0]...
main.c:1:1: warning: data definition has no type or storage class 1 | table[9999][9999],j; | ^~~~~ main.c:1:1: error: type defaults to 'int' in declaration of 'table' [-Wimplicit-int] main.c:1:19: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 1 | table[9999][9999],j; | ...
s053981177
p00042
C
table[9999][9999],j; main(p,W,a,b,c){ for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,table[0][W],j)){ for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--){ for(j=0;j<=W;j++){ table[c-1][j]=(j<a)?table[c][j]:(table[c][j]>table[c][j-a]+b)?table[c][j]:(table[c][j-a]+b); } } for(j=0;table[0][j]!=table[0]...
main.c:1:1: warning: data definition has no type or storage class 1 | table[9999][9999],j; | ^~~~~ main.c:1:1: error: type defaults to 'int' in declaration of 'table' [-Wimplicit-int] main.c:1:19: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 1 | table[9999][9999],j; | ...
s188922731
p00042
C
table[9999][9999],j; main(p,W,a,b,c){ for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,table[0][W],j)){ for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--){ for(j=0;j<=W;j++){ table[c-1][j]=(j<a)?table[c][j]:(table[c][j]>table[c][j-a]+b)?table[c][j]:(table[c][j-a]+b); } } for(j=0;table[0][j]!=table[0]...
main.c:1:1: warning: data definition has no type or storage class 1 | table[9999][9999],j; | ^~~~~ main.c:1:1: error: type defaults to 'int' in declaration of 'table' [-Wimplicit-int] main.c:1:19: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 1 | table[9999][9999],j; | ...
s668563056
p00042
C
t[][],j;main(p,W,a,b,c){for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--)for(j=0;j<=W;j++)t[c-1][j]=(j<a)?t[c][j]:(t[c][j]>t[c][j-a]+b)?t[c][j]:(t[c][j-a]+b);for(j=0;t[0][j]-t[0][W];j++);}}
main.c:1:1: warning: data definition has no type or storage class 1 | t[][],j;main(p,W,a,b,c){for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--)for(j=0;j<=W;j++)t[c-1][j]=(j<a)?t[c][j]:(t[c][j]>t[c][j-a]+b)?t[c][j]:(t[c][j-a]+b);for(j=0;t[0][j]-t[0][W];...
s518756060
p00042
C
t[1e9][1e9],j;main(p,W,a,b,c){for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--)for(j=0;j<=W;j++)t[c-1][j]=(j<a)?t[c][j]:(t[c][j]>t[c][j-a]+b)?t[c][j]:(t[c][j-a]+b);for(j=0;t[0][j]-t[0][W];j++);}}
main.c:1:1: warning: data definition has no type or storage class 1 | t[1e9][1e9],j;main(p,W,a,b,c){for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--)for(j=0;j<=W;j++)t[c-1][j]=(j<a)?t[c][j]:(t[c][j]>t[c][j-a]+b)?t[c][j]:(t[c][j-a]+b);for(j=0;t[0][j]-t[...
s654149731
p00042
C
t[9e9][9e9],j;main(p,W,a,b,c){for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--)for(j=0;j<=W;j++)t[c-1][j]=(j<a)?t[c][j]:(t[c][j]>t[c][j-a]+b)?t[c][j]:(t[c][j-a]+b);for(j=0;t[0][j]-t[0][W];j++);}}
main.c:1:1: warning: data definition has no type or storage class 1 | t[9e9][9e9],j;main(p,W,a,b,c){for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--)for(j=0;j<=W;j++)t[c-1][j]=(j<a)?t[c][j]:(t[c][j]>t[c][j-a]+b)?t[c][j]:(t[c][j-a]+b);for(j=0;t[0][j]-t[...
s584931289
p00042
C
t[9999][9999],j;main(p,W,a,b,c){ for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){ for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--)for(j=0;j<=W;j++)t[c-1][j]=j<a?t[c][j]fmax(t[c][j],(t[c][j-a]+b)); for(j=0;t[0][j]==t[0][W];j++); } }
main.c:1:1: warning: data definition has no type or storage class 1 | t[9999][9999],j;main(p,W,a,b,c){ | ^ main.c:1:1: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int] main.c:1:15: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 1 | t[9999][9999],j;main(p,W,a,b,c){...
s056116383
p00042
C
t[9999][9999],j;main(p,W,a,b,c){ for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,t[0][W],j)){ for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);j=c--)for(j=0;j<=W;j++)t[c-1][j]=j<a?t[c][j]fmax(t[c][j],(t[c][j-a]+b)); for(;t[0][++j]!=t[0][W];); } }
main.c:2:1: warning: data definition has no type or storage class 2 | t[9999][9999],j;main(p,W,a,b,c){ | ^ main.c:2:1: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int] main.c:2:15: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 2 | t[9999][9999],j;main(p,W,a,b,c){...
s712019486
p00042
C
t[9999],W,N,a,b;main(c){for(;scanf("%d%d",&W,&N)-1;printf("Case %d:\n%d\n%d\n",c++,t[W],i),bzero(t,W*9)){for(;N--&&scanf("%d,%d",&a,&b);)for(i=W;i>=b;)t[i]=fmax(t[i--],t[i-b]+a);for(i=0;t[++i]-t[W];i);}}
main.c:1:1: warning: data definition has no type or storage class 1 | t[9999],W,N,a,b;main(c){for(;scanf("%d%d",&W,&N)-1;printf("Case %d:\n%d\n%d\n",c++,t[W],i),bzero(t,W*9)){for(;N--&&scanf("%d,%d",&a,&b);)for(i=W;i>=b;)t[i]=fmax(t[i--],t[i-b]+a);for(i=0;t[++i]-t[W];i);}} | ^ main.c:1:1: error: type defaults...
s136109405
p00042
C
t[9999],W,N,a,b;main(c){for(;scanf("%d%d",&W,&N)-1;printf("Case %d:\n%d\n%d\n",c++,t[W],i),bzero(t,W*9)){for(;N--&&scanf("%d,%d",&a,&b);)for(i=W;i>=b;)t[i]=fmax(t[i--],t[i-b]+a);for(i=0;t[++i]-t[W];i);}}
main.c:1:1: warning: data definition has no type or storage class 1 | t[9999],W,N,a,b;main(c){for(;scanf("%d%d",&W,&N)-1;printf("Case %d:\n%d\n%d\n",c++,t[W],i),bzero(t,W*9)){for(;N--&&scanf("%d,%d",&a,&b);)for(i=W;i>=b;)t[i]=fmax(t[i--],t[i-b]+a);for(i=0;t[++i]-t[W];i);}} | ^ main.c:1:1: error: type defaults...
s864666550
p00042
C
#include <stdio.h> main(){ int i,j,W,w,n,a[1000],b[1000],c[1000],maxc,minb,aa,ans,c; c=0; while(1){ c++; scanf("%d",&W); if(W==0) break; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d,%d",&a[i],&b[i]); c[i]=a[i]/b[i]; } w=0; ans=0; maxc=0; minb=1001; while(W>w)...
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int] 2 | main(){ | ^~~~ main.c: In function 'main': main.c:3:58: error: conflicting types for 'c'; have 'int' 3 | int i,j,W,w,n,a[1000],b[1000],c[1000],maxc,minb,aa,ans,c; | ^ main...
s729746159
p00042
C
#include <cstdio> #include <algorithm> using namespace std; const int MAX_N = 1010; const int MAX_W = 1010; int memo[MAX_N][MAX_W]; int W, N, v[MAX_N], w[MAX_N], min_w; int main() { for(int c = 1; ~scanf("%d", &W) && W; ++c) { scanf("%d", &N); for(int i = 0; i < N; ++i) scanf("%d,%...
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s768891314
p00042
C
#include <stdio.h> #include <vector> #include <algorithm> #define TEST 1 typedef std::pair<int,int> pi; struct Pred { bool operator()(const pi& f,const pi& s)//< { return f.second > s.second; } }; pi rec_check(const std::vector<pi> &data,int start,int remw) { if(start >=data.size() ) r...
main.c:2:10: fatal error: vector: No such file or directory 2 | #include <vector> | ^~~~~~~~ compilation terminated.
s424372757
p00042
C
#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <utility> #define mp make_pair #define f first #define s second #define dm(x) cerr << #x << " = " << x << endl; using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) typedef pair<int,int> pp; pp dp[1000][1000]; int p[1001]...
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s018519120
p00042
C
#include<stdio.h> int num; int limitWeight; int value[50],weight[50]; int maxV=0; void solve(int n,int sumV,int sumW){ if(sumW > limitWeight){ return; } else if(n==num){ if(sumV>=maxV){ maxV = sumV; } } else{ flag[n]=1; solve(n+1,sumV+value[n],sumW+weight[n]); solve(n+1,sumV,sumW); } return; } ...
main.c: In function 'solve': main.c:18:17: error: 'flag' undeclared (first use in this function) 18 | flag[n]=1; | ^~~~ main.c:18:17: note: each undeclared identifier is reported only once for each function it appears in
s351086677
p00042
C
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<stdarg.h> #include<malloc.h> #include<limits.h> int rec(int, int, int, int *, int *); int main() { int i, W, N, v[1024], w[1024]; while(1){ scanf("%d", &W); if(W == 0) ...
main.c: In function 'rec': main.c:46:23: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration] 46 | res = max(rec(i+1, j, N, v, w), rec(i+1, j-w[i], N, v, w) + v[i]); | ^~~ | fmax
s685089664
p00042
C
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<stdarg.h> #include<malloc.h> #include<limits.h> int min2(int, int); int dp[1005][10005][2]={0}; int main() { int i, j, W, N, v[1024], w[1024], c; c = 0; while(1){ scanf(...
main.c: In function 'main': main.c:49:65: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration] 49 | dp[i+1][j][1] = min(dp[i][j][1], dp[i][j-w[i]][1] + w[i]); | ...
s201400986
p00042
C++
#include <iostream> #include <map> #include <string> #include <vector> #include <algorithm> #define rep(i,n) for(int i=0; i < n;i++) using namespace std; int dp[1001][1001]; vector<string> split(const string &str, char delim){ vector<string> res; size_t current = 0, found; while((found = str.find_first_of(del...
a.cc: In function 'int main()': a.cc:33:17: error: 'memset' was not declared in this scope 33 | memset(dp,0,sizeof(dp)); | ^~~~~~ a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <algorithm> +++...
s602271335
p00042
C++
#include<iostream> #include<algorithm> int dp[1001][10001]; int v[1001], w[1001]; int main(){ int W; int k = 1; while (std::cin >> W, W){ int n; std::cin >> n; char a; for (int i = 0; i < n; i++)std::cin >> v[i] >> a >> w[i]; memset(dp, -1, sizeof(dp)); dp[1][0] = 0; dp[1][w[0]] = v[0]; for (in...
a.cc: In function 'int main()': a.cc:18:17: error: 'memset' was not declared in this scope 18 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<algorithm> +...
s522238140
p00042
C++
x=i=0 while(c=gets.to_i)>0 m=(1..gets.to_i).inject([0]*1e3){|s|v,w=gets.split(?,).map &:to_i;(0..c).map{|j|x=[s[j],w>j ?0:s[j-w]+v].max}} puts "Case #{i+=1}:",x,m.index(x) end
a.cc:3:4: error: too many decimal points in number 3 | m=(1..gets.to_i).inject([0]*1e3){|s|v,w=gets.split(?,).map &:to_i;(0..c).map{|j|x=[s[j],w>j ?0:s[j-w]+v].max}} | ^~~~~~~~~~~~ a.cc:3:68: error: too many decimal points in number 3 | m=(1..gets.to_i).inject([0]*1e3){|s|v,w=gets.split(?,).map &:to_i;...
s824149538
p00042
C++
#include <iostream> #include <algorithm> #include <vector> //#include <stack> //#include <queue> //#include <map> #include <cmath> //#include <string> //#include <sstream> #include <iomanip> //#include <complex> #include <stdio.h> //小数制度 cout << fixed << setprecision(5) << tmp << endl; using namespace std; #define ll...
a.cc: In function 'int main()': a.cc:36:22: error: 'awei' was not declared in this scope; did you mean 'wei'? 36 | for(int j=0;j<=awei;j++){ | ^~~~ | wei
s215236881
p00042
C++
#include<iostream> #define MAX_N 1001 #define MAX_W 1001 using namespace std; int dp[MAX_N][MAX_W]; int n,W; int w[MAX_N]; int v[MAX_N]; void solve(){ memset(dp,0,sizeof(dp)); cout<<"Case 1:"<<endl; for(int i=0;i<n;i++){ for(int j=0;j<=W;j++){ if(j>=w[i]){ dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i])...
a.cc: In function 'void solve()': a.cc:13:3: error: 'memset' was not declared in this scope 13 | memset(dp,0,sizeof(dp)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 |...
s753701363
p00042
C++
#include<iostream> #include<algorithm> #define MAX_N 1001 #define MAX_W 1001 using namespace std; int dp[MAX_N][MAX_W]; int n,W; int w[MAX_N]; int v[MAX_N]; void solve(){ memset(dp,0,sizeof(dp)); cout<<"Case 1:"<<endl; for(int i=0;i<n;i++){ for(int j=0;j<=W;j++){ if(j>=w[i]){ dp[i+1][j]=max(dp[i][j]...
a.cc: In function 'void solve()': a.cc:14:3: error: 'memset' was not declared in this scope 14 | memset(dp,0,sizeof(dp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<algorithm> +++ |+#include <cstring> 3 ...
s079763298
p00042
C++
#include <string> #include <vector> #include <algorithm> #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <queue> #include <map> #define INF 100000000 #define rep(i,a) for(int i=0;i<(a);i++) using namespace std; typedef long long ll; int dp[2000][20000]; //dp[i][j] i番目以前の物で、重さがj以...
a.cc: In function 'int main()': a.cc:46:9: error: 'memset' was not declared in this scope 46 | memset(dp,0,sizeof(dp)); | ^~~~~~ a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 9 | #include <map> +++ |+#include <cstring> ...
s777526189
p00042
C++
#include <string> #include <vector> #include <algorithm> #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <queue> #include <map> #define INF 100000000 #define rep(i,a) for(int i=0;i<(a);i++) using namespace std; typedef long long ll; int dp[2000][20000]; //dp[i][j] i番目以前の物で、重さがj以...
a.cc: In function 'int main()': a.cc:46:9: error: 'memset' was not declared in this scope 46 | memset(dp,0,sizeof(dp)); | ^~~~~~ a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 9 | #include <map> +++ |+#include <cstring> ...
s173122139
p00042
C++
#include <string> #include <cstring> #include <vector> #include <algorithm> #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <queue> #include <map> #define INF 100000000 #define rep(i,a) for(int i=0;i<(a);i++) using namespace std; typedef long long ll; short int dp[1001][10001]; /...
a.cc: In function 'void solve()': a.cc:29:29: error: no matching function for call to 'max(short int&, int)' 29 | dp[i][j]=max(dp[i+1][j],dp[i+1][j-W[i]]+V[i]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, ...
s524937782
p00042
C++
#include <iostream> #include <stack> #include <string> #include <vector> #include <queue> #include <algorithm> #include <stdlib.h> #include <math.h> #include <stdio.h> int max(int a,int b){ if(a>=b)return a; else return b; } int min(int a,int b){ if(a>=b)return b; else return a; } void swap(int *a,int *b){ int ...
a.cc: In function 'int main()': a.cc:98:23: error: 'Case' was not declared in this scope 98 | cout<<Case<<" "<<cnt<<":"<<endl; | ^~~~
s319754864
p00042
C++
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; #define MAX_N 1000 #define MAX_W 1000 int N, W; int v[MAX_N], w[MAX_N]; int memo[MAX_N][MAX_W]; int resW = 1e9; int solve(int index, int weight){ if(memo[index][weight] > 0) return memo[index][weight]; int res; if(index == N) res =...
a.cc: In function 'int main()': a.cc:44:5: error: 'memset' was not declared in this scope 44 | memset(memo, -1, sizeof(memo)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstri...
s919877224
p00042
C++
Case 1: 220 49 Case 2: 220 49
a.cc:1:1: error: 'Case' does not name a type 1 | Case 1: | ^~~~
s909256814
p00042
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; int w[1000],v[1000]; int W,N; int memo[1001][1001]; int func(int i,j){ if(memo[i][j]>=0)return memo[i][j]; int res; if(i==N)res=0; else if(j-w[i]<0)res=func(i+1,j); else res=max(func(i+1,j),func(i+1,j-w[i])+v[i]); ...
a.cc:8:16: error: 'j' has not been declared 8 | int func(int i,j){ | ^ a.cc: In function 'int func(int, int)': a.cc:9:16: error: 'j' was not declared in this scope 9 | if(memo[i][j]>=0)return memo[i][j]; | ^ a.cc:13:13: error: 'j' was not declared in this scope 1...
s787781111
p00042
C++
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; int main(){ int w,n,cnt=1; int dp[1006][10005],V[1001],W[1001]; while(cin>>w,w){ cin>>n; for(int i=0;i<n;i++)scanf("%d,%d",&V[i],&W[i]); int cnt=0;for(int i=0;i<n;i++)cnt+=W[i]; if(cnt>=10000)for(;;); for(int i=1;i<=n;i++){ fo...
a.cc: In function 'int main()': a.cc:17:40: error: expected ']' before '}' token 17 | if(dp[i | ^ | ] 18 | } | ~ a.cc:17:40...
s836264701
p00042
C++
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; int main(){ int w,n,cnt=1; int dp[1006][10005],V[1001],W[1001]; while(cin>>w,w){ cin>>n; for(int i=0;i<n;i++)scanf("%d,%d",&V[i],&W[i]); int cnt=0;for(int i=0;i<n;i++)cnt+=W[i]; if(cnt>=10000)for(;;); for(int i=1;i<=n;i++){ fo...
a.cc: In function 'int main()': a.cc:17:40: error: expected ']' before '}' token 17 | if(dp[i | ^ | ] 18 | } | ~ a.cc:17:40...
s921425649
p00042
C++
#include<iostream> using namespace std; int main(){ int dp[1001][1001]; int n,W; int v[1000],w[1000]; int num=0; while(cin>> W,W){ num++; cin>> n; for(int i=0;i<w+1;i++){ dp[0][i]=0; } for(int i=0;i<n;i++){ char c; cin>> v[i]>> c>> w[i]; } for(int i=1;i<=n;i++){...
a.cc: In function 'int main()': a.cc:11:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | for(int i=0;i<w+1;i++){ | ~^~~~
s712543533
p00042
C++
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int w,n; int kati[1111],omo[1111]; int memo[1111][1111]; int main(){ int cas=0; int anskati=0; int ansomo; int w,n; int kati[1111],omo[1111]; int memo[1111][1111]; while(1){ cas++; cin>>w; if(w==0) break; cin>>n; ...
a.cc: In function 'int main()': a.cc:20:20: error: 'W' was not declared in this scope 20 | for(int i=0;i<=W;i++){ | ^
s359049925
p00042
C++
#include <iostream> #include <cstdio> using namespace std; ll value[1000], weight[1000]; ll dp[1001][1001]; // dp[?¬?????????????][??????] = ?????§?????? int main() { int W; int c = 1; while ( cin >> W, W ) { int N; cin >> N; for (int i = 0; i < N; ++i) scanf("%d,%d", &value[i], &weight[i]); fill(&dp[0][0]...
a.cc:6:1: error: 'll' does not name a type 6 | ll value[1000], weight[1000]; | ^~ a.cc:7:1: error: 'll' does not name a type 7 | ll dp[1001][1001]; // dp[?¬?????????????][??????] = ?????§?????? | ^~ a.cc: In function 'int main()': a.cc:14:61: error: 'value' was not declared in this scope 14 | ...
s217424348
p00042
C++
#include<iostream> #include<vector> #include<algorithm> #include<string> #include<numeric> using namespace std; struct Treasure{ int Weight; int Worth; }; vector<int> TempMaxWorth; int GetMaxWorth(const int MaxWeight,vector<Treasure> nowTreasureCollection,vector<Treasure>::iterator& nowIterator,const vector<Treasur...
a.cc: In function 'int main()': a.cc:56:90: error: cannot bind non-const lvalue reference of type 'std::vector<Treasure>::iterator&' to an rvalue of type 'std::vector<Treasure>::iterator' 56 | GetMaxWorth(MaxWeight, NowTreasureCollection, AllTreasureCollection.begin(), AllTreasureCollection); |...
s972893184
p00042
C++
#include <cstdio> using namespace std; struct pre{ int v, w; }; int max(int a, int b){ return (a > b) a : b; } int main(){ const int MAX_N = 1000, MAX_W = 1000; int N, W; pre dat[MAX_N]; int dp[MAX_N][MAX_W + 1]; int p; for(int n = 1;; n++){ scanf("%d", &W); if(W == 0) break; scanf("%d", &N); for(in...
a.cc: In function 'int max(int, int)': a.cc:7:23: error: expected ';' before 'a' 7 | return (a > b) a : b; | ^~ | ;
s655578622
p00042
C++
#include <iostream> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <map> #include <cmath> #include <string> #include <sstream> #include <iomanip> #include <complex> using namespace std; #define ll long long #define vvi vector< vector<int> > #define vi vector<int> #define All(X) X.be...
a.cc: In function 'int solve(int, int)': a.cc:35:11: error: 'n' was not declared in this scope 35 | if(i == n) hoge = 0; | ^ a.cc:37:15: error: 'w' was not declared in this scope 37 | else if(j < w[i]) hoge = solve(i+1, j); | ^ a.cc:39:60: error: 'v' was not declared in thi...
s429450751
p00042
C++
#include<iostream> #include<vector> using namespace std; int main(){ int w,n,va,we; int dp[1000]; char c; vector<pair<int,int> >vec; while(cin>>w>>n,w){ for(int i=0;i<n;i++){ cin>>va>>c>>we; vec.push_back(make_pair(va, we)); } memset(dp,0,sizeof(...
a.cc: In function 'int main()': a.cc:16:9: error: 'memset' was not declared in this scope 16 | memset(dp,0,sizeof(dp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<vector> +++ |+#include <cstring>...
s563831805
p00042
C++
#include <iostream> #include <cstdio> #include <algorithm> #define MAX_N 1001 #define MAX_W 10001 int dp[MAX_W][MAX_N], W, N, value[MAX_N], w[MAX_N]; int main(){ int Case = 0; while(true){ for(int i = 0; i < MAX_N; ++i) memset(dp[i], 0, MAX_W); //initialize +...
a.cc: In function 'int main()': a.cc:15:13: error: 'memset' was not declared in this scope 15 | memset(dp[i], 0, MAX_W); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#incl...
s469336540
p00042
C++
#include<iostream> #include<cstdio> #include<algorithm> #include<map> using namespace std; typedef pair<int,int> P; int main(){ int W,N,cou=0; int tr[1001],we[1001]; while(cin >> W , W){ cou++; cin >> N; for(int i=1;i<=N;i++){ scanf("%d,%d",&tr[i],&we[i]); } P dp[1010][1001]; for(int i=0;i<=N;i++){ ...
a.cc: In function 'int main()': a.cc:57:10: error: expected '}' at end of input 57 | } | ^ a.cc:8:11: note: to match this '{' 8 | int main(){ | ^
s351823540
p00042
C++
#include <fstream> #include <iostream> #include <string> #include <vector> using namespace std; #define READ_BY_TEXT false vector<string> splitByDelimiter(string target, string delim) { std::string s = target; std::string delimiter = delim; size_t pos = 0; std::string token; vector<string> arr; ...
a.cc: In function 'int main()': a.cc:100:9: error: 'memset' was not declared in this scope 100 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <vector> +++ |+#include <cst...
s844670166
p00042
C++
#include <fstream> #include <iostream> #include <string> #include <vector> using namespace std; #define READ_BY_TEXT false vector<string> splitByDelimiter(string target, string delim) { std::string s = target; std::string delimiter = delim; size_t pos = 0; std::string token; vector<string> arr; ...
a.cc: In function 'int main()': a.cc:100:9: error: 'memset' was not declared in this scope 100 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <vector> +++ |+#include <cst...
s799904456
p00042
C++
// // others.cpp // sample // // Created by MIO-MACMINI on 2015/09/01. // Copyright (c) 2015??´ MIO-MACMINI. All rights reserved. // #include <fstream> #include <iostream> #include <string> #include <vector> using namespace std; #define READ_BY_TEXT false vector<string> splitByDelimiter(string target, string del...
a.cc: In function 'int main()': a.cc:108:9: error: 'memset' was not declared in this scope 108 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:13:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 12 | #include <vector> +++ |+#include <cs...
s746921397
p00042
C++
#include <fstream> #include <iostream> #include <string> #include <stdio.h> #include <vector> using namespace std; #define READ_BY_TEXT false vector<string> splitByDelimiter(string target, string delim) { std::string s = target; std::string delimiter = delim; size_t pos = 0; std::string token; vec...
a.cc: In function 'int main()': a.cc:101:9: error: 'memset' was not declared in this scope 101 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <vector> +++ |+#include <cst...
s860600423
p00042
C++
#include <fstream> #include <iostream> #include <string> #include <stdio> #include <vector> using namespace std; #define READ_BY_TEXT false vector<string> splitByDelimiter(string target, string delim) { std::string s = target; std::string delimiter = delim; size_t pos = 0; std::string token; vecto...
a.cc:4:10: fatal error: stdio: No such file or directory 4 | #include <stdio> | ^~~~~~~ compilation terminated.
s948510265
p00042
C++
#include <fstream> #include <iostream> #include <string> #include <stdio.h> #include <vector> using namespace std; #define READ_BY_TEXT false vector<string> splitByDelimiter(string target, string delim) { std::string s = target; std::string delimiter = delim; size_t pos = 0; std::string token; vec...
a.cc: In function 'int main()': a.cc:101:9: error: 'memset' was not declared in this scope 101 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <vector> +++ |+#include <cst...
s515455173
p00042
C++
#include<iostream> #include<cstdio> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define max_n 1000 #define max_w 10000 using namespace std; int N,W; int dp[max_n][max_w]; int dw[max_n][max_w]; int w[max_n],v[max_n]; int rec(int i,int j){ int res; if(dp[i][j]!=-1)return dp[i][j]; if(i==N){...
a.cc: In function 'int main()': a.cc:52:17: error: 'memset' was not declared in this scope 52 | memset(dp,-1,sizeof(dp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<cstdio> +++ |+...
s859815420
p00042
C++
# include <iostream> # include <algorithm> const int MAX_N = 1001; const int MAX_W = 1001; int t; int n, W; int v[MAX_N], w[MAX_N]; int dp[MAX_N][MAX_W]; int main() { while (1) { std::cin >> W; if (w == 0) break; std::cin >> n; char ch; for (int i = 1; i <= n; ++i) std::cin >> v[i] >> ch >> w[i]; ...
a.cc: In function 'int main()': a.cc:22:22: error: 'memset' is not a member of 'std'; did you mean 'wmemset'? 22 | std::memset(dp, 0, sizeof(dp)); | ^~~~~~ | wmemset
s934416746
p00042
C++
# include <iostream> # include <algorithm> const int MAX_N = 1001; const int MAX_W = 1001; int t; int n, W; int v[MAX_N], w[MAX_N]; int dp[MAX_N][MAX_W]; int main() { while (1) { std::cin >> W; if (w == 0) break; std::cin >> n; char ch; for (int i = 1; i <= n; ++i) std::cin >> v[i] >> ch >> w[i]; ...
a.cc: In function 'int main()': a.cc:22:22: error: 'memset' is not a member of 'std'; did you mean 'wmemset'? 22 | std::memset(dp, 0, sizeof(dp)); | ^~~~~~ | wmemset
s395633926
p00042
C++
# include <iostream> # include <algorithm> const int MAX_N = 1001; const int MAX_W = 1001; int t; int n, W; int v[MAX_N], w[MAX_N]; int dp[MAX_N][MAX_W]; int main() { while (1) { std::cin >> W; if (w == 0) break; std::cin >> n; char ch; for (int i = 1; i <= n; ++i) std::cin >> v[i] >> ch >> w[i]; ...
a.cc: In function 'int main()': a.cc:22:22: error: 'memset' is not a member of 'std'; did you mean 'wmemset'? 22 | std::memset(dp, 0, sizeof(dp)); | ^~~~~~ | wmemset
s074843449
p00042
C++
#include <iostream> #include <cstdio> #include <cstdlib> #include <time.h> #include <math.h> #include <vector> #include <queue> #include <map> #include <set> #include <algorithm> #include <iterator> #include <sstream> #include <string> #include <bitset> using namespace std; #define FOR(I,F,N) for(int I = F; I < (int)(N...
a.cc: In function 'void dfs(int, int, int)': a.cc:42:12: error: 'can' was not declared in this scope; did you mean 'tan'? 42 | if(can[index] < maxV)return; | ^~~ | tan a.cc: In function 'int main()': a.cc:80:21: error: 'can' was not declared in this scope; did you mean 'tan'...
s974084619
p00042
C++
#include <iostream> #include <cstdio> #define MAX(A, B) (A) > (B) ? (A) : (B) using namespace std; int dp[1001][1001]; int w[1000], v[1000]; int main() { int N, W; int c = 0; memset(dp, 0, sizeof dp); while (cin >> W, W) { cin >> N; for (int i = 0; i < N; i++) { scanf("%d,%d", &v[i], &w[i]); } for (i...
a.cc: In function 'int main()': a.cc:14:9: error: 'memset' was not declared in this scope 14 | memset(dp, 0, sizeof dp); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <cstdio> +++ |+#include <cstrin...
s008733634
p00042
C++
#include<bits/stdc++.h> using namespace std; int dp[1001][1001],wait[1001],value[1001]; void Initialization() { for(int i=0;i<1001;i++)for(int j=0;j<1001;j++)dp[i][j]=-1; } int power(int n) { int num=1; for(int i=1;i<=n;i++)num*=10; return num; } int serch(int i,int j,int n) { int num; if(dp[i][...
a.cc: In function 'int main()': a.cc:63:9: error: 'now' was not declared in this scope; did you mean 'pow'? 63 | now++; | ^~~ | pow
s022026820
p00042
C++
#define _USE_MATH_DEFINES #include<iostream> #include<iomanip> #include<algorithm> #include<bitset> #include<cctype> #include<climits> #include<cmath> #include<cstdio> #include<deque> #include<list> #include<map> #include<set> #include<stack> #include<string> #include<sstream> #include<queue> #include<vector> using nam...
a.cc: In function 'int main()': a.cc:73:17: error: 'memset' was not declared in this scope 73 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:18:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 17 | #include<queue> +++ ...
s419248790
p00042
C++
#include <iostream> #include <cstdio> #include <vector> #include <string> #include <map> #include <algorithm> #include <cmath> #include <random> 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)++) int caseId = 1; void solve42(int W) { cout << "...
a.cc: In function 'void solve42(int)': a.cc:30:21: error: 'dp' was not declared in this scope 30 | if (value < dp[i]) { | ^~
s335262641
p00042
C++
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; #define scanf scanf_s int a[10001] = { 0 }; int b[10001] = { 0 }; int w, n, mv, mw; void solve(int W, int f, int sum) { f = min(f, n) + 1; for (int i = f; i < n; i++) { if (W - b[i] < 1) { mw = max(w - W, mw); mv = max(sum, mv);...
a.cc: In function 'int main()': a.cc:6:15: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 6 | #define scanf scanf_s | ^~~~~~~ a.cc:31:25: note: in expansion of macro 'scanf' 31 | scanf("%d,%d", &a[i], &b[i]); | ^~~~...
s592469007
p00042
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; class treasure { public: int value, weight; bool have; }; treasure tre[1000]; int N,W, VALUE = 0, WEIGHT = 999999; void calcu() { int sum_v = 0, sum_w = 0; for (int i = 0; i < N; i++) { if (tre[i].have == true) { ...
a.cc: In function 'int main()': a.cc:71:25: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 71 | scanf_s("%d,%d", &tre[i].value, &tre[i].weight); | ^~~~~~~ | scanf
s316107860
p00042
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<stdio.h> using namespace std; class treasure { public: int value, weight; bool have; }; treasure tre[1000]; int N,W, VALUE = 0, WEIGHT = 999999; void calcu() { int sum_v = 0, sum_w = 0; for (int i = 0; i < N; i++) { if (tre[i].ha...
a.cc: In function 'int main()': a.cc:71:25: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 71 | scanf_s("%d,%d", &tre[i].value, &tre[i].weight); | ^~~~~~~ | scanf
s572331216
p00042
C++
#include <iostream> #include <array> #include <string> #include <tuple> #include <vector> using namespace std; using ll = long long; #define out(s) cout << (s) << endl; int dp[1001][1001]; int main() { int W, N, cnt = 1; cin >> W; while (W!=0) { cin >> N; memset(dp, -1, sizeof(dp)); dp[0][0] = 0; for (siz...
a.cc: In function 'int main()': a.cc:19:17: error: 'memset' was not declared in this scope 19 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <vector> +++...
s799092909
p00042
C++
#include <iostream> #include <array> #include <string> #include <tuple> #include <vector> #include<stdio.h> #include<string.h> using namespace std; //using ll = long long; #define out(s) cout << (s) << endl; int dp[1010][1010]; int main() { int W, N; cin >> W; vector<tuple<int, int>> anss; int cnt = 1; while (W!...
a.cc: In function 'int main()': a.cc:38:31: error: 'max_element' was not declared in this scope 38 | int dp_max = *max_element(dp[N], dp[N] + W + 1); | ^~~~~~~~~~~
s985705667
p00042
C++
const int MAX_N = 1000; // n????????§??? const int MAX_W = 5000; // W????????§??? // ??\??? int n, W; int w[MAX_N], v[MAX_N]; // ?????¢?????????????????? // dp[i][j]???i????????\?????????????????????????????????j??\?????????????????????????????¨??????????????????????????§????????¨?????? // -1????????????????±??????§?...
a.cc: In function 'int rec_dp(int, int)': a.cc:29:11: error: 'max' was not declared in this scope 29 | res = max( | ^~~ a.cc: In function 'void solve_dp()': a.cc:39:3: error: 'memset' was not declared in this scope 39 | memset(dp, -1, sizeof(dp)); // ?????¢??????????????????-1??§????????????...
s960514397
p00042
C++
const int MAX_N = 1000; // n????????§??? const int MAX_W = 5000; // W????????§??? // ??\??? int n, W; int w[MAX_N], v[MAX_N]; // DP???????????? // dp[i][j]???i????????\?????????????????????????????????j??\?????????????????????????????¨??????????????????????????§????????¨?????? int dp[MAX_N + 1][MAX_W + 1]; void solv...
a.cc: In function 'void solve_dp2()': a.cc:21:20: error: 'max' was not declared in this scope 21 | dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]); | ^~~ a.cc:24:3: error: 'cout' was not declared in this scope 24 | cout << dp[0][W] << endl; | ^~~~ a.cc:24:23: er...
s412761132
p00042
C++
const int MAX_N = 1000; // n????????§??? const int MAX_W = 5000; // W????????§??? // ??\??? int n, W; int w[MAX_N], v[MAX_N]; // DP???????????? // dp[i][j]???i????????\?????????????????????????????????j??\?????????????????????????????¨??????????????????????????§????????¨?????? int dp[MAX_N + 1][MAX_W + 1]; void solv...
a.cc: In function 'void solve_dp2()': a.cc:21:20: error: 'max' was not declared in this scope 21 | dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]); | ^~~ a.cc:24:3: error: 'cout' was not declared in this scope 24 | cout << dp[0][W] << endl; | ^~~~ a.cc:24:23: er...
s403034545
p00042
C++
const int MAX_N = 1000; // n????????§??? const int MAX_W = 5000; // W????????§??? // ??\??? int n, W; int w[MAX_N], v[MAX_N]; // DP???????????? // dp[i][j]???i????????\?????????????????????????????????j??\?????????????????????????????¨??????????????????????????§????????¨?????? int dp[MAX_N + 1][MAX_W + 1]; void solv...
a.cc: In function 'void solve_dp2()': a.cc:21:20: error: 'max' was not declared in this scope 21 | dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]); | ^~~ a.cc:24:3: error: 'cout' was not declared in this scope 24 | cout << dp[0][W] << endl; | ^~~~ a.cc:24:23: er...
s663771918
p00042
C++
#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<ctime> #include<cctype> #include<climits> #include<iostream> #include<string> #include<vector> #include<map> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<mem...
a.cc: In function 'int main()': a.cc:68:37: error: expected primary-expression before '<<' token 68 | cout<<"Case "<<cnt<<<<":"<<endl; | ^~
s686260068
p00042
C++
#include<iostream> #include<stdio.h> #include<algorithm> using namespace std; int dp[1001][1001]; int N, W; int v[1001], w[1001]; int solve(int i, int j) { if (dp[i][j] != -1)return dp[i][j]; int res; if (i == N)res = 0; else if (j < w[i])res = solve(i + 1, j); else { res = max( solve(i + 1, j), solve(i...
a.cc: In function 'int main()': a.cc:32:25: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 32 | scanf_s("%d,%d", v + i, w + i); | ^~~~~~~ | scanf
s467779256
p00042
C++
#include<iostream> using namespace std; int main(){ int W,N; int count = 0; while(cin >> W){ if(W==0) break; cin >> N; count++; int item[W+1]; for(int i=0;i<=W;i++) item[i]
a.cc: In function 'int main()': a.cc:11:34: error: expected ';' at end of input 11 | for(int i=0;i<=W;i++) item[i] | ^ | ; a.cc:11:34: error: expected '}' at end of input a.cc:6:18: note: to match this '{' 6 | while(cin >> W){ ...
s305320390
p00042
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; struct treasure{ int value; int weight; }; bool comp(treasure t1, treasure t2){ if(t1.weight <= t2.weight) return true; else return false; } int main(){ int w; const int maxw = 10000; int count = 1; while(cin >> w){ if(w == 0) ...
a.cc: In function 'int main()': a.cc:48:17: error: 'total' was not declared in this scope 48 | cout << total << endl; | ^~~~~
s221354571
p00042
C++
//0042 A Thief //—v–ñFƒiƒbƒvƒTƒbƒN–â‘è #include<iostream> #include<cstdlib> #include<algorithm> using namespace std; int main(void) { const int MAX_WEIGHT = 1000; const int MAX_OBJECT = 10000; const int MAX_SCORE = 1000; struct Obj { int w; int score; }; struct Cloth { int index; int totalScore; }...
a.cc: In function 'int main()': a.cc:33:17: error: 'memset' was not declared in this scope 33 | memset(intoIndex, 0xffffffff, sizeof(intoIndex)/sizeof(intoIndex[0])); | ^~~~~~ a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include...
s541133687
p00042
C++
#include<cstdio> #include<algorithm> #include<windows.h> using namespace std; int W,N,c; int w[1001],p[1001]; int dp[10001][1000]; int main(void){ while(scanf("%d", &W)&&W){ int ans; scanf("%d", &N); for(int i = 1; i <= N; i++){ scanf("%d,%d", &p[i], &w[i]); } for(int i = 1; i <= N; i++){ for(int j ...
a.cc:3:9: fatal error: windows.h: No such file or directory 3 | #include<windows.h> | ^~~~~~~~~~~ compilation terminated.
s123806154
p00042
C++
c[2001],w[2001]; dp[1002][2001]; #define max(a,b) a>b?a:b N,W,r,x;main(o,i,j){ for(;scanf("%d%d",&W,&N),W;printf("Case %d:\n%d\n%d\n",o++,r,x),memset(dp,0,sizeof dp)){ for(r=N;r--;)scanf("%d,%d",c+r,w+r); for(i=0;i<=N;i++)for(j=0;j<=W;j++){ //if(i)dp[i][j]=max(dp[i][j],dp[i-1][j]); dp[i+1][j+w[i]]=max(dp[i+1...
a.cc:1:1: error: 'c' does not name a type 1 | c[2001],w[2001]; | ^ a.cc:2:1: error: 'dp' does not name a type 2 | dp[1002][2001]; | ^~ a.cc:4:1: error: 'N' does not name a type 4 | N,W,r,x;main(o,i,j){ | ^ a.cc:4:13: error: expected constructor, destructor, or type conversion before '(' to...
s311448530
p00042
C++
t[9999][9999],j;main(p,W,a,b,c){ for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",p++,220,49)){ for(scanf("%d",&c);c&&scanf("%d,%d",&b,&a);c--); } }
a.cc:1:1: error: 't' does not name a type 1 | t[9999][9999],j;main(p,W,a,b,c){ | ^ a.cc:1:21: error: expected constructor, destructor, or type conversion before '(' token 1 | t[9999][9999],j;main(p,W,a,b,c){ | ^
s380745708
p00042
C++
#include <cstdio> #include <cstdlib> #include <cmath> #include <iostream> #include <sstream> #include <vector> #include <string> #include <queue> #include <set> #include <map> #include <utility> #include <algorithm> #include <functional> using namespace std; #define rep(i,n) for((i)=0;(i)<(int)(n);(i)++) #define fore...
a.cc:23:1: error: 'll' does not name a type 23 | ll dp[MAX][MAX]; | ^~ a.cc: In function 'int main()': a.cc:33:27: error: 'dp' was not declared in this scope 33 | rep(i,MAX) rep(j,MAX) dp[i][j] = 0; | ^~ a.cc:38:26: error: 'dp' was not declared in this scope 38 | ...
s684762936
p00042
C++
// DP #include <iostream> #include <cstdio> #include <algorithm> #define MAX_N 1001 #define MAX_W 1001 using namespace std; int main(){ int caseNum = 1; int ans; int W, n; int v[MAX_N]; int w[MAX_N]; int dp[MAX_N][MAX_W]; while(cin >> W){ if(W == 0){ break; } cin >> n; for (int i = 0; i < n; i++) { ...
a.cc: In function 'int main()': a.cc:25:17: error: 'memset' was not declared in this scope 25 | memset(dp, 0, sizeof(dp)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <algorithm> +...
s487532101
p00042
C++
#include<iostream> using namespace std; const int MAX_w = 1000; const int MAX_v = 10000; int dp[MAX_w + 1][MAX_v + 1]; int n, wet ; int w[MAX_w], v[MAX_v]; // i番目以降の品物から重さの和がj以下なるように選んだときの、 // 取りうる価値の総和の最大値を返す関数 int rec(int i, int j) { int res; if(dp[i][j] != -1){ return dp[i][j]; } if (i == n) { ...
a.cc: In function 'void solve(int)': a.cc:45:3: error: 'memset' was not declared in this scope 45 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> ...
s153753687
p00042
C++
#include <iostream> #include <algorithm> using namespace std; int W, N, casenum = 0, ans, wmin; int v[1000], w[1000]; int dp[1001][1001]; int rec_dp(int, int); void solve(); int main(){ int i; char c; while(1){ cin >> W >> N; if(W == 0) break; casenum++; for(i = 0; i < N; i++) cin >> v[i] >> ...
a.cc: In function 'int main()': a.cc:26:17: error: 'memset' was not declared in this scope 26 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <algorithm> ...
s579907504
p00042
C++
#include<iostream> #include<stdio.h> int dp[1000][10000]; int W; int n; int v[1000], w[1000]; int now = 1; int main() { while( 1 ){ memset( dp, 0, sizeof( dp ) ); scanf( "%d", &W ); if( !W ) break; scanf( "%d", &n ); for( int i = 0; i < n; i++ ){ scanf( "%d,%d", &v[i], &w[i] ); } for( int i = 0;...
a.cc: In function 'int main()': a.cc:13:17: error: 'memset' was not declared in this scope 13 | memset( dp, 0, sizeof( dp ) ); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> ...
s695931670
p00042
C++
// 他人のを拝借 #include <iostream>#include <algorithm>#include <cassert>#include <cctype>#include <cstdio>#include <math.h>#include <map>#include <queue>#include <string>using namespace std; int W,N,v[1000],w[1000],dp[1001][1001];char c; int main(){ int cn=0; while(cin>>W){ if(W==0)return 0; cn++; ...
a.cc:2:20: warning: extra tokens at end of #include directive 2 | #include <iostream>#include <algorithm>#include <cassert>#include <cctype>#include <cstdio>#include <math.h>#include <map>#include <queue>#include <string>using namespace std; int W,N,v[1000],w[1000],dp[1001][1001];char c; int main(){ int cn=0; ...
s482040905
p00042
C++
#include<iostream> #include<cstdio> using namespace std; int data[1000][2]; int dp[1000][1000]; int n,w; int solve(){ for(int i=1;i<=n;i++){ for(int j=1;j<=w;j++){ if(j >= data[i][1]){ dp[i][j] = max(dp[i-1][j],dp[i-1][j-data[i][1]]+data[i][0]); }else{ dp[i][j] =dp[i-1][1]; } } } return dp[n][...
a.cc: In function 'int solve()': a.cc:12:33: error: reference to 'data' is ambiguous 12 | if(j >= data[i][1]){ | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, ...
s127003667
p00042
C++
#include <iostream> #include <string> #include <math.h> #include <map> #include <stdio.h> #include <ctype.h> #include <algorithm> #include <stdlib.h> #include <stack> #include <queue> #include <bitset> using namespace std; int main() { int size; int case_count = 1; while(cin>>size){ //si...
a.cc: In function 'int main()': a.cc:44:13: error: 'memcpy' was not declared in this scope 44 | memcpy(dp_temp,dp,sizeof(dp)); | ^~~~~~ a.cc:12:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 11 | #include <bitset> +++ |+#...
s661111367
p00042
C++
import java.lang.*; import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String args[]) { for(int k=1; ;k++){ int W = sc.nextInt(); if(W==0)break; int n = sc.nextInt(); int[] dp = new int[W+1]; for(int i=0; i<W; i+...
a.cc:1:1: error: 'import' does not name a type 1 | import java.lang.*; | ^~~~~~ 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 java.util.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1...
s087331827
p00042
C++
// dpの練習 // dpでなく、愚直に組んだプログラミング // ナップサック問題とほぼ同じ #include <iostream> #include <algorithm> using namespace std; int wei; // 持てる最大の重さ int n; // お宝の数 int v[1001]; // お宝の価値 int w[1001]; // お宝の重さ // グローバル配列は0で初期化されている int dp[1001][1001]; //メモテーブル int max_value(int i, int j) { int value; if( dp[i][j] >= 0 ){ r...
a.cc: In function 'int main()': a.cc:62:5: error: 'memset' was not declared in this scope 62 | memset( dp , -1 , sizeof(dp) ); | ^~~~~~ a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 7 | #include <algorithm> +++ |+#include <cstri...
s485368195
p00042
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef pair<int, int> obj; int main(){ int N, W, weight, value; char ch; int case_num = 1; while(1){ cin >> W; if(W == 0) break; cin >> N; //printf("W = %d N = %d\n", W, N); vector<obj> obj_list; int d...
a.cc: In function 'int main()': a.cc:23:5: error: 'memset' was not declared in this scope 23 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> ...
s237169142
p00042
C++
#include<iostream> #include<algorithm> #include<cstdio> #include<vector> using namespace std; int N,W; struct Treasurea { int value; int weight; int flag; Treasurea() { value = 0; weight = 0; flag = false; } }; struct Memo { Treasurea record; bool flag; Memo() { flag = false; } }; Memo...
a.cc: In function 'int main()': a.cc:117:17: error: 'memset' was not declared in this scope 117 | memset(memo,0,sizeof(memo)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<vector> ++...
s634791542
p00042
C++
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; int dp[1001][1001]; int main() { int c = 1; while(1) { memset(dp, 0, sizeof(dp)); int w, n; cin>>w>>n; if(w == 0)break; int treasure[1000]; int price[1000]; for(int i = 0; i < n; i++) scanf("%d,%d", &price[i], &treasu...
a.cc: In function 'int main()': a.cc:15:17: error: 'memset' was not declared in this scope 15 | memset(dp, 0, sizeof(dp)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<cstdio> +++ |...
s149157744
p00042
C++
#include<iostream> #include<algorithm> #include<vector> #include<cstdio> #include<cstring> #include<cstdlib> using namespace std; struct Treasure { int value; int weight; Treasure() { value = 0; weight = 0; } void operator()( Treasure t) { cout << t.value << "," << t.weight << endl; }...
a.cc: In function 'Treasure& Knapsack(int&, int&)': a.cc:93:46: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int' 93 | t1 = Knapsack(currentWeight,currentCount + 1); | ~~~~~~~~~~~~~^~~ a.cc:78:44: note: initializing argument 2 of 'Trea...
s100256856
p00042
C++
#include <iostream> #include <stdio.h> #include <vector> using namespace std; int N; vector<int> w; vector<int> v; int dp[1001][1001]; void solve() { int W; int count = 1; while(cin >> W, W) { memset(dp, 0, sizeof(dp)); cin >> N; w.resize(N); v.resize(N); for(int i = 0; i < N; ++i) { scanf("%d,%d",...
a.cc: In function 'void solve()': a.cc:17:17: error: 'memset' was not declared in this scope 17 | memset(dp, 0, sizeof(dp)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <vector> ++...
s141700826
p00042
C++
#include "math.h" #include "stdio.h" #include <algorithm> #include <string> #include <vector> #include <iostream> using namespace std; /** Problem0042 : A Thief Time Limit Exceeded **/ #define MAX_N 1100 #define MAX_W 1100 int W, N, tre[1100][2]={0}, solW, solN; int dp[MAX_N][MAX_W]; pair<int, int> solve(int i, ...
a.cc: In function 'int main()': a.cc:55:17: error: 'memset' was not declared in this scope 55 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 6 | #include <iostream> +...
s155753668
p00042
C++
import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.lang.Math.*; public class Main { int INF = 1 << 28; //long INF = 1L << 62; double EPS = 1e-10; void run() { Scanner sc = new Scanner(System.in); for (int c=1;;c++) { int W = s...
a.cc:2:1: error: 'import' does not name a type 2 | import java.util.*; | ^~~~~~ 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 java.io.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: ...
s511141261
p00042
C++
#include <iostream> using namespace std; int W; int w[1001],v[1001]; int N; int dp[1001][1001]; int rec(int i, int j){ //テ」ツつづ」ツ??」ツつ?」ツ?」テ」ツ?? if(dp[i][j] >= 0){ return dp[i][j]; } int res; if(i == N){ // テ」ツつづ」ツ??・ツ督?ァツ可ゥテ」ツ?ッテァツ?。テ」ツ?? res = 0; }else if(j < w[i]){ // テ」ツ?禿」ツ?ョテ・ツ督?ァツ可ゥテ」ツ?ッテ...
a.cc: In function 'int main()': a.cc:56:5: error: 'memset' was not declared in this scope 56 | memset(dp,-1,sizeof(dp)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> ...
s709738572
p00042
C++
#include <iostream> using namespace std; int W; int w[1001],v[1001]; int N; int dp[1001][1001]; int rec(int i, int j){ //テ」ツつづ」ツ??」ツつ?」ツ?」テ」ツ?? if(dp[i][j] >= 0){ return dp[i][j]; } int res; if(i == N){ // テ」ツつづ」ツ??・ツ督?ァツ可ゥテ」ツ?ッテァツ?。テ」ツ?? res = 0; }else if(j < w[i]){ // テ」ツ?禿」ツ?ョテ・ツ督?ァツ可ゥテ」ツ?ッテ...
a.cc: In function 'int main()': a.cc:56:5: error: 'memset' was not declared in this scope 56 | memset(dp,-1,sizeof(dp)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> ...
s424038362
p00042
C++
#include <iostream> using namespace std; int W; int w[1001],v[1001]; int N; int dp[1001][1001]; int rec(int i, int j){ //もうやった if(dp[i][j] >= 0){ return dp[i][j]; } int res; if(i == N){ // もう品物は無い res = 0; }else if(j < w[i]){ // この品物は入らない res = rec(i + 1,j); }else{ // 品物を加えることが出来るとき ...
a.cc: In function 'int main()': a.cc:56:5: error: 'memset' was not declared in this scope 56 | memset(dp,-1,sizeof(dp)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> ...
s205284317
p00043
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; while((line=br.readLine)!=null){ int n=new int[10]; for(int i=0;i<13;i++){ n[(int)(line.charAt(i)-'1'+1)]++; } for(int i=1;i<=9;i++){ if(n[i]<...
Main.java:7: error: cannot find symbol while((line=br.readLine)!=null){ ^ symbol: variable readLine location: variable br of type BufferedReader Main.java:8: error: incompatible types: int[] cannot be converted to int int n=new int[10]; ^ Main.java:10: error: array required, but int found n[(i...