submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s004759070
p00491
C++
???
a.cc:1:1: error: expected unqualified-id before '?' token 1 | ??? | ^
s710118428
p00491
C++
#include <iostream> #include <vector> #include <array> #include <numeric> int f(int, int, int); int N; int yotei[100]; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int k, date; std::cin >> N >> k; for (int i = 0; i < k; i++) { std::cin >> date; std::cin >> yotei[date]; } std::cout << f(0, 0, 0) << "\n"; return 0; }
/usr/bin/ld: /tmp/ccmknkDS.o: in function `main': a.cc:(.text+0xb5): undefined reference to `f(int, int, int)' collect2: error: ld returned 1 exit status
s381478498
p00491
C++
int menu[101]; int dp[101][4][4]; int main() { int n, k; cin >> n >> k; int a, b; for (int i = 0; i < n; i++) { menu[i] = -1; } for (int i = 0; i < k; i++) { cin >> a >> b; menu[a - 1] = b - 1; } for (int i = 0; i < 3; i++) { if (menu[0] == -1 || menu[0] == i)dp[0][i][0] = 1; } for (int i = 0; i < n - 1; i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 2; k++) { if (dp[i][j][k]>0) { for (int l = 0; l < 3; l++) { if (menu[i + 1] == -1 || menu[i + 1] == l) { if (l != j) { dp[i + 1][l][0] += dp[i][j][k]; dp[i + 1][l][0] %= MOD; } if (l == j && k + 1 < 2) { dp[i + 1][l][k + 1] += dp[i][j][k]; dp[i + 1][l][k + 1] %= MOD; } } } } } } } int ans = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { ans += dp[n - 1][i][j]; ans %= MOD; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:6:9: error: 'cin' was not declared in this scope 6 | cin >> n >> k; | ^~~ a.cc:26:84: error: 'MOD' was not declared in this scope 26 | dp[i + 1][l][0] %= MOD; | ^~~ a.cc:30:88: error: 'MOD' was not declared in this scope 30 | dp[i + 1][l][k + 1] %= MOD; | ^~~ a.cc:42:32: error: 'MOD' was not declared in this scope 42 | ans %= MOD; | ^~~ a.cc:45:9: error: 'cout' was not declared in this scope 45 | cout << ans << endl; | ^~~~ a.cc:45:24: error: 'endl' was not declared in this scope 45 | cout << ans << endl; | ^~~~
s911777119
p00491
C++
#include <map> #include <vector> #include <deque> #include <iostream> using namespace std; map< pair< int , deque<int> > , int > memo; int scheduled[100]; int n , m; int f(int pos,deque<int> prev){ deque<int> current = prev; if( memo.count(make_pair(pos,prev)) ) return memo[make_pair(pos,prev)]; if(prev.size() == 3 && count(prev.begin(),prev.end(),prev[0]) == 3 ) return 0; if(pos == n) return 1; if(prev.size() == 3) prev.pop_front(); int ans = 0; if(scheduled[pos] == -1){ for(int i = 1 ; i <= 3 ; i++){ prev.push_back(i); ans = ( ans + f(pos+1,prev) ) % 10000; prev.pop_back(); } }else{ prev.push_back(scheduled[pos]); ans = ( ans + f(pos+1,prev) ) % 10000; } return memo[make_pair(pos,current)] = ans; } int main(){ memset(scheduled,-1,sizeof(scheduled)); cin >> n >> m; for(int i = 0 ; i < m ; i++){ int a,b; cin >> a >> b; a--; scheduled[a] = b; } cout << f(0,deque<int>()) << endl; }
a.cc: In function 'int f(int, std::deque<int>)': a.cc:15:32: error: 'count' was not declared in this scope 15 | if(prev.size() == 3 && count(prev.begin(),prev.end(),prev[0]) == 3 ) return 0; | ^~~~~ a.cc: In function 'int main()': a.cc:36:9: error: 'memset' was not declared in this scope 36 | memset(scheduled,-1,sizeof(scheduled)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <iostream> +++ |+#include <cstring> 5 | using namespace std;
s572128795
p00491
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int n; cin >>n; int k; cin >>k; int a[n][3][3];//n+1個の最後から2番目-1,1番目-1 int b[n]; int c; c=0; while(c<n){ b[c]=-1; c=c+1;} int d; int e; c=0; while(c<k){ cin >>d; cin >>e; b[d-1]=e-1; c=c+1;} int f; int h; c=0; while(c<3){ f=0; while(f<3){ h=0; if(b[0]!=c){if(b[0]!=-1){h=1;}} if(b[1]!=f){if(b[1]!=-1){h=1;}} if(h==1){a[1][c][f]=0;} if(h==0){a[1][c][f]=1;} f=f+1;} c=c+1;} int g; c=2; while(c<n){ f=0; while(f<3){ g=0; while(g<3){ a[c][f][g]=a[c-1][0][f]+a[c-1][1][f]+a[c-1][2][f]; if(f==g){a[c][f][g]=a[c][f][g]-a[c-1][f][f];} if(b[c]!=f){if(b[c]!=-1){a[c][f][g]=0;} a[c][f][g]=a[c][f][g]%10000 g=g+1;} f=f+1;} c=c+1;} cout << a[n-1][0][0]+a[n-1][0][1]+a[n-1][0][2]+a[n-1][1][0]+a[n-1][1][1]+a[n-1][1][2]+a[n-1][2][0]+a[n-1][2][1]+a[n-1][2][2]<<endl; }
a.cc: In function 'int main()': a.cc:47:28: error: expected ';' before 'g' 47 | a[c][f][g]=a[c][f][g]%10000 | ^ | ; 48 | g=g+1;} | ~ a.cc:52:2: error: expected '}' at end of input 52 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s684925388
p00491
C++
#include<iostream> #include<string> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n; int k; int q[200]={0}; int a,b; int ans=0; int mem[110][110][110]={{{0}}}; int check(int x,int y,int z);//x日目,前日y,前々日z int main(void){ cin>>n>>k; for(int i=0;i<k;i++){ cin>>a; cin>>b; q[a-1]=b; } cout<<check(0,0,0)<<endl; return 0; } int check(int x,int y,int z){ if(mem[x][y][z]!=0)return mem[x][y][z]; if(x==n){ return 1; } if(q[x]!=0){ if(q[x]==1){ if(y!=1||z!=1){ return check(x+1,1,y); } else return 0; } else if(q[x]==2){ if(y!=2||z!=2){ return check(x+1,2,y); } else return 0; } else if(q[x]==3){ if(y!=3||z!=3){ return check(x+1,3,y); } else return 0; } } else{ if(y!=z||y==0){ int a=check(x+1,1,y)+check(x+1,2,y)+check(x+1,3,y); a%=10000; mem[x][y][z]=a; return a; } else if(y==1){ int a=check(x+1,2,y)+check(x+1,3,y); a%=10000; mem[x][y][z]=a; return a; } else if(y==2){ int a=check(x+1,1,y)+check(x+1,3,y); a%=10000; return a; } else if(y==3){ int a=check(x+1,1,y)+check(x+1,2,y); a%=10000; mem[x][y][z]=a; return a; } }
a.cc: In function 'int check(int, int, int)': a.cc:86:6: error: expected '}' at end of input 86 | } | ^ a.cc:28:29: note: to match this '{' 28 | int check(int x,int y,int z){ | ^ a.cc:86:6: warning: control reaches end of non-void function [-Wreturn-type] 86 | } | ^
s278200586
p00491
C++
#include<iostream> #include<string> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n; int k; int q[200]={0}; int a,b; int ans=0; int mem[110][5][5]={{{0}}}; int check(int x,int y,int z);//x日目,前日y,前々日z int main(void){ cin>>n>>k; for(int i=0;i<k;i++){ cin>>a; cin>>b; q[a-1]=b; } cout<<check(0,0,0)<<endl; return 0; } int check(int x,int y,int z){ if(mem[x][y][z]!=0)return mem[x][y][z]; if(x==n){ return 1; } if(q[x]!=0){ if(q[x]==1){ if(y!=1||z!=1){ return check(x+1,1,y); } else return 0; } else if(q[x]==2){ if(y!=2||z!=2){ return check(x+1,2,y); } else return 0; } else if(q[x]==3){ if(y!=3||z!=3){ return check(x+1,3,y); } else return 0; } } else{ if(y!=z||y==0){ int a=check(x+1,1,y)+check(x+1,2,y)+check(x+1,3,y); a%=10000; mem[x][y][z]=a; return a; } else if(y==1){ int a=check(x+1,2,y)+check(x+1,3,y); a%=10000; mem[x][y][z]=a; return a; } else if(y==2){ int a=check(x+1,1,y)+check(x+1,3,y); a%=10000; return a; } else if(y==3){ int a=check(x+1,1,y)+check(x+1,2,y); a%=10000; mem[x][y][z]=a; return a; } }
a.cc: In function 'int check(int, int, int)': a.cc:86:6: error: expected '}' at end of input 86 | } | ^ a.cc:28:29: note: to match this '{' 28 | int check(int x,int y,int z){ | ^ a.cc:86:6: warning: control reaches end of non-void function [-Wreturn-type] 86 | } | ^
s415743305
p00491
C++
import java.util.*; public class Main { static int cnt=0; static int n; static void bfs(int a,int b,int c,int day){ if(a==b&&b==c)return; if(day-1==n){ cnt++; return; } a=b; b=c; if(hyou[day]>0){ bfs(a,b,hyou[day],day+1); }else{ for(int i=1;i<=3;i++){ if(a==b&&b==i){ continue; }else bfs(a,b,i,day+1); } } return; } static int hyou[] = new int[101]; public static void main(String[] args) { Scanner in = new Scanner(System.in); n = in.nextInt(); int k = in.nextInt(); for(int s=0;s<n;s++)hyou[s]=0; int a=0,b=0,c=0; boolean z=false,x=false,y=false; for(int i=0;i<k;i++){ int w = in.nextInt(); hyou[w]=in.nextInt(); if(w==1){ a=hyou[w]; z=true; } else if(w==2){ b=hyou[w]; x=true; } else if(w==3){ c=hyou[w]; y=true; } } for(int s=1;s<=3;s++){ if(!z)a=s; for(int i=1;i<=3;i++){ if(!x)b=i; for(int j=1;j<=3;j++){ if(!y)c=j; if(a==b&&a==c)continue; bfs(a,b,c,4); if(y)break; } if(x)break; } if(z)break; } System.out.println(cnt%10000); } }
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: expected unqualified-id before 'public' 2 | public class Main { | ^~~~~~
s231740031
p00491
C++
import java.util.*; public class Main { static int cnt=0; static int n; static void bfs(int a,int b,int c,int day){ if(a==b&&b==c)return; if(day-1==n){ cnt++; return; } a=b; b=c; if(hyou[day]>0){ bfs(a,b,hyou[day],day+1); }else{ for(int i=1;i<=3;i++){ if(a==b&&b==i){ continue; }else bfs(a,b,i,day+1); } } return; } static int hyou[] = new int[101]; public static void main(String[] args) { Scanner in = new Scanner(System.in); n = in.nextInt(); int k = in.nextInt(); for(int s=0;s<n;s++)hyou[s]=0; int a=0,b=0,c=0; boolean z=false,x=false,y=false; for(int i=0;i<k;i++){ int w = in.nextInt(); hyou[w]=in.nextInt(); if(w==1){ a=hyou[w]; z=true; } else if(w==2){ b=hyou[w]; x=true; } else if(w==3){ c=hyou[w]; y=true; } } for(int s=1;s<=3;s++){ if(!z)a=s; for(int i=1;i<=3;i++){ if(!x)b=i; for(int j=1;j<=3;j++){ if(!y)c=j; if(a==b&&a==c)continue; bfs(a,b,c,4); if(y)break; } if(x)break; } if(z)break; } System.out.println(cnt%10000); } }
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: expected unqualified-id before 'public' 2 | public class Main { | ^~~~~~
s761535298
p00491
C++
#include<iostream> using namespace std; int N,K,day,sosu; int plan[101]; int memo[101][4][4]; int solve(int n,int b1,int b2){ if(plan[n]!=0){ if(b1==b2&&b1==plan[n]) return 0; else return slove(n+1,plan[n],b1)%10000; } int t=0; for(int i=1;i<=3;++i){ if(b1==b2&&b1==i)continue; t+=solve(n+1,i,b1)%10000; } returm memo[n][b1][b2]=t%10000; } int main(){ cin>>N>>K; for(int i=0;i<K;i++){ cin>>day>>sosu; plan[day]=sosu; } for(int i=0;i<N;i++){ for(int j=0;j<4;j++){ for(int k=0;k<4;k++){ memo[i][j][k]=-1; } } } cout<<solve(1,0,0)<<endl; }
a.cc: In function 'int solve(int, int, int)': a.cc:12:15: error: 'slove' was not declared in this scope; did you mean 'solve'? 12 | return slove(n+1,plan[n],b1)%10000; | ^~~~~ | solve a.cc:19:5: error: 'returm' was not declared in this scope 19 | returm memo[n][b1][b2]=t%10000; | ^~~~~~
s844986828
p00492
Java
import java.util.*; public class Main{ int[][] a; boolean[][] f; int h, w, res, dy, dx; int[] xdir = {0, 1, 1, 1, 0, -1}; int[] ydir = {-1, -1, 0, 1, 1, 0}; int[] xdir2 = {-1, 0, 1, 0, -1, -1}; int[] ydir2 = {-1, -1, 0, 1, 1, 0}; Main(){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ w = sc.nextInt(); h = sc.nextInt(); a = new int[h+2][]; f = new boolean[h+2][]; for(int i = 0; i < h+2; ++i){ a[i] = new int[w+2]; f[i] = new boolean[w+2]; } for(int i = 1; i <= h; ++i) for(int j = 1; j <= w; ++j) a[i][j] = sc.nextInt(); dfs(0, 0); res = 0; for(int i = 0; i < h+2; ++i) for(int j = 0; j < w+2; ++j) if(f[i][j]) for(int k = 0; k < 6; ++k){ if(i%2 == 1){ dy = i+ydir[k]; dx = j+xdir[k];} else { dy = i+ydir2[k]; dx = j+xdir2[k];} if(0 <= dy && dy < h+2 && 0 <= dx && dx < w+2) res += a[dy][dx]; } System.out.printf("%d\n", res); } } void dfs(int y, int x){ f[y][x] = true; for(int i = 0; i < 6; ++i){ if(y%2 == 1){ dy = y+ydir[i]; dx = x+xdir[i];} else { dy = y+ydir2[i]; dx = x+xdir2[i];} if(0 <= dy && dy < h+2 && 0 <= dx && dx < w+2 && !f[dy][dx] && a[dy][dx]) dfs(dy, dx); } } public static void main(String[] args){ new Main(); } }
Main.java:52: error: bad operand types for binary operator '&&' if(0 <= dy && dy < h+2 && 0 <= dx && dx < w+2 && !f[dy][dx] && a[dy][dx]) dfs(dy, dx); ^ first type: boolean second type: int 1 error
s798373264
p00492
C
#include <stdio.h> int main(){ int x[102][102]; int y[102][102]; int i,j,h,w; scanf("%d%d",&w,&h); for(i=1;i<=w;i++){ for(j=1;j<=h;j++){ scanf("%d",&x[i][j]); } } for(i=0;i<=w+1;i++){ for(j=0;j<=h+1;j++){ y[i][j]=0; if(j%2==0){ if(x[i][j]==0){ if(x[i-1][j-1]==0){ y[i-1][j-1]=1; } if(x[i][j-1]==0){ y[i][j-1]=1; } if(x[i+1][j]==0){ y[i+1][j-1]=1; } if(x[i][j+1]==0){ y[i][j+1]=1; } if(x[i-1][j+1]==0){ y[i-1][j+1]=1; } if(x[i-1][j]==0){ y[i-1][j]=1; } } }
main.c: In function 'main': main.c:36:19: error: expected declaration or statement at end of input 36 | } | ^ main.c:36:19: error: expected declaration or statement at end of input main.c:36:19: error: expected declaration or statement at end of input
s738528668
p00492
C++
#include<iostream> using namespace std; #define rep(i,x) for(int i=0;i<x;i++) #define rep1(i,x) for(int i=1;i<=x;i++) const int nex[2][6] = { {110,1,-110,-1,-111,109}, {110,1,-110,-1,-109,111} }; int w,h,a[12100],ret; void dfs(int x,int y){ if(a[x][y] == 0){ a[x][y] = -1; rep(i,6)dfs(x + nex[x%2][i],y + nex[x%2][i]); } } int main(){ rep(i,110)rep(j,110){a[110i+j] = 0; if(i == 0 || i == 109 || j == 0 || j == 109)a[110*i+j] = -2;} cin >> w >> h; rep(i,h)rep(j,w)cin >> a[110*i+j+333]; dfs(1,1); rep1(i,108)rep1(j,108)rep(k,6)if(a[110*i+j]*a[i+nex[i%2][k]][j+nex[i%2][k]] < 0)ret ++; cout << ret/2 << endl; }
a.cc: In function 'void dfs(int, int)': a.cc:14:16: error: invalid types 'int[int]' for array subscript 14 | if(a[x][y] == 0){ | ^ a.cc:15:21: error: invalid types 'int[int]' for array subscript 15 | a[x][y] = -1; | ^ a.cc: In function 'int main()': a.cc:21:31: error: invalid types 'int [12100][__complex__ int]' for array subscript 21 | rep(i,110)rep(j,110){a[110i+j] = 0; if(i == 0 || i == 109 || j == 0 || j == 109)a[110*i+j] = -2;} | ^ a.cc:25:69: error: invalid types 'int[int]' for array subscript 25 | rep1(i,108)rep1(j,108)rep(k,6)if(a[110*i+j]*a[i+nex[i%2][k]][j+nex[i%2][k]] < 0)ret ++; | ^
s474093272
p00492
C++
#include<iostream> #include<cstdio> #include<queue> #include<algorithm> using namespace std; typedef pair<int, int> P; int W, H; int X[102][102]; int dx1[6] = { -1, 0, 0, 1, 1, 1 }; int dy1[6] = { 0, -1, 1, -1, 1, 0 }; int dx2[6] = { -1, -1, -1, 0, 0, 1 }; int dy2[6] = { -1, 0, 1, -1, 1, 0 }; int main() { scanf("%d%d", &W, &H); for (int i = 1; i <= H; i++){ for (int j = 1; j <= W; j++){ scanf("%d", &X[j][i]); } } for (int j = 1; j <= W; j++){ for (int i = 1; i <= H; i++){ if (X[j][i] == 0){ bool F[102][102]; memset(F, false, sizeof(F)); F[j][i] = true; priority_queue<P>que; que.push(make_pair(j,i)); while (!que.empty()){ P p = que.top(); que.pop(); if (p.second == 0 || p.second == H + 1 || p.first == 0 || p.first == W + 1)goto a; if (X[p.first][p.second])continue; if (p.second & 1){ for (int k = 0; k < 6; k++){ if (!F[p.first + dx1[k]][p.first + dy1[k]]){ F[p.first + dx1[k]][p.first + dy1[k]] = true; que.push(make_pair(p.first + dx1[k], p.second + dy1[k])); } } } else{ for (int k = 0; k < 6; k++){ if (!F[p.first + dx2[k]][p.first + dy2[k]]){ F[p.first + dx2[k]][p.first + dy2[k]] = true; que.push(make_pair(p.first + dx2[k], p.second + dy2[k])); } } } } X[j][i] = 1; a:; } } } int ans = 0; for (int i = 1; i <= W; i++){ for (int j = 1; j <= H; j++){ if (X[i][j] == 1){ if (j & 1){ for (int k = 0; k < 6; k++){ if (!X[i + dx1[k]][j + dy1[k]])ans++; } } else{ for (int k = 0; k < 6; k++){ if (!X[i + dx2[k]][j + dy2[k]])ans++; } } } } } printf("%d\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:25:33: error: 'memset' was not declared in this scope 25 | memset(F, false, sizeof(F)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<algorithm> +++ |+#include <cstring> 5 | using namespace std;
s214504137
p00492
C++
#include<iostream> using namespace std; int main(){ int n,m,x[110][110],y[110][110],sum=0; memset(x,0,sizeof(x)); cin>>m>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>x[i][j]; } } memset(y,0,sizeof(y)); for(int i=1;i<=m;i++){ if(x[1][i]==0){ y[1][i]=1; for(int j=1;j<100;j++){ for(int k=1;k<=n;k++){ for(int l=1;l<=m;l++){ if(x[k][l]==0){ if(x[k][l-1]==0){ y[k][l-1]=1; } if(x[k-1][l]==0){ y[k-1][l]=1; } if(k%2==0){ if(x[k-1][l-1]==0){ y[k-1][l-1]=1; } if(x[k+1][l-1]==0){ y[k+1][l-1]=1; } } if(x[k][l+1]==0){ y[k][l+1]=1; } if(x[k+1][l]==0){ y[k+1][l]=1; } if(k%2==1){ if(x[k+1][l+1]==0){ y[k+1][l+1]=1; } if(x[k-1][l+1]==0){ y[k-1][l+1]=1; } } } } } sum=0; } } } for(int i=1;i<=m;i++){ if(x[n][i]==0){ y[n][i]=1; for(int j=1;j<100;j++){ for(int k=1;k<=n;k++){ for(int l=1;l<=m;l++){ if(x[k][l]==0){ if(x[k][l-1]==0){ y[k][l-1]=1; } if(x[k-1][l]==0){ y[k-1][l]=1; } if(k%2==0){ if(x[k-1][l-1]==0){ y[k-1][l-1]=1; } if(x[k+1][l-1]==0){ y[k+1][l-1]=1; } } if(x[k][l+1]==0){ y[k][l+1]=1; } if(x[k+1][l]==0){ y[k+1][l]=1; } if(k%2==1){ if(x[k+1][l+1]==0){ y[k+1][l+1]=1; } if(x[k-1][l+1]==0){ y[k-1][l+1]=1; } } } } } sum=0; } } } for(int i=1;i<=n;i++){ if(x[i][1]==0){ y[i][1]=1; for(int j=1;j<100;j++){ for(int k=1;k<=n;k++){ for(int l=1;l<=m;l++){ if(x[k][l]==0){ if(x[k][l-1]==0){ y[k][l-1]=1; } if(x[k-1][l]==0){ y[k-1][l]=1; } if(k%2==0){ if(x[k-1][l-1]==0){ y[k-1][l-1]=1; } if(x[k+1][l-1]==0){ y[k+1][l-1]=1; } } if(x[k][l+1]==0){ y[k][l+1]=1; } if(x[k+1][l]==0){ y[k+1][l]=1; } if(k%2==1){ if(x[k+1][l+1]==0){ y[k+1][l+1]=1; } if(x[k-1][l+1]==0){ y[k-1][l+1]=1; } } } } } sum=0; } } } for(int i=1;i<=n;i++){ if(x[i][m]==0){ y[i][m]=1; for(int j=1;j<100;j++){ for(int k=1;k<=n;k++){ for(int l=1;l<=m;l++){ if(x[k][l]==0){ if(x[k][l-1]==0){ y[k][l-1]=1; } if(x[k-1][l]==0){ y[k-1][l]=1; } if(k%2==0){ if(x[k-1][l-1]==0){ y[k-1][l-1]=1; } if(x[k+1][l-1]==0){ y[k+1][l-1]=1; } } if(x[k][l+1]==0){ y[k][l+1]=1; } if(x[k+1][l]==0){ y[k+1][l]=1; } if(k%2==1){ if(x[k+1][l+1]==0){ y[k+1][l+1]=1; } if(x[k-1][l+1]==0){ y[k-1][l+1]=1; } } } } } sum=0; } } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(y[i][j]==0){ x[i][j]=1; } } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(x[i][j]==1){ if(x[i][j-1]==0){ sum++; } if(x[i][j+1]==0){ sum++; } if(x[i-1][j]==0){ sum++; } if(x[i+1][j]==0){ sum++; } if(i%2==0){ if(x[i-1][j-1]==0){ sum++; } if(x[i+1][j-1]==0){ sum++; } } if(i%2==1){ if(x[i-1][j+1]==0){ sum++; } if(x[i+1][j+1]==0){ sum++; } } } } } cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'memset' was not declared in this scope 6 | memset(x,0,sizeof(x)); | ^~~~~~ 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 | using namespace std;
s991134031
p00492
C++
#include <iostream> using namespace std; #include <cstring> #include <queue> #define MK make_pair int date[128][128], cnt[128][128]; int data_[120][120] = { 0 }; bool flg_date[128][128], flg_rec[128][128];//???????????????????????????????????????????????? int x_move[2][6] = { { +1,-1,+1,0,+1,0 }, { +1,-1,0,-1,0,-1 } }, y_move[2][6] = { { 0,0,+1,+1,-1,-1 }, { 0,0,+1,+1,-1,-1 } }; int rec(int x,int y,int count); int main(void){ int w, h; memset(cnt, 0, sizeof(cnt)); memset(date, -1, sizeof(date)); memset(flg_date, false, sizeof(flg_date)); memset(flg_rec, false, sizeof(flg_rec)); cin >> w >> h; for (int i = 1; i <= h+2; i++){ for (int j = 1; j <= w+2; j++){ if (i == 1 || i == h + 2 || j == 1 || j == w + 2){ date[i][j] = 0; continue; } cin >> date[i][j]; } } cout << rec(1, 1, 0) << endl <<; } int rec(int x, int y, int count){ flg_rec[y][x] = true; for (int k = 0; k < 6; k++){ if (!flg_rec[y + y_move[y % 2][k]][x + x_move[y % 2][k]] && date[y + y_move[y % 2][k]][x + x_move[y % 2][k]] == 0){ count = rec(x + x_move[y % 2][k], y + y_move[y % 2][k],count); } else if (date[y + y_move[y % 2][k]][x + x_move[y % 2][k]] == 1){ data_[y][x]++; count++; /*cout << x << ',' << y << ':' << x + x_move[y % 2][k] << ',' << y + y_move[y % 2][k] << endl;*/ cnt[y + y_move[y % 2][k]][x + x_move[y % 2][k]]++; } } return count; }
a.cc: In function 'int main()': a.cc:31:40: error: expected primary-expression before ';' token 31 | cout << rec(1, 1, 0) << endl <<; | ^
s581503471
p00492
C++
#include<iostream> #include<queue> using namespace std; int a[105][105];//1==??? int w,h; int d[2][6][2]={ {{1,-1},{1,0},{1,1},{0,-1},{0,1},{-1,0}}, {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,0}} }; int check(x,y){ int i,j,k; if(x<0 || x>=w || y<0 || y>=h)return 0; if(a[x][y]==1)return 0; if(a[x][y]==2)return 1; for(i=0;i<6;i++){ k=check(x+d[x%2][i][1],y+d[x%2][i][0]); if(k==1){ a[x][y]=2; return 1; } } a[x][y]=1; return 0; } int main(){ int i,j,k; int x,y; int s=0; cin>>h>>w; for(i=0;i<w;i++){ for(j=0;j<h;j++){ cin>>a[i][j]; if(i==0 || i==w-1 || j==0 || j==h-1){ if(a[i][j]==0)a[i][j]=2; } } } for(i=0;i<w;i++){ for(j=0;j<h;j++){ if(a[i][j]==0)check(i,j); } } for(i=0;i<w;i++){ for(j=0;j<h;j++){ if(a[i][j]!=1)continue; for(k=0;k<6;k++){ x=i+d[i%2][k][1]; y=j+d[i%2][k][0]; if(x<0 || x>=w || y<0 || y>=h){ s++; continue; } if(a[x][y]==2){ s++; } } } } for(i=0;i<w;i++){ for(j=0;j<h;j++){ cout<<a[i][j]<<" "; } cout<<endl; } cout<<s<<endl; }
a.cc:11:11: error: 'x' was not declared in this scope 11 | int check(x,y){ | ^ a.cc:11:13: error: 'y' was not declared in this scope 11 | int check(x,y){ | ^ a.cc:11:14: error: expression list treated as compound expression in initializer [-fpermissive] 11 | int check(x,y){ | ^ a.cc: In function 'int main()': a.cc:43:44: error: 'check' cannot be used as a function 43 | if(a[i][j]==0)check(i,j); | ~~~~~^~~~~
s960577728
p00492
C++
#include<unordered_map> #include<iostream> #include<string> #include<vector> #include<cmath> #include<queue> #include<map> #include<set> #include<list> #include<chrono> #include<cstdio> #include<iomanip> #include<algorithm> #include<functional> using namespace std; typedef long long ll; int h,w,a[100][100]; int solve(int i,int j){ for(int } int main(){ cin>>w>>h; for(int i=0;i<h;i++){ for(int j=0;j<w;j++) cin>>a[i][j]; } }
a.cc: In function 'int solve(int, int)': a.cc:20:1: error: expected unqualified-id before '}' token 20 | } | ^ a.cc:19:16: error: expected ';' before '}' token 19 | for(int | ^ | ; 20 | } | ~ a.cc:20:1: error: expected primary-expression before '}' token 20 | } | ^ a.cc:19:16: error: expected ';' before '}' token 19 | for(int | ^ | ; 20 | } | ~ a.cc:20:1: error: expected primary-expression before '}' token 20 | } | ^ a.cc:19:16: error: expected ')' before '}' token 19 | for(int | ~ ^ | ) 20 | } | ~ a.cc:20:1: error: expected primary-expression before '}' token 20 | } | ^ a.cc:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
s284461248
p00492
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <stdlib.h> #include <stdio.h> #include <bitset> #include <cstring> #include <deque> using namespace std; #define FOR(I,A,B) for(int I = (A); I < (B); ++I) #define CLR(mat) memset(mat, 0, sizeof(mat)) typedef long long ll; typedef pair<int, int> P; int vy[6] = {-1, -1, 0, 1, 1, 0}; int vx_0[6] = {0, 1, 1, 1, 0, -1}; int vx_1[6] = {-1, 0, 1, 0, -1, -1}; int W, H; int b[100][100]; bool checked[100][100]; vector<P> wh; bool bwb(int y, int x) { if(y < 0 || y >= H || x < 0 || x >= W) return false; if(checked[ny][nx] || b[ny][nx]) return true; checked[y][x] = true; wh.push_back(P(y,x)); bool ret = true; FOR(i,0,6) { int ny = y + vy[i]; int nx = x + (y % 2 ? vx_1[i] : vx_0[i]); ret &= bwb(ny, nx); } return ret; } int calc(int y, int x) { int ret = 0; FOR(i,0,6) { int ny = y + vy[i]; int nx = x + (y % 2 ? vx_1[i] : vx_0[i]); if(ny < 0 || ny >= H || nx < 0 || nx >= W || b[ny][nx] == 0) ret++; } return ret; } int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> W >> H; FOR(i,0,H) FOR(j,0,W) cin >> b[i][j]; FOR(y,0,H) { FOR(x,0,W) { if(checked[y][x] || b[y][x]) continue; wh.clear(); if(bwb(y, x)) { FOR(j,0,wh.size()) { b[wh[j].first][wh[j].second] = 1; } } } } int ans = 0; FOR(y,0,H) { FOR(x,0,W) { if(b[y][x]) ans += calc(y, x); } } cout << ans << endl; return 0; }
a.cc: In function 'bool bwb(int, int)': a.cc:32:14: error: 'ny' was not declared in this scope; did you mean 'y'? 32 | if(checked[ny][nx] || b[ny][nx]) return true; | ^~ | y a.cc:32:18: error: 'nx' was not declared in this scope; did you mean 'x'? 32 | if(checked[ny][nx] || b[ny][nx]) return true; | ^~ | x
s393071555
p00492
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <string> #include <cstring> #include <cctype> #include <cmath> #include <stack> #include <queue> #include <vector> #include <set> #include <map> #include <list> #include <stdio.h> #include <string.h> #include <cstdlib> #include <math.h> #include <bitset> #define INF 2000000000 using namespace std; int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1}; typedef long long ll; #define PL pair<long long, long long> #define P pair<int,int> #define mk make_pair #define en endl; #define WHITE 0 #define BLACK 2 #define GRAY 1 #define RE return 0; #define HERE cout<<" here"<<en #define out(value) cout<<value<<en int building[105][105]; int ranking[105][105]; bool done[105][105]; int ilumi_x[2][6]={{1,0,-1,-1,-1,0},{1,0,-1,0,1,1}}; int ilumi_y[2][6]={{0,1,1,0,-1,-1},{0,1,0,-1,1,-1}}; int main(){ int w,h; cin>>w>>h; for(int i=1; i<=h; i++) for(int j=1; j<=w; j++){ cin>>building[i][j]; done[i][j]=false; if(building[i][j]) continue; if(i==1||j==1||i==h||j==w) ranking[i][j]=1; } for(int i=1; i<=h; i++){ for(int j=1; j<=w; j++){ if(done[i][j]) continue; if(building[i][j]) continue; if(i==1||i==h||j==1||j==w){ ranking[i][j]=1; done[i][j]=1; queue<P> que; que.push(mk(i,j)); while(!que.empty()){ P p=que.top(); que.pop(); int yy=p.first,xx=p.second; for(int k=0; k<6; k++){ int x=xx+ilumi_x[yy%2][k]; int y=yy+ilumi_y[yy%2][k]; if(x<1||x>w||y<1||y>h) continue; if(done[y][x]==1) continue; if(building[y][x]==1) continue; done[y][x]=1; ranking[y][x]=1; que.push(mk(y,x)); } } } } } int ans=0; for(int i=1; i<=h; i++){ for(int j=1; j<=w; j++){ if(building[i][j]==0) continue; for(int k=0; k<6; k++){ int x=j+ilumi_x[i%2][k]; int y=i+ilumi_y[i%2][k]; if(y<1||y>h||x<1||x>w) { ans++; continue; } if(ranking[y][x]==1) ans++; } } } cout<<ans<<en }
a.cc: In function 'int main()': a.cc:62:19: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'? 62 | P p=que.top(); que.pop(); | ^~~ | pop
s091126753
p00492
C++
#include <cstdio> #include <queue> #include <algorithm> using namespace std; int pent[101][101],x[101][101]={},h,w,ans=0; typedef pair<int,int> P; queue<P>que; int main(){ scanf("%d %d",&h,&w); for(int i=1;i<=h;i++){ for(int j=1;j<=w;j++){ scanf("%d",&pent[j][i]); } } que.push(make_pair(0,0)); while(!que.size()){ P p=que.front; que.pop(); if(p.second%2==0){ for(int j=p.second-1;j<=p.second+1;j++){ if(j==p.second){ if(pent[p.first-1][j]==0){ x[p.first-1][j]=1; que.push(make_pair((p.first-1),j)); }else{ ans++;} if(pent[p.first+1][j]==0){ x[p.first+1][j]=1; que.push(make_pair((p.first+1),j)); }else{ ans++;} }else{ if(pent[p.first-1][j]==0){ x[p.first-1][j]=1; que.push(make_pair((p.first-1),j)); }else{ ans++;} if(pent[p.first][j]==0){ x[p.first][j]=1; que.push(make_pair((p.first),j)); }else{ ans++;} } } }else{ for(int j=p.second-1;j<=p.second+1;j++){ if(j==p.second){ if(pent[p.first-1][j]==0){ x[p.first-1][j]=1; que.push(make_pair((p.first-1),j)); }else{ ans++;} if(pent[p.first+1][j]==0){ x[p.first+1][j]=1; que.push(make_pair((p.first+1),j)); }else{ ans++;} }else{ if(pent[p.first][j]==0){ x[p.first][j]=1; que.push(make_pair((p.first),j)); }else{ ans++;} if(pent[p.first+1][j]==0){ x[p.first+1][j]=1; que.push(make_pair((p.first+1),j)); }else{ ans++;} } } } } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:17:12: error: conversion from '<unresolved overloaded function type>' to non-scalar type 'P' {aka 'std::pair<int, int>'} requested 17 | P p=que.front; que.pop(); | ~~~~^~~~~
s681276469
p00492
C++
#include<iostream> using namespace std; int mas[110][110]; bool d[110][110]; int dy[6]={-1,-1, 0, 0, 1, 1}; int dx_k[6]={ 0, 1,-1, 1, 0, 1}; int dx_g[6]={-1, 0,-1, 1,-1, 0}; int wall=0; int wall_len=0; void dfs(int,int); int main(){ int x,y; memset(d,sizeof(d),true); memset(mas,sizeof(mas),0); cin >> x >> y; for(int i=1;i<y+1;i++){ for(int j=1;j<x+1;j++){ cin >> mas[i][j]; } } /* for(int i=0;i<=y+1;i++){ for(int j=0;j<=x+1;j++){ cout << mas[i][j] << " "; } cout << endl; }*/ dfs(0,0); cout << wall_len << endl; } void dfs(int y,int x){ d[y][x]=false; for(int i=0;i<6;i++){ int ny=dy[i]; int nx; if(y&1) nx=x + dx_k[i];//yの1バイト目が1だったら(奇数だったら) else nx=x + dx_g[i]; if(ny>=0 && ny<=y+1 && nx>=0 && nx<=x+1 && d[ny][nx]==true){//規定範囲外に出ない間。 if(mas[ny][nx]==0){//壁がなかったら dfs(ny,nx); } else{//壁があったら wall_len++; } } } }
a.cc: In function 'int main()': a.cc:14:3: error: 'memset' was not declared in this scope 14 | memset(d,sizeof(d),true); | ^~~~~~ 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 | using namespace std;
s043483099
p00492
C++
#include<iostream> using namespace std; int mas[110][110]; bool d[110][110]; int dy[6]={-1,-1, 0, 0, 1, 1}; int dx_k[6]={ 0, 1,-1, 1, 0, 1}; int dx_g[6]={-1, 0,-1, 1,-1, 0}; int wall=0; int wall_len=0; void dfs(int,int); int main(){ int x,y; memset(d,true,sizeof(d)); memset(mas,0,sizeof(mas)); cin >> x >> y; for(int i=1;i<y+1;i++){ for(int j=1;j<x+1;j++){ cin >> mas[i][j]; } } /* for(int i=0;i<=y+1;i++){ for(int j=0;j<=x+1;j++){ cout << mas[i][j] << " "; } cout << endl; }*/ dfs(0,0); cout << wall_len + 1 << endl; } void dfs(int y,int x){ d[y][x]=false; for(int i=0;i<6;i++){ int ny=y + dy[i]; int nx; if(y&1) nx=x + dx_k[i];//yの1バイト目が1だったら(奇数だったら) else nx=x + dx_g[i]; if(ny>=0 && ny< 110 && nx>=0 && nx< 111 && d[ny][nx]==true){//規定範囲外に出ない間。 if(mas[ny][nx]==0){//壁がなかったら dfs(ny,nx); } else{//壁があったら wall_len++; } } } }
a.cc: In function 'int main()': a.cc:14:3: error: 'memset' was not declared in this scope 14 | memset(d,true,sizeof(d)); | ^~~~~~ 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 | using namespace std;
s931717705
p00493
C
#include <stdio.h> #include <string.h> #include <stdbool.h> #include <gmp.h> #define BUFFER_SIZE 555 bool isZigzag(mpz_t num) { char buffer[BUFFER_SIZE]; mpz_get_str(buffer, 10, num); int len = strlen(buffer); if (len <= 1) return true; // one digit number. int previous = buffer[0] - '0'; int current = buffer[1] - '0'; if (previous == current) return false; // same digits. if (len == 2) return true; // two digit number with different digits. bool flag = previous > current ? true : false; for (int i=2; i < len; i++) { previous = current; current = buffer[i] - '0'; if ((flag && previous >= current) || (!flag && previous <= current)) return false; else if (previous > current) flag = true; else flag = false; } return true; } int main() { mpz_t lower, upper, count; int m; char buffer[BUFFER_SIZE]; // initialize values. mpz_init(count); fgets(buffer, BUFFER_SIZE, stdin); mpz_init_set_str(lower, buffer, 10); fgets(buffer, BUFFER_SIZE, stdin); mpz_init_set_str(upper, buffer, 10); scanf("%d", &m); // set lower to a multiple of m. while (!mpz_divisible_ui_p(lower, m)) mpz_add_ui(lower, lower, 1); // count multiples that are also zig-zag number. while (mpz_cmp(lower, upper) <= 0) { if (isZigzag(lower)) { mpz_add_ui(count, count, 1); } mpz_add_ui(lower, lower, m); } // print result mpz_mod_ui(count, count, 10000); mpz_out_str(stdout, 10, count); puts(""); // free used memories. mpz_clear(lower); mpz_clear(upper); mpz_clear(count); return 0; }
/usr/bin/ld: /tmp/ccpcvBQx.o: in function `isZigzag': main.c:(.text+0x29): undefined reference to `__gmpz_get_str' /usr/bin/ld: /tmp/ccpcvBQx.o: in function `main': main.c:(.text+0x11f): undefined reference to `__gmpz_init' /usr/bin/ld: main.c:(.text+0x155): undefined reference to `__gmpz_init_set_str' /usr/bin/ld: main.c:(.text+0x18b): undefined reference to `__gmpz_init_set_str' /usr/bin/ld: main.c:(.text+0x1c0): undefined reference to `__gmpz_add_ui' /usr/bin/ld: main.c:(.text+0x1d5): undefined reference to `__gmpz_divisible_ui_p' /usr/bin/ld: main.c:(.text+0x203): undefined reference to `__gmpz_add_ui' /usr/bin/ld: main.c:(.text+0x21c): undefined reference to `__gmpz_add_ui' /usr/bin/ld: main.c:(.text+0x22f): undefined reference to `__gmpz_cmp' /usr/bin/ld: main.c:(.text+0x24b): undefined reference to `__gmpz_fdiv_r_ui' /usr/bin/ld: main.c:(.text+0x263): undefined reference to `__gmpz_out_str' /usr/bin/ld: main.c:(.text+0x27e): undefined reference to `__gmpz_clear' /usr/bin/ld: main.c:(.text+0x28a): undefined reference to `__gmpz_clear' /usr/bin/ld: main.c:(.text+0x296): undefined reference to `__gmpz_clear' collect2: error: ld returned 1 exit status
s447724366
p00493
C
#include <stdio.h> #include <string.h> #include <stdbool.h> #include <gmp.h> #define BUFFER_SIZE 555 bool isZigzag(mpz_t num) { int i; char buffer[BUFFER_SIZE]; mpz_get_str(buffer, 10, num); int len = strlen(buffer); if (len <= 1) return true; // one digit number. int previous = buffer[0] - '0'; int current = buffer[1] - '0'; if (previous == current) return false; // same digits. if (len == 2) return true; // two digit number with different digits. bool flag = previous > current ? true : false; for (i=2; i < len; i++) { previous = current; current = buffer[i] - '0'; if ((flag && previous >= current) || (!flag && previous <= current)) return false; else if (previous > current) flag = true; else flag = false; } return true; } int main() { mpz_t lower, upper, count; int m; char buffer[BUFFER_SIZE]; // initialize values. mpz_init(count); fgets(buffer, BUFFER_SIZE, stdin); mpz_init_set_str(lower, buffer, 10); fgets(buffer, BUFFER_SIZE, stdin); mpz_init_set_str(upper, buffer, 10); scanf("%d", &m); // set lower to a multiple of m. while (!mpz_divisible_ui_p(lower, m)) mpz_add_ui(lower, lower, 1); // count multiples that are also zig-zag number. while (mpz_cmp(lower, upper) <= 0) { if (isZigzag(lower)) { mpz_add_ui(count, count, 1); } mpz_add_ui(lower, lower, m); } // print result mpz_mod_ui(count, count, 10000); mpz_out_str(stdout, 10, count); puts(""); // free used memories. mpz_clear(lower); mpz_clear(upper); mpz_clear(count); return 0; }
/usr/bin/ld: /tmp/ccMNwQiG.o: in function `isZigzag': main.c:(.text+0x29): undefined reference to `__gmpz_get_str' /usr/bin/ld: /tmp/ccMNwQiG.o: in function `main': main.c:(.text+0x11f): undefined reference to `__gmpz_init' /usr/bin/ld: main.c:(.text+0x155): undefined reference to `__gmpz_init_set_str' /usr/bin/ld: main.c:(.text+0x18b): undefined reference to `__gmpz_init_set_str' /usr/bin/ld: main.c:(.text+0x1c0): undefined reference to `__gmpz_add_ui' /usr/bin/ld: main.c:(.text+0x1d5): undefined reference to `__gmpz_divisible_ui_p' /usr/bin/ld: main.c:(.text+0x203): undefined reference to `__gmpz_add_ui' /usr/bin/ld: main.c:(.text+0x21c): undefined reference to `__gmpz_add_ui' /usr/bin/ld: main.c:(.text+0x22f): undefined reference to `__gmpz_cmp' /usr/bin/ld: main.c:(.text+0x24b): undefined reference to `__gmpz_fdiv_r_ui' /usr/bin/ld: main.c:(.text+0x263): undefined reference to `__gmpz_out_str' /usr/bin/ld: main.c:(.text+0x27e): undefined reference to `__gmpz_clear' /usr/bin/ld: main.c:(.text+0x28a): undefined reference to `__gmpz_clear' /usr/bin/ld: main.c:(.text+0x296): undefined reference to `__gmpz_clear' collect2: error: ld returned 1 exit status
s150397976
p00493
C++
#include <iostream> using namespace std; constexpr int mod = 10000000; constexpr int MAX_DIGIT = 500; constexpr int MAX_M = 500; int dp[MAX_DIGIT + 1][MAX_M][10][2][2]; // digit, modulo m, prev, less flag, zig-zag flag int calc(const string &limit, int m) { const int n = limit.size(); memset(dp, 0, sizeof(dp)); for(int i = 0; i < n; ++i) { for(int j = 0; j < 10; ++j) { const bool lt = (j < limit[i] - '0'); const bool le = (j <= limit[i] - '0'); if(j && (i || le)) { (dp[i + 1][j % m][j][i || lt][true] += 1) %= mod; (dp[i + 1][j % m][j][i || lt][false] += 1) %= mod; } for(int k = 0; k < m; ++k) { const int next_rest = (k * 10 + j) % m; for(int l = 0; l < j; ++l) { (dp[i + 1][next_rest][j][true][true] += dp[i][k][l][true][false]) %= mod; if(le) { (dp[i + 1][next_rest][j][lt][true] += dp[i][k][l][false][false]) %= mod; } } for(int l = j + 1; l < 10; ++l) { (dp[i + 1][next_rest][j][true][false] += dp[i][k][l][true][true]) %= mod; if(le) { (dp[i + 1][next_rest][j][lt][false] += dp[i][k][l][false][true]) %= mod; } } } } } int res = 0; for(int i = 0; i < 10; ++i) { res += dp[n][0][i][true][true]; res += dp[n][0][i][true][false]; if(i && (n > 1 || i < limit.back() - '0') && i % m == 0) { --res; } } return res % mod; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string a, b; int m; cin >> a >> b >> m; int carry = 1; for(int i = b.size() - 1; i >= 0; --i) { b[i] += carry; if(b[i] <= '9') { carry = 0; break; } else { b[i] = '0'; } } if(carry) b = '1' + b; cout << (calc(b, m) - calc(a, m) + mod) % mod << endl; return EXIT_SUCCESS; }
a.cc: In function 'int calc(const std::string&, int)': a.cc:13:9: 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 | using namespace std;
s432642588
p00493
C++
#include <string> #include <vector> #include <sstream> #include <iostream> #include <algorithm> #include <map> #include <list> #include <set> #include <numeric> #include <queue> #include <stack> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <cstring> #include <climits> #include <cfloat> #include <ctime> #include <complex> #include <cassert> #include <iomanip> using namespace std; typedef long long LL; typedef pair<int,int> P; int M; int dp[2][2][2][10][500]={}; int num(string s, int rem){ memset(dp,0,sizeof(dp)); auto cur=dp[0]; auto nex=dp[1]; int order=10%M; for(int k=0;k<10;k++){ cur[0][0][k][k%M]=cur[1][0][k][k%M]=1; if(k<=s[0]-'0'){ cur[0][1][k][k%M]=cur[1][1][k][k%M]=1; } } int ret=0; ret/=2; ret%=10000; for(int i=1;i<s.size();i++){ for(int k=1;k<10;k++){ //cout << k << ": " << cur[0][0][k][0] << ", " << cur[1][0][k][0] << endl; ret+=cur[0][0][k][rem]+cur[1][0][k][rem]; } if(i==1){ ret/=2; } //cout << i << ", " << ret << endl; ret%=10000; for(int r=0;r<M;r++){ for(int k=1;k<10;k++){ cur[0][0][k][r]+=cur[0][0][k-1][r]; cur[0][0][k][r]%=10000; cur[0][1][k][r]+=cur[0][1][k-1][r]; cur[0][1][k][r]%=10000; } for(int k=8;k>=0;k--){ cur[1][0][k][r]+=cur[1][0][k+1][r]; cur[1][0][k][r]%=10000; cur[1][1][k][r]+=cur[1][1][k+1][r]; cur[1][1][k][r]%=10000; } } for(int k=0;k<10;k++){ int v=(order*k)%M; for(int r=0;r<M;r++){ if(k>0){ nex[1][0][k][r]=cur[0][0][k-1][(r-v+M)%M]; if(k<s[i]-'0'){ nex[1][1][k][r]=nex[1][0][k][r]; } else if (s[i]-'0'==k) { nex[1][1][k][r]=cur[0][1][k-1][(r-v+M)%M]; } else { nex[1][1][k][r]=0; } } else { nex[1][0][k][r]=0; nex[1][1][k][r]=0; } if(k<9){ nex[0][0][k][r]=cur[1][0][k+1][(r-v+M)%M]; if(k<s[i]-'0'){ nex[0][1][k][r]=nex[0][0][k][r]; } else if(s[i]-'0'==k){ //cout << "aaa " << k << ": " << v << ", " << cur[1][1][k+1][(r-v+M)%M] << endl; nex[0][1][k][r]=cur[1][1][k+1][(r-v+M)%M]; } else { nex[0][1][k][r]=0; } } else { nex[0][0][k][r]=0; nex[0][1][k][r]=0; } } } order*=10; order%=M; swap(cur,nex); } for(int k=1;k<=s[s.size()-1]-'0';k++){ //cout << k << ", " << cur[0][1][k][0] << ", " << cur[1][1][k][0] << endl; ret+=cur[0][1][k][rem]+cur[1][1][k][rem]; } if(s.size()==1){ ret/=2; } ret%=10000; return ret; } int num2(string a, int rem){ reverse(a.begin(),a.end()); istringstream istr(a); int v; istr >> v; int ret=0; for(int i=rem;i<=v;i+=M){ if(i==0)continue; ostringstream ostr;
a.cc: In function 'int num2(std::string, int)': a.cc:132:36: error: expected '}' at end of input 132 | ostringstream ostr; | ^ a.cc:130:33: note: to match this '{' 130 | for(int i=rem;i<=v;i+=M){ | ^ a.cc:132:36: error: expected '}' at end of input 132 | ostringstream ostr; | ^ a.cc:124:28: note: to match this '{' 124 | int num2(string a, int rem){ | ^ a.cc:132:36: warning: no return statement in function returning non-void [-Wreturn-type] 132 | ostringstream ostr; | ^
s425059529
p00493
C++
#include<iostream> #include<cstdio> #include<vector> #include<algorithm> #include<cmath> #include<queue> #include<stack> #include<functional> #include<string> using namespace std; #define LATTE 10000 int dp[502][10][500][2][3]; int main(){ char A[502],B[502]; int M,lenA,lenB; cin>>A>>B>>M; lenA = strlen(A); lenB = strlen(B); for(int i=0;i<lenB;i++){ B[i]-='0'; if(lenA-i-1<0) A[lenB-i-1]=0; else A[lenB-i-1]=A[lenA-i-1]-'0'; } if(A[0]!=0) dp[0][A[0]][A[0]%M][0][0] = dp[0][A[0]][A[0]%M][1][0] = 1; dp[0][B[0]][B[0]%M][0][2] = dp[0][B[0]][B[0]%M][1][2] = 1; for(int j=A[0]+1;j<B[0];j++){ dp[0][j][j%M][0][1] = dp[0][j][j%M][1][1] = 1; } bool flag=false; int latte = lenB-lenA; for(int i=0;i<lenB-1;i++){ if(i+1<latte){ for(int j=1;j<10;j++){ dp[i+1][j][j%M][0][1] += 1; if(i+1!=lenB-1) dp[i+1][j][j%M][1][1] += 1; } } else if(i+1==latte){ dp[i+1][A[i+1]][A[i+1]%M][0][0] += 1; if(i+1!=lenB-1) dp[i+1][A[i+1]][A[i+1]%M][1][0] += 1; for(int j=A[i+1]+1;j<10;j++){ dp[i+1][j][j%M][0][1] += 1; if(i+1!=lenB-1) dp[i+1][j][j%M][1][1] += 1; } } for(int j=0;j<10;j++){ for(int k=0;k<M;k++){ for(int l=j+1;l<10;l++){ dp[i+1][l][(k*10+l)%M][1][1] += dp[i][j][k][0][1]%LATTE; if(A[i+1]<l) dp[i+1][l][(k*10+l)%M][1][1] += dp[i][j][k][0][0]%LATTE; else if(A[i+1]==l) dp[i+1][l][(k*10+l)%M][1][0] += dp[i][j][k][0][0]%LATTE; if(B[i+1]>l) dp[i+1][l][(k*10+l)%M][1][1] += dp[i][j][k][0][2]%LATTE; else if(B[i+1]==l) dp[i+1][l][(k*10+l)%M][1][2] += dp[i][j][k][0][2]%LATTE; } for(int l=j-1;l>=0;l--){ dp[i+1][l][(k*10+l)%M][0][1] += dp[i][j][k][1][1]%LATTE; if(A[i+1]<l) dp[i+1][l][(k*10+l)%M][0][1] += dp[i][j][k][1][0]%LATTE; else if(A[i+1]==l) dp[i+1][l][(k*10+l)%M][0][0] += dp[i][j][k][1][0]%LATTE; if(B[i+1]>l) dp[i+1][l][(k*10+l)%M][0][1] += dp[i][j][k][1][2]%LATTE; else if(B[i+1]==l) dp[i+1][l][(k*10+l)%M][0][2] += dp[i][j][k][1][2]%LATTE; } } } } int ans=0; for(int i=0;i<10;i++){ for(int j=0;j<3;j++){ ans += (dp[lenB-1][i][0][0][j]+dp[lenB-1][i][0][1][j])%LATTE; } } printf("%d\n",ans%LATTE); return 0; }
a.cc: In function 'int main()': a.cc:20:16: error: 'strlen' was not declared in this scope 20 | lenA = strlen(A); lenB = strlen(B); | ^~~~~~ a.cc:9:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 8 | #include<functional> +++ |+#include <cstring> 9 | #include<string>
s995474369
p00493
C++
#include<iostream> #include<string> #include<cmath> #include<algorithm> using namespace std; int x[501][501][10][2]; int main(){ //init. string n,m; int N[501]; int M[501]; int p[10]; int giri[501][2][2]; int a,b,c,d,e,sum,sum2; memset(giri,0,sizeof(giri)); memset(x,0,sizeof(x)); char T[10]={'0','1','2','3','4','5','6','7','8','9'}; cin>>n>>m; cin>>c; for(int i=1;i<=n.size();i++){ for(int j=0;j<10;j++){ if(n[i-1]==T[j]){ N[i]=j; } } giri[i][0][0]=(giri[i-1][0][0]*10+N[i])%c; giri[i][0][1]=N[i]; } for(int i=1;i<=m.size();i++){ for(int j=0;j<10;j++){ if(m[i-1]==T[j]){ M[i]=j; } } giri[i][1][0]=(giri[i-1][1][0]*10+M[i])%c; giri[i][1][1]=M[i]; } //1st. for(int i=1;i<10;i++){ if(giri[1][0][1]>=i || n.size()>=2){ x[1][i%c][i][0] += 1; } } for(int i=1;i<10;i++){ for(int j=0;j<10;j++){ if(i>j){ x[2][(i*10+j)%c][j][0]+=1; } else if(i<j){ x[2][(i*10+j)%c][j][1]+=1; } } } for(int i=3;i<n.size();i++){ for(int j=0;j<c;j++){ for(int k=0;k<10;k++){ if(i%2==0){ for(int l=0;l<k;l++){ x[i][(j*10+l)%c][l][0] += x[i-1][j][k][0]; } } else{ for(int l=k+1;l<10;l++){ x[i][(j*10+l)%c][l][0] += x[i-1][j][k][0]; } } } } } for(int i=3;i<n.size();i++){ for(int j=0;j<c;j++){ for(int k=0;k<10;k++){ if(i%2==1){ for(int l=0;l<k;l++){ x[i][(j*10+l)%c][l][1] += x[i-1][j][k][1]; } } else{ for(int l=k+1;l<10;l++){ x[i][(j*10+l)%c][l][1] += x[i-1][j][k][1]; } } } } } sum=0; if(n.size()>=3){ for(int i=1;i<n.size();i++){ for(int j=0;j<10;j++){ sum += x[i][0][j][1]; sum += x[i][0][j][0]; } } } else{ for(int i=1;i<=n.size();i++){ for(int j=0;j<10;j++){ sum += x[i][0][j][1]; sum += x[i][0][j][0]; } } } memset(x,0,sizeof(x)); for(int i=1;i<10;i++){ x[1][i%c][i][0] += 1; } for(int i=1;i<10;i++){ for(int j=0;j<10;j++){ if(i>j){ x[2][(i*10+j)%c][j][0]+=1; } else if(i<j){ x[2][(i*10+j)%c][j][1]+=1; } } } for(int i=3;i<m.size();i++){ for(int j=0;j<c;j++){ for(int k=0;k<10;k++){ if(i%2==0){ for(int l=0;l<k;l++){ x[i][(j*10+l)%c][l][0] += x[i-1][j][k][0]; } } else{ for(int l=k+1;l<10;l++){ x[i][(j*10+l)%c][l][0] += x[i-1][j][k][0]; } } } } } for(int i=3;i<m.size();i++){ for(int j=0;j<c;j++){ for(int k=0;k<10;k++){ if(i%2==1){ for(int l=0;l<k;l++){ x[i][(j*10+l)%c][l][1] += x[i-1][j][k][1]; } } else{ for(int l=k+1;l<10;l++){ x[i][(j*10+l)%c][l][1] += x[i-1][j][k][1]; } } } } } sum2=0; if(n.size()>=3){ for(int i=1;i<m.size();i++){ for(int j=0;j<10;j++){ sum2 += x[i][0][j][1]; sum2 += x[i][0][j][0]; } } } else{ for(int i=1;i<=m.size();i++){ for(int j=0;j<10;j++){ sum2 += x[i][0][j][1]; sum2 += x[i][0][j][0]; } } } //2nd. memset(x,0,sizeof(x)); for(int i=1;i<10;i++){ if(giri[1][0][1]>=i){ x[1][i%c][i][0] += 1; } } for(int i=1;i<10;i++){ if(giri[1][0][1]>=i){ for(int j=0;j<10;j++){ if(giri[2][0][1]>=j || giri[1][0][1]!=i){ if(i>j){ x[2][(i*10+j)%c][j][0]+=1; } else if(i<j){ x[2][(i*10+j)%c][j][1]+=1; } } } } } for(int i=3;i<=n.size();i++){ for(int j=0;j<c;j++){ for(int k=0;k<10;k++){ if(i%2==0){ for(int l=0;l<k;l++){ x[i][(j*10+l)%c][l][0] += x[i-1][j][k][0]; if(j==giri[i][0][0] && giri[i][0][1]<l){ x[i][(giri[i][0][0]*10+l)%c][l][0] -= x[i-1][j][k][0]; } } } else{ for(int l=k+1;l<10;l++){ x[i][(j*10+l)%c][l][0] += x[i-1][j][k][0]; if(j==giri[i][0][0] && giri[i][0][1]<l){ x[i][(giri[i][0][0]*10+l)%c][l][0] -= x[i-1][j][k][0]; } } } } } } for(int i=3;i<=n.size();i++){ for(int j=0;j<c;j++){ for(int k=0;k<10;k++){ if(i%2==1){ for(int l=0;l<k;l++){ x[i][(j*10+l)%c][l][1] += x[i-1][j][k][1]; if(j==giri[i][0][0] && giri[i][0][1]<l){ x[i][(giri[i][0][0]*10+l)%c][l][1] -= x[i-1][j][k][1]; } } } else{ for(int l=k+1;l<10;l++){ x[i][(j*10+l)%c][l][1] += x[i-1][j][k][1]; if(j==giri[i][0][0] && giri[i][0][1]<l){ x[i][(giri[i][0][0]*10+l)%c][l][1] -= x[i-1][j][k][1]; } } } } } } if(n.size()>=3){ for(int i=n.size();i<=n.size();i++){ for(int j=0;j<10;j++){ sum += x[i][0][j][1]; sum += x[i][0][j][0]; } } } memset(x,0,sizeof(x)); for(int i=1;i<10;i++){ if(giri[1][0][1]>=i){ x[1][i%c][i][0] += 1; } } for(int i=1;i<10;i++){ if(giri[1][1][1]>=i){ for(int j=0;j<10;j++){ if(giri[2][1][1]>=j || giri[1][1][1]!=i){ if(i>j){ x[2][(i*10+j)%c][j][0]+=1; } else if(i<j){ x[2][(i*10+j)%c][j][1]+=1; } } } } } for(int i=3;i<=m.size();i++){ for(int j=0;j<c;j++){ for(int k=0;k<10;k++){ if(i%2==0){ for(int l=0;l<k;l++){ x[i][(j*10+l)%c][l][0] += x[i-1][j][k][0]; if(j==giri[i][1][0] && giri[i][1][1]<l){ x[i][(giri[i][1][0]*10+l)%c][l][0] -= x[i-1][j][k][0]; } } } else{ for(int l=k+1;l<10;l++){ x[i][(j*10+l)%c][l][0] += x[i-1][j][k][0]; if(j==giri[i][1][0] && giri[i][1][1]<l){ x[i][(giri[i][1][0]*10+l)%c][l][0] -= x[i-1][j][k][0]; } } } } } } for(int i=3;i<=m.size();i++){ for(int j=0;j<c;j++){ for(int k=0;k<10;k++){ if(i%2==1){ for(int l=0;l<k;l++){ x[i][(j*10+l)%c][l][1] += x[i-1][j][k][1]; if(j==giri[i][1][0] && giri[i][1][1]<l){ x[i][(giri[i][1][0]*10+l)%c][l][1] -= x[i-1][j][k][1]; } } } else{ for(int l=k+1;l<10;l++){ x[i][(j*10+l)%c][l][1] += x[i-1][j][k][1]; if(j==giri[i][1][0] && giri[i][1][1]<l){ x[i][(giri[i][1][0]*10+l)%c][l][1] -= x[i-1][j][k][1]; } } } } } } if(m.size()>=3){ for(int i=m.size();i<=m.size();i++){ for(int j=0;j<10;j++){ sum2 += x[i][0][j][1]; sum2 += x[i][0][j][0]; } } } cout<<sum2-sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: 'memset' was not declared in this scope 19 | memset(giri,0,sizeof(giri)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<algorithm> +++ |+#include <cstring> 5 | using namespace std;
s126196396
p00493
C++
#include<bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;++i) #define FOR(i,a,b) for(int i=a;i<=b;++i) #define LL long long using namespace std; static const LL INF = 1LL<<61LL; static const int MOD = 10000; char c[]={'0','1','2','3','4','5','6','7','8','9'}; typedef pair<LL,LL> PLL; string str1,str2; int M; int sum; LL mem1[501][10][2][501]; LL mem2[501][10][2][501][3]; LL mem2[501][10][2][501][3]; int cal1(int n,int p,int pp,int mod,string s){ int res=0; if(mem1[n][p][pp][mod]!=0){ return mem1[n][p][pp][mod]; } if(n==str2.size()-2){ return 0; } else if(n==0){ rep(i,10){ int temp=mod*10; temp+=i; if(i>p||i<p){ int a; if(i<p)a=1; else if(i>p)a=0; if(!(temp%M)&&n+2>str1.size()){ sum++; res+=cal1(n+1,i,a,0,s+c[i])+1; } else res+=cal1(n+1,i,a,temp%M,s+c[i]); } } } else { rep(i,10){ int temp=mod*10; temp+=i; if(pp&&p<i){ if(!(temp%M)&&n+1>str1.size()-1){ sum++; res+=cal1(n+1,i,0,0,s+c[i])+1; } else res+=cal1(n+1,i,0,temp%M,s+c[i]); } else if(!(pp)&&p>i){ if(!(temp%M)&&n+1>str1.size()-1){ sum++; res+=cal1(n+1,i,1,0,s+c[i])+1; } else res+=cal1(n+1,i,1,temp%M,s+c[i]); } } } return mem1[n][p][pp][mod]=res%MOD; } int cal2(int n,int p,int pp,int mod,int f,string s){ int res=0; if(mem2[n][p][pp][mod][f]!=0)return mem2[n][p][pp][mod][f]; if(n==str1.size()-1&&mod==0){ //if(s[0]=='9')cout<<s<<endl; return 1; } else if(n==str1.size()-1) return 0; rep(i,10){ int b=f; if(b==1){ if(str1[n+1]-'0'<i){ b=0; } if(str1[n+1]-'0'==i){ b=1; } if(str1[n+1]-'0'>i){ continue; } } int temp=mod*10; temp+=i; if(n==0){ if(i>p||i<p){ int a; if(i<p)a=1; else if(i>p)a=0; if(!(temp%M)&&n+2>str1.size()){ res+=cal2(n+1,i,a,0,b,s+c[i]); } else res+=cal2(n+1,i,a,temp%M,b,s+c[i]); } } else{ if((pp&&p<i)||(n==0&&p<i)){ res+=cal2(n+1,i,0,temp%M,b,s+c[i]); } else if((!(pp)&&p>i)||(n==0&&p>i)){ res+=cal2(n+1,i,1,temp%M,b,s+c[i]); } } } return mem2[n][p][pp][mod][f]=res%MOD; } int cal3(int n,int p,int pp,int mod,int f,string s){ int res=0; if(mem3[n][p][pp][mod][f]!=0)return mem3[n][p][pp][mod][f]; if(n==str2.size()-1&&mod==0){ //cout<<s<<endl; //cout<<s<<endl; return 1; } else if(n==str2.size()-1) return 0; rep(i,10){ int b=f; if(b==1){ if(str2[n+1]-'0'>i){ b=0; } if(str2[n+1]-'0'==i){ b=1; } if(str2[n+1]-'0'<i){ continue; } } int temp=mod*10; temp+=i; if(n==0){ if(i>p||i<p){ int a=(i<p); if(!(temp%M)&&n+2>str1.size()){ res+=cal3(n+1,i,a,0,b,s+c[i]); } else res+=cal3(n+1,i,a,temp%M,b,s+c[i]); } } else{ if((pp&&p<i)||(n==0&&p<i)){ res+=cal3(n+1,i,0,temp%M,b,s+c[i]); } else if((!(pp)&&p>i)||(n==0&&p>i)){ res+=cal3(n+1,i,1,temp%M,b,s+c[i]); } } } return mem3[n][p][pp][mod][f]=res%MOD; } int cal4(int n,int p,int pp,int mod,int f,string s){ int res=0; //cout<<s<<" "<<f<<" "<<mod<<endl; if(mem2[n][p][pp][mod][f]!=0)return mem2[n][p][pp][mod][f]; if(n==str2.size()-1&&mod==0){ return 1; } else if(n==str2.size()-1) return 0; rep(i,10){ int b=f; if(b==2){ //cout<<s+c[i]<<endl; if(str2[n+1]-'0'>i){ b=0; } if(str2[n+1]-'0'==i){ b=2; } if(str2[n+1]-'0'<i){ continue; } } else if(b==1){ //cout<<s+c[i]<<endl; if(str1[n+1]-'0'<i){ b=0; } if(str1[n+1]-'0'==i){ b=1; } if(str1[n+1]-'0'>i){ continue; } } int temp=mod*10; temp+=i; if(n==0){ if(i>p||i<p){ int a=(i>p); //cout<<a<<endl; if(!(temp%M)&&n+2>str1.size()){ res+=cal4(n+1,i,a,0,b,s+c[i]); } else res+=cal4(n+1,i,a,temp%M,b,s+c[i]); } } else{ if((!(pp)&&p<i)||(n==0&&p<i)){ res+=cal4(n+1,i,1,temp%M,b,s+c[i]); } else if((pp&&p>i)||(n==0&&p>i)){ res+=cal4(n+1,i,0,temp%M,b,s+c[i]); } } } return mem2[n][p][pp][mod][f]=res%MOD; } int main(){ LL ans=0; cin>>str1>>str2; cin>>M; FOR(i,1,9){ string s; if(str1.size()==str2.size()){ if(str1[0]-'0'<i&&str2[0]-'0'>i)ans+=cal4(0,i,0,i%M,0,s+c[i]); else if(str1[0]-'0'==i)ans+=cal4(0,i,0,i%M,1,s+c[i]); else if(str2[0]-'0'==i)ans+=cal4(0,i,0,i%M,2,s+c[i]); continue; } ans+=cal1(0,i,0,i%M,s+c[i]); if(str2[0]-'0'>=i&&i!=0){ if(str2[0]-'0'>i)ans+=cal3(0,i,0,i%M,0,s+c[i]); else ans+=cal3(0,i,0,i%M,1,s+c[i]); } if(str1[0]-'0'<=i&&i!=0){ if(str1[0]-'0'<i)ans+=cal2(0,i,0,i%M,0,s+c[i]); else ans+=cal2(0,i,0,i%M,1,s+c[i]); } } cout<<ans%MOD<<endl; }
a.cc:16:4: error: redefinition of 'long long int mem2 [501][10][2][501][3]' 16 | LL mem2[501][10][2][501][3]; | ^~~~ a.cc:15:4: note: 'long long int mem2 [501][10][2][501][3]' previously declared here 15 | LL mem2[501][10][2][501][3]; | ^~~~ a.cc: In function 'int cal3(int, int, int, int, int, std::string)': a.cc:115:8: error: 'mem3' was not declared in this scope; did you mean 'mem2'? 115 | if(mem3[n][p][pp][mod][f]!=0)return mem3[n][p][pp][mod][f]; | ^~~~ | mem2 a.cc:155:12: error: 'mem3' was not declared in this scope; did you mean 'mem2'? 155 | return mem3[n][p][pp][mod][f]=res%MOD; | ^~~~ | mem2
s112201288
p00493
C++
#include<bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;++i) #define FOR(i,a,b) for(int i=a;i<=b;++i) #define LL long long using namespace std; static const LL INF = 1LL<<61LL; static const int MOD = 10000; char c[]={'0','1','2','3','4','5','6','7','8','9'}; typedef pair<LL,LL> PLL; string str1,str2; int M; int sum; string str; int mem1[500][10][2][500]; int mem2[500][10][2][500][3]; int t; int cal1(int n,int p,int pp,int mod,string s){ int res=0; //cout<<s<<endl; if(mem1[n][p][pp][mod]!=0){ //cout<<"hoge"<<endl; return mem1[n][p][pp][mod]; } if(n==str.size()-2){ return 0; } else if(n==0){ rep(i,10){ int temp=mod*10; temp+=i; if(i>p||i<p){ int a; if(i<p)a=1; else if(i>p)a=0; if(!(temp%M)){ sum++; //cout<<s+c[i]<<endl; res+=cal1(n+1,i,a,0,s+c[i])+1; } else res+=cal1(n+1,i,a,temp%M,s+c[i]); } } } else { rep(i,10){ int temp=mod*10; temp+=i; if(pp&&p<i){ if(!(temp%M)){ sum++; //cout<<s+c[i]<<endl; res+=cal1(n+1,i,0,0,s+c[i])+1; } else res+=cal1(n+1,i,0,temp%M,s+c[i]); } else if(!(pp)&&p>i){ if(!(temp%M)){ sum++; //cout<<s+c[i]<<endl; res+=cal1(n+1,i,1,0,s+c[i])+1; } else res+=cal1(n+1,i,1,temp%M,s+c[i]); } } } return mem1[n][p][pp][mod]=res%MOD; } int cal(int n,int p,int pp,int mod,int f,string s){ int res=0; if(mem2[n][p][pp][mod][f]!=0){ return mem2[n][p][pp][mod][f]; } if(n==str.size()-1&&mod==0){ return 1; } else if(n==str.size()-1) return 0; rep(i,10){ int b=f; if(b==1){ if(str[n+1]-'0'>i){ b=0; } if(str[n+1]-'0'==i){ b=1; } if(str[n+1]-'0'<i){ continue; } } int temp=mod*10; temp+=i; if(n==0){ if(i>p||i<p){ int a=(i<p); if(!(temp%M)){ res+=cal(n+1,i,a,0,b,s+c[i]); } else res+=cal(n+1,i,a,temp%M,b,s+c[i]); } } else{ if((pp&&p<i)||(n==0&&p<i)){ if(!(temp%M)){ res+=cal(n+1,i,0,temp%M,b,s+c[i]); } else res+=cal(n+1,i,0,temp%M,b,s+c[i]); } else if((!(pp)&&p>i)||(n==0&&p>i)){ if(!(temp%M)){ res+=cal(n+1,i,1,temp%M,b,s+c[i]); } else res+=cal(n+1,i,1,temp%M,b,s+c[i]); } } } return mem2[n][p][pp][mod][f]=res%MOD; } int main(){ LL ans=0; cin>>str1>>str2; cin>>M; int vl=0; int vr=0; rep(i,2){ FOR(j,1,9){ string s; if(i==0){ str=str1; if(j%M==0&&str.size()!=1&&str[0]>j)vl++; if(str.size()!=1)vl+=cal1(0,j,0,j%M,s+c[j]); if(str[0]-'0'>j)vl+=cal(0,j,0,j%M,0,s+c[j]); if(str[0]-'0'==j) vl+=cal(0,j,0,j%M,1,s+c[j]); if(j==str[0]-'0'&&str.size()==1)vl--; } else { str=str2; if(j%M==0&&(str.size()>1||str[0]>=j))vr++; vr+=cal1(0,j,0,j%M,s+c[j]); if(str[0]-'0'>j)vr+=cal(0,j,0,j%M,0,s+c[j]); else if(str[0]-'0'==j)vr+=cal(0,j,0,j%M,1,s+c[j]); } /*if(str1.size()==str2.size()){ if(str1[0]-'0'<i&&str2[0]-'0'>i)ans+=cal4(0,i,0,i%M,0,s+c[i]); else if(str1[0]-'0'==i)ans+=cal4(0,i,0,i%M,1,s+c[i]); else if(str2[0]-'0'==i)ans+=cal4(0,i,0,i%M,2,s+c[i]); continue; } ans+=cal1(0,i,0,i%M,s+c[i]); if(str1[0]-'0'<=i&&i!=0){ if(str1[0]-'0'<i)ans+=cal2(0,i,0,i%M,0,s+c[i]); else ans+=cal2(0,i,0,i%M,1,s+c[i]); } if(str2[0]-'0'>=i&&i!=0){ if(str2[0]-'0'>i)ans+=cal3(0,i,0,i%M,0,s+c[i]); else ans+=cal3(0,i,0,i%M,1,s+c[i]); }*/ } } cout<<(vr-vl)&M<<endl; }
a.cc: In function 'int main()': a.cc:165:20: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 165 | cout<<(vr-vl)&M<<endl; | ~^~~~~~
s456257048
p00493
C++
#include<bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;++i) #define FOR(i,a,b) for(int i=a;i<=b;++i) #define LL long long using namespace std; static const LL INF = 1LL<<61LL; static const int MOD = 10000; char c[]={'0','1','2','3','4','5','6','7','8','9'}; typedef pair<LL,LL> PLL; string str1,str2; int M; int sum; int mem1[500][10][2][500]; int mem2[500][10][2][500][3]; int mem3[500][10][2][500][3]; int cal1(int n,int p,int pp,int mod,string s){ int res=0; if(mem1[n][p][pp][mod]!=0){ //cout<<"hoge"<<endl; return mem1[n][p][pp][mod]; } if(n==str2.size()-2){ return 0; } else if(n==0){ rep(i,10){ int temp=mod*10; temp+=i; if(i>p||i<p){ int a; if(i<p)a=1; else if(i>p)a=0; if(!(temp%M)&&n+2>str1.size()){ sum++; //cout<<s+c[i]<<endl; res+=cal1(n+1,i,a,0,s+c[i])+1; } else res+=cal1(n+1,i,a,temp%M,s+c[i]); } } } else { rep(i,10){ int temp=mod*10; temp+=i; if(pp&&p<i){ if(!(temp%M)&&n+1>str1.size()-1){ sum++; // cout<<s+c[i]<<endl; res+=cal1(n+1,i,0,0,s+c[i])+1; } else res+=cal1(n+1,i,0,temp%M,s+c[i]); } else if(!(pp)&&p>i){ if(!(temp%M)&&n+1>str1.size()-1){ sum++; //cout<<s+c[i]<<endl; res+=cal1(n+1,i,1,0,s+c[i])+1; } else res+=cal1(n+1,i,1,temp%M,s+c[i]); } } } return mem1[n][p][pp][mod]=res%MOD; } int cal2(int n,int p,int pp,int mod,int f){ int res=0; if(mem2[n][p][pp][mod][f]!=0)return mem2[n][p][pp][mod][f]; if(n==str1.size()-1&&mod==0){ //cout<<"hoge"<<endl; return 1; } else if(n==str1.size()-1) return 0; rep(i,10){ int b=f; if(b==1){ if(str1[n+1]-'0'<i){ b=0; } if(str1[n+1]-'0'==i){ b=1; } if(str1[n+1]-'0'>i){ continue; } } int temp=mod*10; temp+=i; if(n==0){ if(i>p||i<p){ int a; if(i<p)a=1; else if(i>p)a=0; if(!(temp%M)&&n+2>str1.size()){ res+=cal2(n+1,i,a,0,b); } else res+=cal2(n+1,i,a,temp%M,b); } } else{ if((pp&&p<i)||(n==0&&p<i)){ res+=cal2(n+1,i,0,temp%M,b); } else if((!(pp)&&p>i)||(n==0&&p>i)){ res+=cal2(n+1,i,1,temp%M,b); } } } return mem2[n][p][pp][mod][f]=res%MOD; } int cal3(int n,int p,int pp,int mod,int f,string s){ int res=0; if(mem3[n][p][pp][mod][f]!=0){ //cout<<"hoge"<<endl; return mem3[n][p][pp][mod][f]; } if(n==str2.size()-1&&mod==0){ //cout<<s<<endl; return 1; } else if(n==str2.size()-1) return 0; rep(i,10){ int b=f; if(b==1){ if(str2[n+1]-'0'>i){ b=0; } if(str2[n+1]-'0'==i){ b=1; } if(str2[n+1]-'0'<i){ continue; } } int temp=mod*10; temp+=i; if(n==0){ if(i>p||i<p){ int a=(i<p); if(!(temp%M)&&n+2>str1.size()){ res+=cal3(n+1,i,a,0,b,s+c[i]); } else res+=cal3(n+1,i,a,temp%M,b,s+c[i]); } } else{ if((pp&&p<i)||(n==0&&p<i)){ res+=cal3(n+1,i,0,temp%M,b,s+c[i]); } else if((!(pp)&&p>i)||(n==0&&p>i)){ res+=cal3(n+1,i,1,temp%M,b,s+c[i]); } } } return mem3[n][p][pp][mod][f]=res%MOD; } int cal4(int n,int p,int pp,int mod,int f,string s){ int res=0; if(mem2[n][p][pp][mod][f]!=0)return mem2[n][p][pp][mod][f]; if(n==str2.size()-1&&mod==0){ //cout<<s<<endl; return 1; } else if(n==str2.size()-1) return 0; rep(i,10){ int b=f; if(b==2){ if(str2[n+1]-'0'>i){ b=0; } if(str2[n+1]-'0'==i){ b=2; } if(str2[n+1]-'0'<i){ continue; } } else if(b==1){ //cout<<s+c[i]<<endl; if(str1[n+1]-'0'<i){ b=0; } if(str1[n+1]-'0'==i){ b=1; } if(str1[n+1]-'0'>i){ continue; } } int temp=mod*10; temp+=i; if(n==0){ if(i>p||i<p){ int a=(i>p); if(!(temp%M)&&n+2>str1.size()){ res+=cal4(n+1,i,a,0,b,s+c[i]); } else res+=cal4(n+1,i,a,temp%M,b,s+c[i]); } } else{ if((!(pp)&&p<i)||(n==0&&p<i)){ res+=cal4(n+1,i,1,temp%M,b,s+c[i]); } else if((pp&&p>i)||(n==0&&p>i)){ res+=cal4(n+1,i,0,temp%M,b,s+c[i]); } } } return mem2[n][p][pp][mod][f]=res%MOD; } int main(){ LL ans=0; LL vl=0; LL vr=0; cin>>str1>>str2; cin>>M; string temp1=str1,temp2=str2; FOR(i,1,9){ string s; if(temp1.size()==temp2.size()&&temp1[0]==temp2[0]){ rep(j,2){ str1=""; if(j==0){ str2=temp1; if(str2[0]-'0'>i)vl+=cal3(0,i,0,i%M,0,s+c[i]); else if(str2[0]-'0'==i)vl+=cal3(0,i,0,i%M,1,s+c[i]); vl+=cal1(0,i,0,i%M,s+c[i]); } else { str2=temp2; if(str2[0]-'0'>i)vr+=cal3(0,i,0,i%M,0,s+c[i]); else if(str2[0]-'0'==i) vr+=cal3(0,i,0,i%M,1,s+c[i]); vr+=cal1(0,i,0,i%M,s+c[i]); } } continue; } ans+=cal1(0,i,0,i%M); if(str2[0]-'0'>=i&&i!=0){ if(str2[0]-'0'>i)ans+=cal3(0,i,0,i%M,0); else ans+=cal3(0,i,0,i%M,1); } if(str1[0]-'0'<=i&&i!=0){ if(str1[0]-'0'<i)ans+=cal2(0,i,0,i%M,0); else ans+=cal2(0,i,0,i%M,1); } } if(temp1.size()==temp2.size())cout<<vr<<" "<<vl<<endl; else cout<<ans%MOD<<endl; }
a.cc: In function 'int main()': a.cc:248:18: error: too few arguments to function 'int cal1(int, int, int, int, std::string)' 248 | ans+=cal1(0,i,0,i%M); | ~~~~^~~~~~~~~~~ a.cc:19:5: note: declared here 19 | int cal1(int n,int p,int pp,int mod,string s){ | ^~~~ a.cc:250:39: error: too few arguments to function 'int cal3(int, int, int, int, int, std::string)' 250 | if(str2[0]-'0'>i)ans+=cal3(0,i,0,i%M,0); | ~~~~^~~~~~~~~~~~~ a.cc:117:5: note: declared here 117 | int cal3(int n,int p,int pp,int mod,int f,string s){ | ^~~~ a.cc:251:27: error: too few arguments to function 'int cal3(int, int, int, int, int, std::string)' 251 | else ans+=cal3(0,i,0,i%M,1); | ~~~~^~~~~~~~~~~~~ a.cc:117:5: note: declared here 117 | int cal3(int n,int p,int pp,int mod,int f,string s){ | ^~~~
s775395366
p00493
C++
100 200 5
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 100 | ^~~
s649575937
p00493
C++
#include <iostream> #include <algorithm> #include <climits> #include <string> #include <vector> #include <cmath> using namespace std; #define MOD 10000 char A[510], B[510]; int M; int memo[510][10][3][3][500]; int f(char *x, int i, int d, int c, int u, int r) { if (memo[i][c][d][u][r] >= 0) return memo[i][c][d][u][r]; if (i == strlen(x)) { int ret = 0; if (u != 2) ret = r == 0; return memo[i][c][d][u][r] = ret; } int ret = r == 0; for (int k=0; k<10; k++) { int nu = u; if (c == k) continue; if (d == 0 && c < k) continue; if (d == 1 && c > k) continue; int nd; if (d == 2) nd = c > k; else nd = 1-d; if (u == 1 && k > (int)(x[i] - '0')) nu = 2; if (u == 1 && k < (int)(x[i] - '0')) nu = 0; ret += f(x, i+1, nd, k, nu, (k + r*10) % M); ret %= MOD; } return memo[i][c][d][u][r] = ret; } int f(char *x) { int ret = 0; for (int i=0; i<510; i++) { for (int j=0; j<10; j++) { for (int d=0; d<3; d++) { for (int k=0; k<3; k++) { for (int l=0; l<500; l++) { memo[i][j][d][k][l] = -1; } } } } } for (int i=1; i<10; i++) { char c = (int)(x[0] - '0'); ret += f(x, 1, 2, i, i > c ? 2 : (i == c ? 1 : 0), i % M); ret %= MOD; } return ret; } void decrement(char *x) { int L = strlen(x); int h = L - 1; while (x[h] == '0') { x[h] = '9'; h -= 1; } x[h] = (char)(x[h] - 1); if (L > 1 && h == 0) { for (int i=0; i<L-1; i++) x[i] = x[i+1]; x[L-1] = '\0'; } } int main() { cin >> A >> B >> M; decrement(A); cout << (f(B) - f(A) + MOD) % MOD << "\n"; return 0; }
a.cc: In function 'int f(char*, int, int, int, int, int)': a.cc:17:12: error: 'strlen' was not declared in this scope 17 | if (i == strlen(x)) { | ^~~~~~ a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 6 | #include <cmath> +++ |+#include <cstring> 7 | using namespace std; a.cc: In function 'void decrement(char*)': a.cc:61:11: error: 'strlen' was not declared in this scope 61 | int L = strlen(x); | ^~~~~~ a.cc:61:11: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s746681873
p00494
C
#include<iostream> #include<string.h> using namespace std; int main() { int n, k = 0, ans = 0, i; char s[1000001]; int JOI = -1, J = 0, O = 0, I = 0; cin >> s; n = strlen(s); s[n] = 'A'; for (i = 0; i <= n; i++) { if (s[i] == 'J' && JOI <= 0) { JOI = 0; ++J; } else if (s[i] == 'O' && (JOI == 0 || JOI == 1)) { ++O; JOI = 1; } else if (s[i] == 'I' && (JOI == 1 || JOI == 2)) { ++I; JOI = 2; } else if (JOI == 2) { if (O <= J && O <= I)k = O; if (k > ans)ans = k; J = 0, O = 0, I = 0, JOI = -1, --i; } else J = 0, O = 0, I = 0, JOI = -1; } cout << ans << endl; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s875188153
p00494
C
#include <stdio.h> #include <string.h> #include <string> using namespace std; char vv[100000]; char x[100000]; int main(){ scanf("%s",vv); int leng; leng=strlen(vv); for(int i=leng/3;i>=0;i--){ for(int j=0;j<i;j++){ x[j]='J'; } for(int j=i;j<2*i;j++){ x[j]='O'; } for(int j=2*i;j<3*i;j++){ x[j]='I'; } if(strstr(vv,x)!='\0'){ printf("%d\n",i); break; } for(int j=3*i-3;j<3*i;j++){ x[j]=NULL; } } return 0; }
main.c:3:10: fatal error: string: No such file or directory 3 | #include <string> | ^~~~~~~~ compilation terminated.
s364906127
p00494
C
/* AizuOnline A0571 JJOOII */ #include <stdio.h> #include <string.h> char buffer[100001]; char * find_chr_run(char * s,char c,int * ret) { int i; char *p; if(NULL==(p=strchr(s,c))) return(NULL); i=0; while(p[i]==c) i++; *ret = i; return(p); } // do not search before start ! char * chr_run_back(char * s,char c,char * start,int * ret) { int i; i=0; while(*s==c && s >= start ) { printf("CRB:%s\n",s); i++;s--; } *ret=i; return(s); } int findJOI() { char *p,*p1,*p0; int maxlen; int run_i,run_o,run_j; maxlen=0; p=buffer+2; while(*p && p<buffer+strlen(buffer)) { p0=p; p=find_chr_run(p,'I',&run_i); //printf("r_i:%d\n",run_i); p1=p; if(p==NULL) return(maxlen); p=chr_run_back(p-1,'O',p0,&run_o); //printf("r_o:%d\n",run_o); if(run_o == 0 || run_o > run_i) { p=p1+run_i; continue; } p=chr_run_back(p,'J',p0,&run_j); //printf("r_j:%d\n",run_j); if(run_o == 0 || run_o > run_j) { p=p1+run_i; //printf("*\n"); continue; } if(maxlen < run_o) { maxlen = run_o; p=p1+run_i+2*maxlen; //printf("**\n"); } else { p=p1+run_i; //printf("*\n"); } } return(maxlen); } main() { int ret; buffer=buffer0+1; gets(buffer); // printf("%s\n",buffer); ret = findJOI(); printf("%d\n",ret); return(0); }
main.c:87:1: error: return type defaults to 'int' [-Wimplicit-int] 87 | main() | ^~~~ main.c: In function 'main': main.c:91:10: error: 'buffer0' undeclared (first use in this function); did you mean 'buffer'? 91 | buffer=buffer0+1; | ^~~~~~~ | buffer main.c:91:10: note: each undeclared identifier is reported only once for each function it appears in main.c:92:3: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 92 | gets(buffer); | ^~~~ | fgets
s696104499
p00494
C
x;main(l,m,n){for(;~scanf("%*[^J]");){l=m,n=0;scanf("%*[J]%n%*[O]%n%*[I]%n",&l,&m,&n);n3-=n2;n2-=n1;if(l>=m&&m<=n)if(x<m)x=m;}x=!printf("%d\n",x);} ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
main.c:1:1: warning: data definition has no type or storage class 1 | x;main(l,m,n){for(;~scanf("%*[^J]");){l=m,n=0;scanf("%*[J]%n%*[O]%n%*[I]%n",&l,&m,&n);n3-=n2;n2-=n1;if(l>=m&&m<=n)if(x<m)x=m;}x=!printf("%d\n",x);} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int] main.c:1:3: error: return type defaults to 'int' [-Wimplicit-int] 1 | x;main(l,m,n){for(;~scanf("%*[^J]");){l=m,n=0;scanf("%*[J]%n%*[O]%n%*[I]%n",&l,&m,&n);n3-=n2;n2-=n1;if(l>=m&&m<=n)if(x<m)x=m;}x=!printf("%d\n",x);} | ^~~~ main.c: In function 'main': main.c:1:3: error: type of 'l' defaults to 'int' [-Wimplicit-int] main.c:1:3: error: type of 'm' defaults to 'int' [-Wimplicit-int] main.c:1:3: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:21: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | x;main(l,m,n){for(;~scanf("%*[^J]");){l=m,n=0;scanf("%*[J]%n%*[O]%n%*[I]%n",&l,&m,&n);n3-=n2;n2-=n1;if(l>=m&&m<=n)if(x<m)x=m;}x=!printf("%d\n",x);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | x;main(l,m,n){for(;~scanf("%*[^J]");){l=m,n=0;scanf("%*[J]%n%*[O]%n%*[I]%n",&l,&m,&n);n3-=n2;n2-=n1;if(l>=m&&m<=n)if(x<m)x=m;}x=!printf("%d\n",x);} main.c:1:21: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | x;main(l,m,n){for(;~scanf("%*[^J]");){l=m,n=0;scanf("%*[J]%n%*[O]%n%*[I]%n",&l,&m,&n);n3-=n2;n2-=n1;if(l>=m&&m<=n)if(x<m)x=m;}x=!printf("%d\n",x);} | ^~~~~ main.c:1:21: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:87: error: 'n3' undeclared (first use in this function); did you mean 'n'? 1 | x;main(l,m,n){for(;~scanf("%*[^J]");){l=m,n=0;scanf("%*[J]%n%*[O]%n%*[I]%n",&l,&m,&n);n3-=n2;n2-=n1;if(l>=m&&m<=n)if(x<m)x=m;}x=!printf("%d\n",x);} | ^~ | n main.c:1:87: note: each undeclared identifier is reported only once for each function it appears in main.c:1:91: error: 'n2' undeclared (first use in this function); did you mean 'n'? 1 | x;main(l,m,n){for(;~scanf("%*[^J]");){l=m,n=0;scanf("%*[J]%n%*[O]%n%*[I]%n",&l,&m,&n);n3-=n2;n2-=n1;if(l>=m&&m<=n)if(x<m)x=m;}x=!printf("%d\n",x);} | ^~ | n main.c:1:98: error: 'n1' undeclared (first use in this function); did you mean 'n'? 1 | x;main(l,m,n){for(;~scanf("%*[^J]");){l=m,n=0;scanf("%*[J]%n%*[O]%n%*[I]%n",&l,&m,&n);n3-=n2;n2-=n1;if(l>=m&&m<=n)if(x<m)x=m;}x=!printf("%d\n",x);} | ^~ | n main.c:1:130: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | x;main(l,m,n){for(;~scanf("%*[^J]");){l=m,n=0;scanf("%*[J]%n%*[O]%n%*[I]%n",&l,&m,&n);n3-=n2;n2-=n1;if(l>=m&&m<=n)if(x<m)x=m;}x=!printf("%d\n",x);} | ^~~~~~ main.c:1:130: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:130: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:130: note: include '<stdio.h>' or provide a declaration of 'printf'
s419418898
p00494
C++
#include <cstdio> using namespace std; typedef struct { char c; int num; } C_NUM int main() { char str[2048]; C_NUM c_num[2048]; scanf("%s", str); int len = strlen(str); int j = 0; for (int i = 0; i < len; i++){ if (j == 0 || str[i] != c_num[j - 1].c){ c_num[j].c = str[i]; c_num[j].num = 1; } else if (str[i] == c_num[j - 1]){ c_num[j].num++; } } int max_k = 0; for (int i = 0; i < j; i++){ if (c_num[i].c == 'O'){ if ( (c_num[i - 1].c == 'J' && c_num[i - 1].num >= c_num[i].num) && (c_num[i + 1].c == 'I' && c_num[i + 1].num >= c_num[i].num) && (max_k < c_num[i]) ){ max_k = c_num[i]; } } } printf("%d\n", max_k); }
a.cc:9:1: error: expected initializer before 'int' 9 | int main() | ^~~
s893991705
p00494
C++
#include<cstdio> #include<math.h> #include<algorithm> #include<vector> #include<queue> #define rep(i,n) for(int i=0;i<n;i++) const int INF=1001001001; using namespace std; char T[1000002]; pair<int,int> W[1000002]; int charid(char a){ if(a=='J')return 0; if(a=='O')return 1; if(a=='I')return 2; } int main(){ //FILE *fp; //fp=fopen("D:\\1JOI本選\\2012\\2012-ho-data\\2012-ho-t1\\in\\10-02.txt","r"); scanf("%s",T); int pairnum=0; int pairtype=0; int pairsum=0; rep(i,(int)(strlen(T))){ if(i==0){pairtype=charid(T[i]);continue;} if(T[i]==T[i-1])pairsum++; else{ W[pairnum]=make_pair(pairtype,pairsum+1); pairnum++; pairtype=charid(T[i]); pairsum=0; } if(i==(int)(strlen(T))-1){ W[pairnum]=make_pair(pairtype,pairsum+1); pairnum++; } } int ans=0; rep(i,pairnum){ if(W[i].first==1){ if(W[i-1].first==0&&W[i-1].second>=W[i].second&&W[i+1].first==2&&W[i+1].second>=W[i].second){ ans=max(ans,W[i].second); } } } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:28:21: error: 'strlen' was not declared in this scope 28 | rep(i,(int)(strlen(T))){ | ^~~~~~ a.cc:10:32: note: in definition of macro 'rep' 10 | #define rep(i,n) for(int i=0;i<n;i++) | ^ a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include<queue> +++ |+#include <cstring> 6 | a.cc: In function 'int charid(char)': a.cc:20:1: warning: control reaches end of non-void function [-Wreturn-type] 20 | } | ^
s678728449
p00494
C++
#include<cstdio> #include<math.h> #include<algorithm> #include<vector> #include<queue> #include<stdlib.h> #define rep(i,n) for(int i=0;i<n;i++) const int INF=1001001001; using namespace std; char T[1000002]; pair<int,int> W[1000002]; int charid(char a){ if(a=='J')return 0; if(a=='O')return 1; if(a=='I')return 2; } int main(){ //FILE *fp; //fp=fopen("D:\\1JOI本選\\2012\\2012-ho-data\\2012-ho-t1\\in\\10-02.txt","r"); scanf("%s",T); int pairnum=0; int pairtype=0; int pairsum=0; rep(i,(int)(strlen(T))){ if(i==0){pairtype=charid(T[i]);continue;} if(T[i]==T[i-1])pairsum++; else{ W[pairnum]=make_pair(pairtype,pairsum+1); pairnum++; pairtype=charid(T[i]); pairsum=0; } if(i==(int)(strlen(T))-1){ W[pairnum]=make_pair(pairtype,pairsum+1); pairnum++; } } int ans=0; rep(i,pairnum){ if(W[i].first==1){ if(W[i-1].first==0&&W[i-1].second>=W[i].second&&W[i+1].first==2&&W[i+1].second>=W[i].second){ ans=max(ans,W[i].second); } } } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:27:21: error: 'strlen' was not declared in this scope 27 | rep(i,(int)(strlen(T))){ | ^~~~~~ a.cc:9:32: note: in definition of macro 'rep' 9 | #define rep(i,n) for(int i=0;i<n;i++) | ^ a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 6 | #include<stdlib.h> +++ |+#include <cstring> 7 | a.cc: In function 'int charid(char)': a.cc:19:1: warning: control reaches end of non-void function [-Wreturn-type] 19 | } | ^
s501773456
p00494
C++
#include<cstdio> #include<iostream> #include<algorithm> #include<cmath> #include<stack> #include<queue> #include<string> #define INF 10000000000 #define EPS 0.000000001 #define int long long using namespace std; int Jlevel, Ilevel, Olevel; char nstr; bool Oflag = false, Iflag = false; string str; signed main() { cin>>sttr; //str="JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"; int ans = 0; for (int i = 0; i < str.size(); i++) { // cout<<" "<<Oflag<<" "<<Iflag<<endl; if (str[i] == 'J') { Jlevel++; Oflag = true; if (str[i + 1] == 'I') { Oflag = false; Jlevel = 0; } } if (str[i] == 'O'&&Oflag) { Olevel++; if (Olevel > Jlevel) { Jlevel = 0; Olevel = 0; Oflag = false; Iflag = false; } Iflag = true; if (str[i + 1] == 'J') { Oflag = false; Jlevel = 0; Olevel = 0; } } if (str[i] == 'I'&&Iflag&&Oflag) { Ilevel++; if (str[i + 1] != 'I') { if (Ilevel < Olevel) { Jlevel = 0; Olevel = 0; Oflag = false; Iflag = false; continue; } Oflag = false; Iflag = false; //cout<<"["<<Jlevel<<" "<<Olevel<<" "<<Ilevel<<"]"<<endl; if (ans <= Olevel)ans = Olevel; Jlevel = 0; Olevel = 0; Ilevel = 0; } } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:14: error: 'sttr' was not declared in this scope; did you mean 'str'? 20 | cin>>sttr; | ^~~~ | str
s718107506
p00494
C++
#include <string> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { string S; cin >> S; vector<char> v1; vector<int> v2; int c = 1; for(int i = 1; i < S.size(); i++) { if(S[i - 1] != S[i]) { v1.push_back(S[i - 1]); v2.push_back(c); } c++; } v1.push_back(S[S.size() - 1]); v2.push_back(c); int ret = -1; for(int j = 1; j < S.size() -1; j++) { if(v1[i - 1] == 'J' && v1[i] == 'O' && v1[i + 1] == 'I') { ret = max(ret, min( { v2[i - 1], v2[i], v2[i + 1] } )); } } printf("%d\n", ret); return 0; }
a.cc: In function 'int main()': a.cc:34:15: error: 'i' was not declared in this scope 34 | if(v1[i - 1] == 'J' && v1[i] == 'O' && v1[i + 1] == 'I') | ^ a.cc:36:31: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 36 | ret = max(ret, min( { v2[i - 1], v2[i], v2[i + 1] } )); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string: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: candidate expects 2 arguments, 1 provided /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, 1 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:4: /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: template argument deduction/substitution failed: /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: candidate expects 2 arguments, 1 provided
s245989589
p00494
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<vector> #include<math.h> #include<queue> #include <algorithm> #include<functional> #include<cstdlib> #include<cmath> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define CI cin >> #define CO cout << #define E << endl; using namespace std; typedef pair<int, int> P; typedef pair<long, long> LP; typedef pair<int, P> PP; typedef pair<long, LP> LPP; int dy[] = { 0, 0, 1, -1, 0 }; int dx[] = { 1, -1, 0, 0, 0 }; int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0; double V = 0; int n = 0; double L = 0; double S = 0; double ar = 0, br = 0, cr = 0; int answer = 0; string str; string sA, strB; vector<vector<char>> map; vector<double> num; vector<string> str; int sum = 0; vector<int> value; vector<int> weight; int dp[110][10010]; int data_[210][2] = { -2 }; void input(void) { CI str; return; } int main(void) { input(); int f_j = 0; int f_o = 0; int f_i = 0; int max_k; for (int i = 0; i < str.size(); i++) { if (f_j == 0 && str[i] == 'J') { f_j++; } else { if (f_j > 0 && f_o != f_j && str[i] == 'O') { f_o++; } else { if (f_o > 0 && f_i != f_o && str[i] == 'I') { f_i++; } else { if (f_j == f_o && f_o == f_i) { if (f_i > max_k) { max_k = f_i; } } else { f_j = 0; f_o = 0; f_i = 0; } } } } } CO max_k E return 0; }
a.cc:46:16: error: conflicting declaration 'std::vector<std::__cxx11::basic_string<char> > str' 46 | vector<string> str; | ^~~ a.cc:42:8: note: previous declaration as 'std::string str' 42 | string str; | ^~~
s803669194
p00494
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<vector> #include<math.h> #include<queue> #include <algorithm> #include<functional> #include<cstdlib> #include<cmath> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define CI cin >> #define CO cout << #define E << endl; using namespace std; typedef pair<int, int> P; typedef pair<long, long> LP; typedef pair<int, P> PP; typedef pair<long, LP> LPP; int dy[] = { 0, 0, 1, -1, 0 }; int dx[] = { 1, -1, 0, 0, 0 }; int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0; double V = 0; int n = 0; double L = 0; double S = 0; double ar = 0, br = 0, cr = 0; int answer = 0; string sA, strB; vector<vector<char>> map; vector<double> num; //vector<string> str; int sum = 0; vector<int> value; vector<int> weight; int dp[110][10010]; int data_[210][2] = { -2 }; const long long int III = 1000010; char str[III]; void input(void) { scanf_s("%s",str,III); return; } int main(void) { input(); long long int f_j = 0; long long int f_o = 0; long long int f_i = 0; long long int max_k = 0; for (int i = 0; i < 1000005; i++) { if (str[i] == 'J') { if (f_o == 0 && f_i == 0) { f_j++; } if (f_o != 0 || f_i != 0) { f_j = 1; f_o = 0; f_i = 0; } } else { if (f_j > 0 && f_o != f_j && str[i] == 'O') { f_o++; } else { if (f_o > 0 && f_i != f_o && str[i] == 'I') { f_i++; if (f_j >= f_o && f_o == f_i) { if (f_o > max_k) { max_k = f_o; } f_j = 0; f_o = 0; f_i = 0; } } else { f_j = 0; f_o = 0; f_i = 0; } } } } CO max_k E return 0; } /*#include<stdio.h> #include<string.h> int n, m; int k; int len; int flgj = 0, flgo = 0, flg; int j = 0, o = 0, i = 0; int max = 0; int temp; char s[1000010]; int main(void) { scanf_s("%s", s, 1000010); len = strlen(s); for (k = 0; k<len; k++) { flg = 0; if (s[k] == 'J' && flgo == 0) { j++; flgj = 1; if (s[k + 1] == 'I') { flg = 1; } } else if (s[k] == 'O' && flgj == 1) { o++; flgo = 1; if (s[k + 1] == 'J') { flg = 1; } } else if (s[k] == 'I' && flgo == 1) { i++; if (s[k + 1] != 'I') { flg = 2; } if (k == len - 1) { flg = 2; } } if (flg == 1) { j = 0; o = 0; flgj = 0; flgo = 0; } if (flg == 2) { //printf("%d %d %d\n",j,o,i); if (j<o || i<o) { } else { temp = j; if (temp>o) { temp = o; } if (temp>i) { temp = i; } } if (max<temp) { max = temp; } j = 0; o = 0; i = 0; flgj = 0; flgo = 0; } } printf("%d\n", max); return 0; } */
a.cc: In function 'void input()': a.cc:62:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 62 | scanf_s("%s",str,III); | ^~~~~~~ | scanf
s762075725
p00494
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<vector> #include<math.h> #include<queue> #include <algorithm> #include<functional> #include<cstdlib> #include<cmath> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define CI cin >> #define CO cout << #define E << endl; using namespace std; typedef pair<int, int> P; typedef pair<long, long> LP; typedef pair<int, P> PP; typedef pair<long, LP> LPP; int dy[] = { 0, 0, 1, -1, 0 }; int dx[] = { 1, -1, 0, 0, 0 }; int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0; double V = 0; int n = 0; double L = 0; double S = 0; double ar = 0, br = 0, cr = 0; int answer = 0; string sA, strB; vector<vector<char>> map; vector<double> num; //vector<string> str; int sum = 0; vector<int> value; vector<int> weight; int dp[110][10010]; int data_[210][2] = { -2 }; const long long int III = 1000010; char str[III]; void input(void) { scanf("%s",str); return; } int main(void) { input(); long long int f_j = 0; long long int f_o = 0; long long int f_i = 0; long long int max_k = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] == 'J') { if (f_o == 0 && f_i == 0) { f_j++; } if (f_o != 0 || f_i != 0) { f_j = 1; f_o = 0; f_i = 0; } } else { if (f_j > 0 && f_o != f_j && str[i] == 'O') { f_o++; } else { if (f_o > 0 && f_i != f_o && str[i] == 'I') { f_i++; if (f_j >= f_o && f_o == f_i) { if (f_o > max_k) { max_k = f_o; } f_j = 0; f_o = 0; f_i = 0; } } else { f_j = 0; f_o = 0; f_i = 0; } } } } CO max_k E return 0; } /*#include<stdio.h> #include<string.h> int n, m; int k; int len; int flgj = 0, flgo = 0, flg; int j = 0, o = 0, i = 0; int max = 0; int temp; char s[1000010]; int main(void) { scanf_s("%s", s, 1000010); len = strlen(s); for (k = 0; k<len; k++) { flg = 0; if (s[k] == 'J' && flgo == 0) { j++; flgj = 1; if (s[k + 1] == 'I') { flg = 1; } } else if (s[k] == 'O' && flgj == 1) { o++; flgo = 1; if (s[k + 1] == 'J') { flg = 1; } } else if (s[k] == 'I' && flgo == 1) { i++; if (s[k + 1] != 'I') { flg = 2; } if (k == len - 1) { flg = 2; } } if (flg == 1) { j = 0; o = 0; flgj = 0; flgo = 0; } if (flg == 2) { //printf("%d %d %d\n",j,o,i); if (j<o || i<o) { } else { temp = j; if (temp>o) { temp = o; } if (temp>i) { temp = i; } } if (max<temp) { max = temp; } j = 0; o = 0; i = 0; flgj = 0; flgo = 0; } } printf("%d\n", max); return 0; } */
a.cc: In function 'int main()': a.cc:75:29: error: 'strlen' was not declared in this scope 75 | for (int i = 0; i < strlen(str); i++) { | ^~~~~~ a.cc:12:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 11 | #include<cmath> +++ |+#include <cstring> 12 |
s413578372
p00494
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<vector> #include<math.h> #include<queue> #include <algorithm> #include<functional> #include<cstdlib> #include<cmath> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define CI cin >> #define CO cout << #define E << endl; using namespace std; typedef pair<int, int> P; typedef pair<long, long> LP; typedef pair<int, P> PP; typedef pair<long, LP> LPP; int dy[] = { 0, 0, 1, -1, 0 }; int dx[] = { 1, -1, 0, 0, 0 }; int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0; double V = 0; int n = 0; double L = 0; double S = 0; double ar = 0, br = 0, cr = 0; int answer = 0; string sA, strB; vector<vector<char>> map; vector<double> num; //vector<string> str; int sum = 0; vector<int> value; vector<int> weight; int dp[110][10010]; int data_[210][2] = { -2 }; const long long int III = 1000010; char str[III]; void input(void) { scanf("%s",str); return; } int main(void) { input(); long long int f_j = 0; long long int f_o = 0; long long int f_i = 0; long long int max_k = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] == 'J') { if (f_o == 0 && f_i == 0) { f_j++; } if (f_o != 0 || f_i != 0) { f_j = 1; f_o = 0; f_i = 0; } } else { if (f_j > 0 && f_o != f_j && str[i] == 'O') { f_o++; } else { if (f_o > 0 && f_i != f_o && str[i] == 'I') { f_i++; if (f_j >= f_o && f_o == f_i) { if (f_o > max_k) { max_k = f_o; } f_j = 0; f_o = 0; f_i = 0; } } else { f_j = 0; f_o = 0; f_i = 0; } } } } CO max_k E return 0; } /*#include<stdio.h> #include<string.h> int n, m; int k; int len; int flgj = 0, flgo = 0, flg; int j = 0, o = 0, i = 0; int max = 0; int temp; char s[1000010]; int main(void) { scanf_s("%s", s, 1000010); len = strlen(s); for (k = 0; k<len; k++) { flg = 0; if (s[k] == 'J' && flgo == 0) { j++; flgj = 1; if (s[k + 1] == 'I') { flg = 1; } } else if (s[k] == 'O' && flgj == 1) { o++; flgo = 1; if (s[k + 1] == 'J') { flg = 1; } } else if (s[k] == 'I' && flgo == 1) { i++; if (s[k + 1] != 'I') { flg = 2; } if (k == len - 1) { flg = 2; } } if (flg == 1) { j = 0; o = 0; flgj = 0; flgo = 0; } if (flg == 2) { //printf("%d %d %d\n",j,o,i); if (j<o || i<o) { } else { temp = j; if (temp>o) { temp = o; } if (temp>i) { temp = i; } } if (max<temp) { max = temp; } j = 0; o = 0; i = 0; flgj = 0; flgo = 0; } } printf("%d\n", max); return 0; } */
a.cc: In function 'int main()': a.cc:75:29: error: 'strlen' was not declared in this scope 75 | for (int i = 0; i < strlen(str); i++) { | ^~~~~~ a.cc:12:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 11 | #include<cmath> +++ |+#include <cstring> 12 |
s354839778
p00494
C++
/*#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<string.h> #include<vector> #include<math.h> #include<queue> #include <algorithm> #include<functional> #include<cstdlib> #include<cmath> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define CI cin >> #define CO cout << #define E << endl; using namespace std; typedef pair<int, int> P; typedef pair<long, long> LP; typedef pair<int, P> PP; typedef pair<long, LP> LPP; int dy[] = { 0, 0, 1, -1, 0 }; int dx[] = { 1, -1, 0, 0, 0 }; int H = 0; int M = 0; int S = 0; void input(void) { CI H >> M >> S; return; } int main(void) { int sum = 0; int remain = 0; int hour = 0; int minute = 0; int second = 0; while (1) { input(); if (H == -1) { return 0; } sum = H * 3600 + M * 60 + S; remain = 2 * 3600 - sum; second = remain % 60; remain -= remain % 60; remain /= 60; minute = remain % 60; remain -= remain % 60; remain /= 60; hour = remain } return 0; }*/ /*#include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<string.h> #include<vector> #include<math.h> #include<queue> #include <algorithm> #include<functional> #include<cstdlib> #include<cmath> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define CI cin >> #define CO cout << #define E << endl; using namespace std; typedef pair<int, int> P; typedef pair<long, long> LP; typedef pair<int, P> PP; typedef pair<long, LP> LPP; int dy[] = { 0, 0, 1, -1, 0 }; int dx[] = { 1, -1, 0, 0, 0 }; int H = 0; int M = 0; int S = 0; void input(void) { CI H >> M >> S; return; } int main(void) { int sum = 0; int remain = 0; int hour = 0; int minute = 0; int second = 0; while (1) { input(); if (H == -1) { return 0; } sum = H * 3600 + M * 60 + S; remain = 2 * 3600 - sum; second = remain % 60; remain -= remain % 60; remain /= 60; minute = remain % 60; remain -= remain % 60; remain /= 60; hour = remain } return 0; }*/ #include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<string.h> #include<vector> #include<math.h> #include<queue> #include <algorithm> #include<functional> #include<cstdlib> #include<cmath> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define CI cin >> #define CO cout << #define E << endl; using namespace std; int dy[] = { 0, 0, 1, -1, 0 }; int dx[] = { 1, -1, 0, 0, 0 }; const long long int III = 1000010; char str[III]; void input(void) { scanf_s("%s", str, 1000010); return; } int main(void) { input(); long long int f_j = 0; long long int f_o = 0; long long int f_i = 0; long long int max_k = 0; for (int i = 0; i < strlen(str); i++) { if (str[i] == 'J') { if (f_o == 0 && f_i == 0) { f_j++; } if (f_o != 0 || f_i != 0) { f_j = 1; f_o = 0; f_i = 0; } } else { if (f_j > 0 && f_o != f_j && str[i] == 'O') { f_o++; } else { if (f_o > 0 && f_i != f_o && str[i] == 'I') { f_i++; if (f_j >= f_o && f_o == f_i) { if (f_o > max_k) { max_k = f_o; } f_j = 0; f_o = 0; f_i = 0; } } else { f_j = 0; f_o = 0; f_i = 0; } } } } CO max_k E return 0; }
a.cc: In function 'void input()': a.cc:180:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 180 | scanf_s("%s", str, 1000010); | ^~~~~~~ | scanf
s889806688
p00494
C++
#include<iostream> #include<vector> #include<string> #include<cstdio> #include<algorithm> using namespace std; char a[1000000]; int b; int g=0; struct JOI { int J, O, I; }; JOI c(int d) { JOI e; e.J = e.O = e.I = 0; int f; for (f = d; f < b; f++) { if (a[f] != 'J')break; } e.J = f - d; d = f; for (f = d; f < b; f++) { if (a[f] != 'O')break; } e.O = f - d; d = f; for (f = d; f < b; f++) { if (a[f] != 'I')break; } e.I = f - d; return e; } int main() { scanf("%s", a); b = strlen(a); int MAX = 0; for (;g < b;g++) { if (a[g] == 'J') { JOI s = c(g); if (s.O <= s.I&&s.O <= s.J)MAX = max(MAX, s.O); } } cout << MAX << endl; }
a.cc: In function 'int main()': a.cc:37:9: error: 'strlen' was not declared in this scope 37 | b = strlen(a); | ^~~~~~ a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include<algorithm> +++ |+#include <cstring> 6 | using namespace std;
s542017395
p00494
C++
//============================================================================ // Name : AOJ.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include <cstdio> #include <string> #include <cctype> using namespace std; int main() { char s[1000000]; cin>>s; int N; N=strlen(s); int ans=0; int a0,a1,a2,a3; for(a0=0; a0<N; a0=a3){ for(a1=a0; s[a1]=='J'; a1++); for(a2=a1; s[a2]=='O'; a2++); for(a3=a2; s[a3]=='I'; a3++); if(a1-a0>=a2-a1 && a2-a1<=a3-a2){ if(ans<a2-a1){ ans=a2-a1; } } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:20:11: error: 'strlen' was not declared in this scope 20 | N=strlen(s); | ^~~~~~ a.cc:13:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 12 | #include <cctype> +++ |+#include <cstring> 13 | using namespace std;
s163175801
p00494
C++
#include <bits/stdc++.h> using namespace std; #define loop(i,n) for(int i=1;i<=n;i++) typedef P pair<char,int>; vector<P> v; int main(){ char c; while(cin>>c){ if(!v.empty()&&v.back().first==c){ v.back().second++; }else{ v.push_back(P(c,1)); } } int m=0; loop(p,v.size()-2){ if(v[p-1].first=='J'&&v[p].first=='O'&&v[p+1].first=='I'){ int j=v[p-1].second; int o=v[p].second; int i=v[p+1].second; if(j<=o&&o>=i){ m=max(m,o); } } cout<<m<<endl; } return 0; }
a.cc:5:9: error: 'P' does not name a type 5 | typedef P pair<char,int>; | ^ a.cc:6:8: error: 'P' was not declared in this scope 6 | vector<P> v; | ^ a.cc:6:9: error: template argument 1 is invalid 6 | vector<P> v; | ^ a.cc:6:9: error: template argument 2 is invalid a.cc: In function 'int main()': a.cc:11:11: error: request for member 'empty' in 'v', which is of non-class type 'int' 11 | if(!v.empty()&&v.back().first==c){ | ^~~~~ a.cc:11:22: error: request for member 'back' in 'v', which is of non-class type 'int' 11 | if(!v.empty()&&v.back().first==c){ | ^~~~ a.cc:12:9: error: request for member 'back' in 'v', which is of non-class type 'int' 12 | v.back().second++; | ^~~~ a.cc:14:9: error: request for member 'push_back' in 'v', which is of non-class type 'int' 14 | v.push_back(P(c,1)); | ^~~~~~~~~ a.cc:14:19: error: 'P' was not declared in this scope 14 | v.push_back(P(c,1)); | ^ a.cc:18:12: error: request for member 'size' in 'v', which is of non-class type 'int' 18 | loop(p,v.size()-2){ | ^~~~ a.cc:4:34: note: in definition of macro 'loop' 4 | #define loop(i,n) for(int i=1;i<=n;i++) | ^ a.cc:19:9: error: invalid types 'int[int]' for array subscript 19 | if(v[p-1].first=='J'&&v[p].first=='O'&&v[p+1].first=='I'){ | ^ a.cc:19:28: error: invalid types 'int[int]' for array subscript 19 | if(v[p-1].first=='J'&&v[p].first=='O'&&v[p+1].first=='I'){ | ^ a.cc:19:45: error: invalid types 'int[int]' for array subscript 19 | if(v[p-1].first=='J'&&v[p].first=='O'&&v[p+1].first=='I'){ | ^ a.cc:20:14: error: invalid types 'int[int]' for array subscript 20 | int j=v[p-1].second; | ^ a.cc:21:14: error: invalid types 'int[int]' for array subscript 21 | int o=v[p].second; | ^ a.cc:22:14: error: invalid types 'int[int]' for array subscript 22 | int i=v[p+1].second; | ^
s769300397
p00494
C++
#include<iostream> #include<math.h> using namespace std; #define FOR(i,a) for(int i=0;i<a;i++) char joi[1000000]; int retu[1000000]; int main(){ int ans; int rennsa[4]; rennsa[0]=1;rennsa[1]=0;rennsa[2]=0;rennsa[3]=0; int i=0; while(cin>>joi[i];){ if(cin.eof()==true){break;} if(joi[i]=='J'){ if(rennsa[0]==1){rennsa[1]++;} else{rennsa[0]=1;rennsa[1]=1;rennsa[2]=0;rennsa[3]=0;} } else if(joi[i]=='O'){ if(rennsa[0]==2 or rennsa[0]==1){ rennsa[0]=2; if(rennsa[2]<rennsa[1]){rennsa[2]++;} else{rennsa[0]=1;rennsa[1]=0;rennsa[2]=0;rennsa[3]=0;} } else{rennsa[0]=1;rennsa[1]=0;rennsa[2]=0;rennsa[3]=0;} } else if(joi[i]=='I'){ if(rennsa[0]==2 or rennsa[0]==3){ rennsa[0]=3; if(rennsa[3]<rennsa[2]){ rennsa[3]++; ans=max(ans,rennsa[3]); } else{rennsa[0]=1;rennsa[1]=0;rennsa[2]=0;rennsa[3]=0;} } else{rennsa[0]=1;rennsa[1]=0;rennsa[2]=0;rennsa[3]=0;} } cout<<rennsa[0]<<" "<<rennsa[1]<<" "<<rennsa[2]<<" "<<rennsa[3]<<endl; i++; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:26: error: expected ')' before ';' token 12 | while(cin>>joi[i];){ | ~ ^ | ) a.cc:12:27: error: expected primary-expression before ')' token 12 | while(cin>>joi[i];){ | ^
s976753854
p00494
C++
#include<bits/stdc++.h> using namespace std; int main() { string q; cin>>q; int q_len = q.size(); int q_l = q_len / 3; int ans = 0; string JOI("JOI"); for(int i = 1;i <= q_l;++i){ if(i != 1){ int a = JOI.begin(); JOI.insert(a + (i - 1),'J'); JOI.insert(a + i + (i - 1),'O'); JOI.insert(a + i + i + (i - 1),'I'); } string co; for(int j = 0;j <= q_len - (3*i);++j){ if(j == 0){ for(int k = 0;k < (3 * i);++k){ co += q.at(k); } } else{ co.erase(co.begin()); co += q.at(j + (3*i) - 1); } if(JOI == co){ ans = i; break; } } } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:24: error: cannot convert 'std::__cxx11::basic_string<char>::iterator' to 'int' in initialization 17 | int a = JOI.begin(); | ~~~~~~~~~^~ | | | std::__cxx11::basic_string<char>::iterator a.cc:18:17: error: no matching function for call to 'std::__cxx11::basic_string<char>::insert(int, char)' 18 | JOI.insert(a + (i - 1),'J'); | ~~~~~~~~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:2007:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (near match) 2007 | insert(size_type __pos, const _CharT* __s) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:2007:7: note: conversion of argument 2 would be ill-formed: a.cc:18:30: error: invalid conversion from 'char' to 'const char*' [-fpermissive] 18 | JOI.insert(a + (i - 1),'J'); | ^~~ | | | char /usr/include/c++/14/bits/basic_string.h:1876:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1876 | insert(const_iterator __p, _InputIterator __beg, _InputIterator __end) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:1876:9: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/basic_string.h:2069:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 2069 | insert(size_type __pos, const _Tp& __svt) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:2069:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = char; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:2069:2: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::insert(size_type, const _Tp&) [with _Tp = char]' 2069 | insert(size_type __pos, const _Tp& __svt) | ^~~~~~ a.cc:18:17: required from here 18 | JOI.insert(a + (i - 1),'J'); | ~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:2086:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 2086 | insert(size_type __pos1, const _Tp& __svt, | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:2086:9: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/basic_string.h:1831:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; const_iterator = std::__cxx11::basic_string<char>::const_iterator; size_type = long unsigned int]' 1831 | insert(const_iterator __p, size_type __n, _CharT __c) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:1831:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/basic_string.h:1911:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; const_iterator = std::__cxx11::basic_string<char>::const_iterator]' 1911 | insert(const_iterator __p, initializer_list<_CharT> __l) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:1911:29: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>::const_iterator' 1911 | insert(const_iterator __p, initializer_list<_CharT> __l) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:1939:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 1939 | insert(size_type __pos1, const basic_string& __str) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:1939:52: note: no known conversion for argument 2 from 'char' to 'const std::__cxx11::basic_string<char>&' 1939 | insert(size_type __pos1, const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:1963:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 1963 | insert(size_type __pos1, const basic_string& __str, | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:1963:7: note: candidate expects 4 arguments, 2 provided /usr/include/c++/14/bits/basic_string.h:1987:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 1987 | insert(size_type __pos, const _CharT* __s, size_type __n) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:1987:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/basic_string.h:2032:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 2032 | insert(size_type __pos, size_type __n, _CharT __c) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:2032:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/basic_string.h:2051:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(__const_iterator, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]' 2051 | insert(__const_iterator __p, _CharT __c) | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:2051:31: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'} 2051 | insert(__const_iterator __p, _CharT __c) | ~~~~~~~~~~~~~~~~~^~~ a.cc:19:17: error: no matching function for call to 'std::__cxx11::basic_string<char>::insert(int, char)' 19 | JOI.insert(a + i + (i - 1),'O'); | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:2007:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>;
s249721838
p00494
C++
int main (int argc, char *argv[]) { string str; int ans = 0; int n1, n2, n3; cin>>str; for (int i = 0; i < str.length(); ++i) { n1 = n2 = n3 = 0; while (str[i] == 'J') { n1++; i++; } while (str[i] == 'O') { n2++; i++; } while (str[i] == 'I') { n3++; i++; } if(n2 <= n1 && n2 <= n3) ans = max(ans, n2); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main(int, char**)': a.cc:2:5: error: 'string' was not declared in this scope 2 | string str; | ^~~~~~ a.cc:5:5: error: 'cin' was not declared in this scope 5 | cin>>str; | ^~~ a.cc:5:10: error: 'str' was not declared in this scope; did you mean 'std'? 5 | cin>>str; | ^~~ | std a.cc:21:40: error: 'max' was not declared in this scope 21 | if(n2 <= n1 && n2 <= n3) ans = max(ans, n2); | ^~~ a.cc:23:5: error: 'cout' was not declared in this scope 23 | cout<<ans<<endl; | ^~~~ a.cc:23:16: error: 'endl' was not declared in this scope 23 | cout<<ans<<endl; | ^~~~
s802509757
p00494
C++
#define _USE_MATH_DEFINES #define INF 0x3f3f3f3f #include <cstdio> #include <iostream> #include <sstream> #include <cmath> #include <cstdlib> #include <algorithm> #include <queue> #include <stack> #include <limits> #include <map> #include <string> #include <cstring> #include <set> #include <deque> #include <bitset> #include <list> #include <cctype> #include <utility> using namespace std; typedef long long ll; typedef pair <int,int> P; typedef pair <int,P > PP; int tx[] = {0,1,0,-1}; int ty[] = {-1,0,1,0}; static const double EPS = 1e-8; struct Jinfo{ int start; int len; }; int main(){ string str; while(cin >> str){ int res = 0; deque<char> que; int c = 0; for(int i=0;i<str.size();i++){ if(str[i]=='J'){ if(que.size() == 0){ res = max(c,res); } que.push_back(str[i]); } else if(str[i]=='O'){ if(que.size() > 0 && que.back() == 'J'){ que.pop_back(); que.push_front(str[i]); } else{ c = 0; que.clear(); } } else if(str[i]=='I'){ if(que.size() > 0 && que.front() == 'O'){ que.push_back(str[i]); que.pop_front(); c++; } else{ res = max(res,count(que.begin(),que.end(),'I')); c = 0; que.clear(); } } } res = max(res,count(que.begin(),que.end(),'I')); printf("%d\n",res); } }
a.cc: In function 'int main()': a.cc:72:50: error: no matching function for call to 'max(int&, std::__iterator_traits<std::_Deque_iterator<char, char&, char*>, void>::difference_type)' 72 | res = max(res,count(que.begin(),que.end(),'I')); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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:4: /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:72:50: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__iterator_traits<std::_Deque_iterator<char, char&, char*>, void>::difference_type' {aka 'long int'}) 72 | res = max(res,count(que.begin(),que.end(),'I')); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:8: /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:72:50: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 72 | res = max(res,count(que.begin(),que.end(),'I')); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:80:26: error: no matching function for call to 'max(int&, std::__iterator_traits<std::_Deque_iterator<char, char&, char*>, void>::difference_type)' 80 | res = max(res,count(que.begin(),que.end(),'I')); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:80:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__iterator_traits<std::_Deque_iterator<char, char&, char*>, void>::difference_type' {aka 'long int'}) 80 | res = max(res,count(que.begin(),que.end(),'I')); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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 /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:80:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 80 | res = max(res,count(que.begin(),que.end(),'I')); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s426896533
p00494
C++
#include <cstdio> #include <cstring> using namespace std; char s[1000001]; int main(){ scanf("%
a.cc:6:7: warning: missing terminating " character 6 | scanf("% | ^ a.cc:6:7: error: missing terminating " character 6 | scanf("% | ^~ a.cc: In function 'int main()': a.cc:6:7: error: expected primary-expression at end of input 6 | scanf("% | ^ a.cc:6:7: error: expected '}' at end of input a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s982519906
p00494
C++
#include <cstdio> #include <string> #include <cstring> using namespace std; string s; string a="j",b="o",c="i"; int main(){ scanf("%s",s); int leng=s.size(); for(int i=leng/3;i>=0;i++){ stirng x="j"; for(int j=1;j<i;j++){ x+=a; } for(int j=0;j<i;j++){ x+=b; } for(int j=1;j<i;j++){ x+=c; } if(strstr(s,x)!=NULL){ printf("%d\n",i); } } return 0; }
a.cc: In function 'int main()': a.cc:11:17: error: 'stirng' was not declared in this scope 11 | stirng x="j"; | ^~~~~~ a.cc:13:25: error: 'x' was not declared in this scope 13 | x+=a; | ^ a.cc:16:25: error: 'x' was not declared in this scope 16 | x+=b; | ^ a.cc:19:25: error: 'x' was not declared in this scope 19 | x+=c; | ^ a.cc:21:29: error: 'x' was not declared in this scope 21 | if(strstr(s,x)!=NULL){ | ^
s686835116
p00494
C++
#include <cstdio> #include <string> #include <cstring> using namespace std; string s; string a="j",b="o",c="i"; int main(){ scanf("%s",s); int leng=s.size(); for(int i=leng/3;i>=0;i++){ string x="j"; for(int j=1;j<i;j++){ x+=a; } for(int j=0;j<i;j++){ x+=b; } for(int j=1;j<i;j++){ x+=c; } if(strstr(s,x)!=NULL){ printf("%d\n",i); } } return 0; }
a.cc: In function 'int main()': a.cc:21:26: error: no matching function for call to 'strstr(std::string&, std::string&)' 21 | if(strstr(s,x)!=NULL){ | ~~~~~~^~~~~ In file included from /usr/include/c++/14/cstring:43, from a.cc:3: /usr/include/string.h:330:14: note: candidate: 'char* strstr(char*, const char*)' 330 | extern char *strstr (char *__haystack, const char *__needle) | ^~~~~~ /usr/include/string.h:330:28: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char*' 330 | extern char *strstr (char *__haystack, const char *__needle) | ~~~~~~^~~~~~~~~~ /usr/include/string.h:332:20: note: candidate: 'const char* strstr(const char*, const char*)' 332 | extern const char *strstr (const char *__haystack, const char *__needle) | ^~~~~~ /usr/include/string.h:332:40: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*' 332 | extern const char *strstr (const char *__haystack, const char *__needle) | ~~~~~~~~~~~~^~~~~~~~~~
s580312241
p00494
C++
#include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; int main() { static char str[1200000]; int len; vector<pair<char, int> > x; scanf("%s", str); len = strlen(str); for(int i = 0; i < len; ++i) { int it = i; while(it < len && str[it] == str[i]) ++it; x.push_back(make_pair(str[i], it - i)); i = it - 1; } int ans = 0; for(int i = 0; i < x.size() - 2; ++i) { pair<char, int> jjj = x[i], ooo = x[i + 1], iii = x[i + 2]; if(jjj.first != 'J' || ooo.first != 'O' || iii != 'I') continue; if(ooo.second > jjj.second || ooo.second > iii.second) continue; ans = max(ans, min(jjj.second, ooo.second, iii.second)); } printf("%d\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:23:48: error: no match for 'operator!=' (operand types are 'std::pair<char, int>' and 'char') 23 | if(jjj.first != 'J' || ooo.first != 'O' || iii != 'I') | ~~~ ^~ ~~~ | | | | | char | std::pair<char, int> In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/vector:62, from a.cc:3: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:23:51: note: mismatched types 'const std::pair<_T1, _T2>' and 'char' 23 | if(jjj.first != 'J' || ooo.first != 'O' || iii != 'I') | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:23:51: note: 'std::pair<char, int>' is not derived from 'const std::reverse_iterator<_Iterator>' 23 | if(jjj.first != 'J' || ooo.first != 'O' || iii != 'I') | ^~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:23:51: note: 'std::pair<char, int>' is not derived from 'const std::reverse_iterator<_Iterator>' 23 | if(jjj.first != 'J' || ooo.first != 'O' || iii != 'I') | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:23:51: note: 'std::pair<char, int>' is not derived from 'const std::move_iterator<_IteratorL>' 23 | if(jjj.first != 'J' || ooo.first != 'O' || iii != 'I') | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:23:51: note: 'std::pair<char, int>' is not derived from 'const std::move_iterator<_IteratorL>' 23 | if(jjj.first != 'J' || ooo.first != 'O' || iii != 'I') | ^~~ In file included from /usr/include/c++/14/vector:63: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_Tp1>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:23:51: note: 'std::pair<char, int>' is not derived from 'const std::allocator<_Tp1>' 23 | if(jjj.first != 'J' || ooo.first != 'O' || iii != 'I') | ^~~ In file included from /usr/include/c++/14/vector:66: /usr/include/c++/14/bits/stl_vector.h:2096:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator!=(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2096 | operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2096:5: note: template argument deduction/substitution failed: a.cc:23:51: note: 'std::pair<char, int>' is not derived from 'const std::vector<_Tp, _Alloc>' 23 | if(jjj.first != 'J' || ooo.first != 'O' || iii != 'I') | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/vector:87: /usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2613 | operator!=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed: a.cc:23:51: note: 'std::pair<char, int>' is not derived from 'const std::tuple<_UTypes ...>' 23 | if(jjj.first != 'J' || ooo.first != 'O' || iii != 'I') | ^~~ /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]': a.cc:27:19: required from here 27 | ans = max(ans, min(jjj.second, ooo.second, iii.second)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s396022717
p00494
C++
#include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; int main() { static char str[1200000]; int len; vector<pair<char, int> > x; scanf("%s", str); len = strlen(str); for(int i = 0; i < len; ++i) { int it = i; while(it < len && str[it] == str[i]) ++it; x.push_back(make_pair(str[i], it - i)); i = it - 1; } int ans = 0; for(int i = 0; i < x.size() - 2; ++i) { pair<char, int> jjj = x[i], ooo = x[i + 1], iii = x[i + 2]; if(jjj.first != 'J' || ooo.first != 'O' || iii.first != 'I') continue; if(ooo.second > jjj.second || ooo.second > iii.second) continue; ans = max(ans, min(jjj.second, ooo.second, iii.second)); } printf("%d\n", ans); return 0; }
In file included from /usr/include/c++/14/vector:62, from a.cc:3: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]': a.cc:27:19: required from here 27 | ans = max(ans, min(jjj.second, ooo.second, iii.second)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s452009380
p00494
C++
#include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; int main() { static char str[1200000]; int len; vector<pair<char, int> > x; scanf("%s", str); len = strlen(str); for(int i = 0; i < len; ++i) { int it = i; while(it < len && str[it] == str[i]) ++it; x.push_back(make_pair(str[i], it - i)); i = it - 1; } int ans = 0; for(int i = 0; i < x.size() - 2; ++i) { pair<char, int> jjj = x[i], ooo = x[i + 1], iii = x[i + 2]; if(jjj.first != 'J' || ooo.first != 'O' || iii.first != 'I') continue; if(ooo.second > jjj.second || ooo.second > iii.second) continue; ans = max(ans, min(min(jjj.second, ooo.second), iii.second))); } printf("%d\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:27:61: error: expected ';' before ')' token 27 | ans = max(ans, min(min(jjj.second, ooo.second), iii.second))); | ^ | ;
s473880965
p00494
C++
#include <iostream> #include <string> using namespace std; int main(){ int K,cnt; char *in; char *joi; char JOI[4] = {"JOI"}; in = new char [1000001]; joi = new char [1000001]; cin >> in; K = strlen(in) / 3; for(int i = K; i > 0; i--){ cnt = 0; for(int c = 0; c < 3; c++){ for(int j = 0; j < i; j++){ joi[cnt] = JOI[c]; cnt++; } } joi[cnt] = '\0'; if(strstr(in,joi) != NULL){ cout << i << endl; break; } } return 0; }
a.cc: In function 'int main()': a.cc:17:13: error: 'strlen' was not declared in this scope 17 | K = strlen(in) / 3; | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | #include <string> a.cc:28:20: error: 'strstr' was not declared in this scope 28 | if(strstr(in,joi) != NULL){ | ^~~~~~ a.cc:28:20: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s477766169
p00494
C++
#include <cstdio> using namespace std; #define rep(i, n) REP(i, 0, n) #define REP(i, x, n) for(int i = x; i < n; i++) int main() { const string joi = "JOI"; string str; cin >> str; int ans = 0; rep(i, str.size()) { int cs[3] = {0}; rep(j, 3) while(str[i] == joi[j]) cs[j]++; if(cs[0] >= cs[1] && cs[2] >= cs[1]) ans = max(ans, cs[1]); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:8:9: error: 'string' does not name a type; did you mean 'stdin'? 8 | const string joi = "JOI"; | ^~~~~~ | stdin a.cc:10:3: error: 'string' was not declared in this scope 10 | string str; | ^~~~~~ a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' 1 | #include <cstdio> +++ |+#include <string> 2 | using namespace std; a.cc:11:3: error: 'cin' was not declared in this scope 11 | cin >> str; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include <cstdio> +++ |+#include <iostream> 2 | using namespace std; a.cc:11:10: error: 'str' was not declared in this scope; did you mean 'std'? 11 | cin >> str; | ^~~ | std a.cc:18:33: error: 'joi' was not declared in this scope 18 | rep(j, 3) while(str[i] == joi[j]) cs[j]++; | ^~~ a.cc:20:50: error: 'max' was not declared in this scope 20 | if(cs[0] >= cs[1] && cs[2] >= cs[1]) ans = max(ans, cs[1]); | ^~~ a.cc:23:3: error: 'cout' was not declared in this scope 23 | cout << ans << endl; | ^~~~ a.cc:23:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:23:18: error: 'endl' was not declared in this scope 23 | cout << ans << endl; | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include <cstdio> +++ |+#include <ostream> 2 | using namespace std;
s681123962
p00495
C
c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);}
main.c:1:1: warning: data definition has no type or storage class 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:1:9: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^ main.c:1:17: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^ main.c:1:19: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^ main.c:1:21: error: type defaults to 'int' in declaration of 'u' [-Wimplicit-int] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^ main.c:1:23: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^ main.c:1:25: error: type defaults to 'int' in declaration of 'f' [-Wimplicit-int] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^ main.c:1:27: error: initialization of 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^~~~~~ main.c:1:27: error: initializer element is not computable at load time main.c:1:34: error: return type defaults to 'int' [-Wimplicit-int] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^~~~ main.c: In function 'main': main.c:1:34: error: type of 'x' defaults to 'int' [-Wimplicit-int] main.c:1:46: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} main.c:1:46: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^~~~~ main.c:1:46: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:66: error: 'a' undeclared (first use in this function) 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^ main.c:1:66: note: each undeclared identifier is reported only once for each function it appears in main.c:1:74: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^ | | | int main.c:1:74: note: expected 'const char *' but argument is of type 'int' main.c:1:90: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^~~~~ main.c:1:90: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:96: error: passing argument 1 of 'scanf' makes pointer from integer without a cast [-Wint-conversion] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^ | | | int main.c:1:96: note: expected 'const char *' but argument is of type 'int' main.c:1:162: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^~~~~~ main.c:1:162: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:162: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:162: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:169: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion] 1 | c[5004],d[5004],m,t,u,i,f="%d\n";main(x){for(scanf("%d%*d",c);i<*a;scanf(f,++i+c));for(;~scanf(f,&x);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=x-c[i]?u:t+1;m=!printf(f,m);} | ^ | | | int main.c:1:169: note: expected 'const char *' but argument is of type 'int'
s379535267
p00495
C
c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;}
main.c:1:1: warning: data definition has no type or storage class 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:1:9: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} | ^ main.c:1:17: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} | ^ main.c:1:19: error: type defaults to 'int' in declaration of 'u' [-Wimplicit-int] 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} | ^ main.c:1:21: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} | ^ main.c:1:23: error: return type defaults to 'int' [-Wimplicit-int] 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} | ^ main.c: In function 'p': main.c:1:23: error: type of 'z' defaults to 'int' [-Wimplicit-int] main.c:1:31: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} main.c:1:31: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} | ^~~~~ main.c:1:31: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:37: error: 't' undeclared (first use in this function) 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} | ^ main.c:1:37: note: each undeclared identifier is reported only once for each function it appears in main.c:1:51: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} | ^~~~~~ main.c:1:51: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:51: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:51: note: include '<stdio.h>' or provide a declaration of 'printf' main.c: At top level: main.c:1:64: error: return type defaults to 'int' [-Wimplicit-int] 1 | c[5004],d[5004],m,u,i;p(z){u=~scanf(t="%d\n",z)||!printf(t,m);}main(t){for(p(c),p(d);i<*c;p(++i+c));for(;p(d);)for(u=i=t=0;i++<*c;t=d[i],d[i]=m<u?m=u:u)u=*d-c[i]?u:t+1;} | ^~~~ main.c: In function 'main': main.c:1:64: error: type of 't' defaults to 'int' [-Wimplicit-int]
s312596308
p00495
C
#include <stdio.h> #include <stdlib.h> #include <memory.h> #define mem(x,y) (x*)malloc(sizeof(x)*(y)) int main() { int a,b; scanf("%d %d",&a,&b); int* an = mem(int,a); int* bu = mem(int,b); int i,j; int max = 0; for(i = 0;i < a;i++) { scanf("%d",an+i); } for(i = 0;i < b;i++) { scanf("%d",bu+i); } for(i = 0;i < b;i++) { int pt = i; for(j = 0;j < a;j++) { if(an[j] == bn[pt]) { pt++; } if(pt == b) break; } if((pt-i)>max) { max = pt-i; } } printf("%d\n",max); return 0; }
main.c: In function 'main': main.c:27:37: error: 'bn' undeclared (first use in this function); did you mean 'bu'? 27 | if(an[j] == bn[pt]) | ^~ | bu main.c:27:37: note: each undeclared identifier is reported only once for each function it appears in
s250606051
p00495
C++
#include <cstdio> #define rep(i,n) for(int i=0;i<n;i++) int n,m,ans,a[5000],b[5000]; int main(){ scanf("%d%d", &n, &m); rep(i,n) scanf("%d",&a[i]); rep(i,m) scanf("%d",&b[i]); rep(i,m){ if(ans>=m.size()-i)break; int cnt=0; rep(j,n){ if(i+cnt>=m)break; if(a[j]==b[i+cnt])cnt++; } if(cnt>ans)ans=cnt; } printf("%d\n",ans); }
a.cc: In function 'int main()': a.cc:11:27: error: request for member 'size' in 'm', which is of non-class type 'int' 11 | if(ans>=m.size()-i)break; | ^~~~
s156431575
p00495
C++
#include<iosteream> #include<algorithm> #include<vector> using namespace std; int main(void){ int na,nb; cin>>na>>nb; vector<int> a(na); vector<int> b(nb); for(int i = 0 ; i < na ; i ++){ cin>>a[i]; } for(int i = 0 ; i < nb ; i ++){ cin>>b[i]; } int dp[2][5001]={{}}; int m = 0; for(int i = 1 ; i <= nb ; i ++){ for(int j = 1 ; j <= na ; j ++){ if(a[j-1]==b[i-1]){ dp[i&1][j] = max(dp[i&1][j-1],dp[i-1&1][j-1] + (a[j-1]==b[i-1])); }else{ dp[i&1][j] = dp[i&1][j-1]; } m = max(m,dp[i&1][j]); } } cout<<m<<endl; }
a.cc:1:9: fatal error: iosteream: No such file or directory 1 | #include<iosteream> | ^~~~~~~~~~~ compilation terminated.
s800157660
p00495
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i, s, n) for(int i = s; i < (int)n; i++) #define per(i, n) for(int i = n; i >= 0; i--) #define ROF(i, s, n) for(int i = s; i >= (int)n; i--) #define FORIT(i, A) for (auto i : A) #define PRINT(x) cout << (x) << "\n" #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define MP make_pair #define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i) #define SZ(a) int((a).size()) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define CLR(a) memset((a), 0 ,sizeof(a)) #define NCLR(a) memset((a), -1 ,sizeof(a)) #define dump(x) cout << #x << " = " << (x) << "\n"; #define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n"; #define sq(n) (n) * (n) typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; typedef vector<LL> VLL; typedef vector<VLL> VVLL; typedef unsigned int uint; typedef unsigned long long ull; typedef priority_queue<int> maxpq; typedef priority_queue< int, vector<int>, greater<int> > minpq; typedef complex<double> P; static const double EPS = 1e-10; static const double PI = acos( -1.0 ); static const int mod = 1000000007; static const int INF = 1 << 29; static const LL LL_INF = 1152921504606846976; static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 }; static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 }; static int dp[ 5000 ][ 5000 ][ 2 ]; static int a, b; static int cards_1[ 5000 ] static int cards_2[ 5000 ]; static int solve( int now_a, int now_b, bool g ) { if ( now_a == a || now_b == b ) { return 0; } if ( dp[ now_a ][ now_b ][ g ] >= 0 ) { return dp[ now_a ][ now_b ][ g ]; } static int res; res = 0; if ( cards_1[ now_a ] == cards_2[ now_b ] ) { res = solve( now_a + 1, now_b + 1, true ) + 1; } res = max( res, max( solve( now_a + 1, now_b, g ), g ? 0 : solve( now_a, now_b + 1, g ) ) ); return dp[ now_a ][ now_b ][ g ] = res; } int main() { scanf( "%d %d", &a, &b ); for ( int i = 0; i < a; i++ ) { scanf( "%d", &cards_1[ i ] ); } for ( int i = 0; i < b; i++ ) { scanf( "%d", &cards_2[ i ] ); } NCLR( dp ); int ans = solve( 0, 0, false ); printf( "%d\n", ans ); return 0; }
a.cc:45:1: error: expected initializer before 'static' 45 | static int cards_2[ 5000 ]; | ^~~~~~ a.cc: In function 'int solve(int, int, bool)': a.cc:55:14: error: 'cards_1' was not declared in this scope 55 | if ( cards_1[ now_a ] == cards_2[ now_b ] ) { | ^~~~~~~ a.cc:55:34: error: 'cards_2' was not declared in this scope 55 | if ( cards_1[ now_a ] == cards_2[ now_b ] ) { | ^~~~~~~ a.cc: In function 'int main()': a.cc:65:31: error: 'cards_1' was not declared in this scope 65 | scanf( "%d", &cards_1[ i ] ); | ^~~~~~~ a.cc:68:31: error: 'cards_2' was not declared in this scope 68 | scanf( "%d", &cards_2[ i ] ); | ^~~~~~~
s188007776
p00495
C++
#include <bits/stdc++.h> #define FOR(i,n) for(int i=0;i<(int)(n);i++) #define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++) #define pb(a) push_back(a) #define mp(x,y) make_pair(x,y) #define ALL(a) a.begin(),a.end() #define ZERO(a) memset(a,0,sizeof(a)) #define INF(a) memset(a,1000000000,sizeof(a)) #define len(a) sizeof(a) #define ll long long #define pii pair<int,int> #define INF 1<<29 #define MAX 5010 using namespace std; int n,m,a[MAX],b[MAX],pos[1010]; void solve(){ cin>>n>>m; FOR(i,n) cin>>a[i]; FOR(i,m) cin>>b[i]; INF(pos); FOR(i,n) pos[a[i]]=min(i,pos[a[i]]); FOR(i,1001) if(pos[i]==1000000000) pos[i]=-1; int ma=0; FOR(i,m){ int now=-1; FOR(j,i,m){ if(pos[j]>now) now=pos[j]; else{ ma=max(ma,j-i); break; } if(i==m-1) ma=max(ma,m-i); } } cout<<ma<<endl; } int main(){ solve(); return 0; }
a.cc:12:9: warning: "INF" redefined 12 | #define INF 1<<29 | ^~~ a.cc:8:9: note: this is the location of the previous definition 8 | #define INF(a) memset(a,1000000000,sizeof(a)) | ^~~ a.cc:28:12: error: macro "FOR" passed 3 arguments, but takes just 2 28 | FOR(j,i,m){ | ^ a.cc:2:9: note: macro "FOR" defined here 2 | #define FOR(i,n) for(int i=0;i<(int)(n);i++) | ^~~ a.cc: In function 'void solve()': a.cc:22:5: error: expression cannot be used as a function 22 | INF(pos); | ^ a.cc:28:3: error: 'FOR' was not declared in this scope 28 | FOR(j,i,m){ | ^~~
s056390748
p00495
C++
#include<bits/stdc++.h> #include<algorithm> #include<vector> #include<queue> using namespace std; typedef long long ll; int A,B,a[5000],b[5000]; int dp[5001]; int main(){ scanf("%d%d",&A,&B); for(int i=0;i<A;i++) scanf("%d",&a[i]); for(int i=0;i<B;i++) scanf("%d",&b[i]); int res=0; for(int i=1;i<=A;i++) for(int j=1;j<=B;j++){ dp[j]=dp[j]; if(a[i-1]==b[j-1]) dp[j]=max(dp[j-1]+1,dp[i][j]); res=max(res,dp[j]); } printf("%d\n",res); }
a.cc: In function 'int main()': a.cc:18:61: error: invalid types 'int[int]' for array subscript 18 | if(a[i-1]==b[j-1]) dp[j]=max(dp[j-1]+1,dp[i][j]); | ^
s538513045
p00495
C++
#include <bits/stdc++.h> #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--) #define REP(i,n) for(int i=0;i<(n);i++) #define RREP(i,n) for(int i=n-1;i>=0;i--) #define PB push_back #define INF (1<<29) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define CLR(a) memset(a,0,sizeof(a)) const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0}; typedef long long int ll; using namespace std; short dp[5001][5001]; int main(){ int a,b; cin >> a >> b; memset(dp,0,sizeof(dp)); vector<int> c1(a); vector<int> c2(b); REP(i,a){ cin >> c1[i]; } REP(i,b){ cin >> c2[i]; } REP(i,a){ dp[i+1][0] = dp[i][b]; REP(j,b){ if(c1[i] == c2[j]){ dp[i+1][j+1] = dp[i][j] + 1; }else dp[i+1][j+1] = dp[i][j]; } } int ans = 0; FOR(i,1,b+1) ans = max(dp[a][i],ans); cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:40:27: error: no matching function for call to 'max(short int&, int&)' 40 | FOR(i,1,b+1) ans = max(dp[a][i],ans); | ~~~^~~~~~~~~~~~~~ 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: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:40:27: note: deduced conflicting types for parameter 'const _Tp' ('short int' and 'int') 40 | FOR(i,1,b+1) ans = max(dp[a][i],ans); | ~~~^~~~~~~~~~~~~~ /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: /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:40:27: note: mismatched types 'std::initializer_list<_Tp>' and 'short int' 40 | FOR(i,1,b+1) ans = max(dp[a][i],ans); | ~~~^~~~~~~~~~~~~~
s512992150
p00495
C++
#include <stdio.h> #include <algorithm> using namespace std; int A, B, a[1000], b[1000]; int main() { scanf("%d%d", &A, &B); for(int i = 0; i < A; i++) scanf("%d", &a[i]); for(int i = 0; i < B; i++) scanf("%d", &b[i]); int ret = 0; for(int i = 0; i < B; i++) { int pos = i; for(int j = 0; j < A; j++) { if(pos == B) break; if(b[pos] == A[j]) pos++; } ret = max(ret, pos - i); } printf("%d\n", ret); return 0; }
a.cc: In function 'int main()': a.cc:14:39: error: invalid types 'int[int]' for array subscript 14 | if(b[pos] == A[j]) pos++; | ^
s895038462
p00495
C++
#include<cstdio> #include<cstdlib> #include<vector> using name space std; int main(void){ int a[5000]; int b[5001]; int aa; int bb; int n; int max; int s; int c; max=0; scanf("%d %d",&aa,&bb); for(int i=0;i<aa;i++){ scanf("%d",&a[i]); } for(int i=0;i<bb;i++){ scanf("%d",&b[i]); } b[bb]=10000000; for(int i=0;i<bb;i++){ s=0; c=i; for(int j=0;j<aa;j++){ if(a[j]==b[c]){ c++; s++; } } if(s>max)max=s; } printf("%d\n",max); return 0; }
a.cc:4:7: error: expected nested-name-specifier before 'name' 4 | using name space std; | ^~~~
s200406818
p00495
C++
#include<cstdio> #include<cstring> #include<algorithm> int a[5001],b[5001]; int c,d,i,j,s=0; void main(){ scanf("%d%d",&c,&d); for(i=0;i<c;i++){ scanf("%d",&a[i]); } for(j=0;j<d;j++){ scanf("%d",&b[j]); } for(int now=0;now<d;now++){ int r=now; for(i=0;i<c;i++){ if(a[i]==b[r]){ r++; if(r==d){ break; } } } s=std::max(r-now,s); } printf("%d\n",s); }
a.cc:6:1: error: '::main' must return 'int' 6 | void main(){ | ^~~~
s358609247
p00495
C++
#include<algorithm> int a[5001],b[5001]; int c,d,i,j,s=0; int main(){ scanf("%d%d",&c,&d); for(i=0;i<c;i++){ scanf("%d",&a[i]); } for(j=0;j<d;j++){ scanf("%d",&b[j]); } for(int now=0;now<d;now++){ int r=now; for(i=0;i<c;i++){ if(a[i]==b[r]){ r++; if(r==d){ break; } } } s=std::max(r-now,s); } printf("%d\n",s);return 0; }
a.cc: In function 'int main()': a.cc:5:1: error: 'scanf' was not declared in this scope 5 | scanf("%d%d",&c,&d); | ^~~~~ a.cc:24:1: error: 'printf' was not declared in this scope 24 | printf("%d\n",s);return 0; | ^~~~~~ a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 1 | #include<algorithm> +++ |+#include <cstdio> 2 | int a[5001],b[5001];
s179445973
p00495
C++
#include <cstdio> #include <algorithm> using namespace std; int n; int m; int be[5005],en[5005]; int main() { scanf("%d %d",&n,&m); for(int i=1;i<=n;i++) { scanf("%d",&be[i]); } for(int i=1;i<=m;i++) { scanf("%d",&en[i]); } int ans=0; for(int i=1;i<=m;i++) { int last=i; for(int i=1;i<=n;i++) { if(en[last]==st[i]) { last++; if(last==m+1) break; } } ans=max(ans,last-i); } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:24:26: error: 'st' was not declared in this scope; did you mean 'std'? 24 | if(en[last]==st[i]) | ^~ | std
s610143910
p00495
C++
include<iostream> #include<map> #include<algorithm> #include<vector> using namespace std; int main() { map<int,bool> exist; int a,b; cin >> a >> b; vector<int> A,B; vector<vector<int> > men; men.resize(2); men[0].resize(b),men[1].resize(b); A.resize(a),B.resize(b); for(int i=0;i<a;i++) cin >> A[i]; for(int i=0;i<b;i++) cin >> B[i],men[0][i] = men[1][i] = 0,exist[B[i]] = true; int mex = 0; for(int i=0;i<a;i++) { if(!exist[A[i]]) continue; for(int j=0;j<b;j++) { if(A[i] == B[j]) { men[1][j] = max(men[0][j],j-1>=0?men[0][j-1]+1:0); mex = max(men[1][j],mex); } } men[0] = men[1]; } cout << mex << endl; return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/bits/stl_tree.h:63, from /usr/include/c++/14/map:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | str
s110500623
p00495
C++
line = gets A = gets.split B = gets.split ans = 0 A.each.with_index do |a, i| count = 0 B.each do |b| if A[i] == b count += 1 i += 1 end end ans = [ans, count].max end puts ans
a.cc:1:1: error: 'line' does not name a type 1 | line = gets | ^~~~
s820520910
p00496
C
#include<bits/stdc++.h> #define rep(i,n)for(int i=0;i<n;i++) using namespace std; typedef long long ll; int a[3000],b[3000]; ll dp1[3000][3000],dp2[3000][3000]; int main() { int n,t,s;scanf("%d%d%d",&n,&t,&s); rep(i,n)scanf("%d%d",&a[i],&b[i]); int Max=0; for(int i=0;i<n;i++){ for(int j=0;j<=s;j++){ if(b[i]>j)dp1[i+1][j]=dp1[i][j]; else{ if(dp1[i][j]<dp1[i][j-b[i]]+a[i]){ Max=i; dp1[i+1][j]=dp1[i][j-b[i]]+a[i]; } else dp1[i+1][j]=dp1[i][j]; } } } for(int i=Max;i<n;i++){ for(int j=0;j<=t-s;j++){ if(b[i]>j)dp2[i+1][j]=dp2[i][j]; else dp2[i+1][j]=max(dp2[i][j],dp2[i][j-b[i]]+a[i]); } } printf("%lld\n",(ll)dp1[n][s]+dp2[n][t-s]); }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s750013545
p00496
C++
#include<cstdio> using namespace std; int main(){ int N, T, S, M[3001]={}, maxM=0; scanf("%d%d%d", &N, &T, &S); if(S==0){ for(int n=0; n<N; n++){ scanf("%d%d", &mise_fun, &mise_time); cin >> mise_fun >> mise_time; for(int t=T; t>=mise_time; t--) int newM = M[t-mise_time] + mise_fun; if(M[t] > newM){ M[t] = newM; maxM = newM; } } } else{ for(int n=0; n<N; n++){ int mise_fun, mise_time; scanf("%d%d", &mise_fun, &mise_time); for(int t=T; t>=mise_time; t--) if(t<=S || t >= S + mise_time){ int newM = M[t-mise_time] + mise_fun; if(M[t] > newM){ M[t] = newM; maxM = newM; } } } } cout << maxM << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:40: error: 'mise_fun' was not declared in this scope 8 | scanf("%d%d", &mise_fun, &mise_time); | ^~~~~~~~ a.cc:8:51: error: 'mise_time' was not declared in this scope 8 | scanf("%d%d", &mise_fun, &mise_time); | ^~~~~~~~~ a.cc:9:25: error: 'cin' was not declared in this scope 9 | cin >> mise_fun >> mise_time; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include<cstdio> +++ |+#include <iostream> 2 | using namespace std; a.cc:12:38: error: 't' was not declared in this scope 12 | if(M[t] > newM){ | ^ a.cc:12:43: error: 'newM' was not declared in this scope 12 | if(M[t] > newM){ | ^~~~ a.cc:32:9: error: 'cout' was not declared in this scope 32 | cout << maxM << endl; | ^~~~ a.cc:32:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:32:25: error: 'endl' was not declared in this scope 32 | cout << maxM << endl; | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include<cstdio> +++ |+#include <ostream> 2 | using namespace std;
s206849027
p00496
C++
#include<cstdio> using namespace std; int main(){ int N, T, S, M[3001]={}, maxM=0; scanf("%d%d%d", &N, &T, &S); if(S==0){ for(int n=0; n<N; n++){ int mise_fun, mise_time; scanf("%d%d", &mise_fun, &mise_time); for(int t=T; t>=mise_time; t--) int newM = M[t-mise_time] + mise_fun; if(M[t] > newM){ M[t] = newM; maxM = newM; } } } else{ for(int n=0; n<N; n++){ int mise_fun, mise_time; scanf("%d%d", &mise_fun, &mise_time); for(int t=T; t>=mise_time; t--) if(t<=S || t >= S + mise_time){ int newM = M[t-mise_time] + mise_fun; if(M[t] > newM){ M[t] = newM; maxM = newM; } } } } printf("%d\n", maxM); return 0; }
a.cc: In function 'int main()': a.cc:12:38: error: 't' was not declared in this scope 12 | if(M[t] > newM){ | ^ a.cc:12:43: error: 'newM' was not declared in this scope 12 | if(M[t] > newM){ | ^~~~
s204546650
p00496
C++
#include<iostream> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N, T, S, M[3001]={}, maxM=0; cin >> N >> T >> S; if(S==0){ for(int n=0; n<N; n++){ int mise_fun, mise_time; cin >> mise_fun >> mise_time; for(int t=T; t>=mise_time; t--){ int newM = M[t-mise_time] + mise_fun; if(M[t] < newM){ M[t] = newM; if(maxM<newM)maxM = newM; } } } } else{ for(int n=0; n<N; n++){ int mise_fun, mise_time; cin >> mise_fun >> mise_time; for(int t=T; t>=mise_time; t--){ if(t<=S || t >= S + mise_time){ int newM = M[t-mise_time] + mise_fun; if(M[t] < newM){ M[t] = newM; if(maxM<newM)maxM = newM; } } } } } cout << *max_element(M+1, M+T+1) << endl; return 0; }
a.cc: In function 'int main()': a.cc:37:18: error: 'max_element' was not declared in this scope 37 | cout << *max_element(M+1, M+T+1) << endl; | ^~~~~~~~~~~
s481179207
p00496
C++
include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int N, T, S; cin >> N >> T >> S; vector<int> A(N); vector<int> B(N); vector<int> dp(T+1, 0); for (int i = 0; i < N; i++){ cin >> A[i] >> B[i]; } int ans = 0; for (int n = 0; n <N; n++){ for (int t = T-B[n]; t >= 0; t--){ if (t < S && S < t+B[n]) continue; dp[t] = max(dp[t]+A[n], dp[t+B[n]]); ans = max(ans, dp[t+B[n]]); } } cout << ans << endl; return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s885944797
p00496
C++
include<bits/stdc++.h> using namespace std; int dp[3001][3001]; int a[3000], b[3000]; int N, T, S; int rec(int idx, int time){ if(idx == N || time == T) return(0); if(~dp[idx][time]) return(dp[idx][time]); int ret = max( rec( idx + 1, time), rec( idx, time + 1)); if((time + b[idx] <= S || time >= S) && time + b[idx] <= T){ ret = max( ret, rec( idx + 1, time + b[idx]) + a[idx]); } return(dp[idx][time] = ret); } int main(){ fill_n( *dp, 3001 * 3001, -1); cin >> N >> T >> S; for(int i = 0; i < N; i++){ cin >> a[i] >> b[i]; } cout << rec(0,0) << endl; }
a.cc:1:1: error: 'include' does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int rec(int, int)': a.cc:11:13: error: 'max' was not declared in this scope 11 | int ret = max( rec( idx + 1, time), rec( idx, time + 1)); | ^~~ a.cc: In function 'int main()': a.cc:19:3: error: 'fill_n' was not declared in this scope 19 | fill_n( *dp, 3001 * 3001, -1); | ^~~~~~ a.cc:20:3: error: 'cin' was not declared in this scope 20 | cin >> N >> T >> S; | ^~~ a.cc:24:3: error: 'cout' was not declared in this scope 24 | cout << rec(0,0) << endl; | ^~~~ a.cc:24:23: error: 'endl' was not declared in this scope 24 | cout << rec(0,0) << endl; | ^~~~
s492323879
p00496
C++
n, t, s = gets.split.map &:to_i s = t - s if 2 * s < t items = $<.map{|s| s.split.reverse.map &:to_i} table = (0..1).map { (0..s).map{|g| [0] * ((g < t-s ? g : t-s) + 1)} } for k in 0..items.size-1 c, v = items[k] for i in 0..s j_max = (i < t-s ? i : t-s) for j in 0..j_max cand = [] cand << table[0][i][j] cand << table[0][i][j-c] + v if j >= c y, x = i-c, j y, x = x, y if x > y cand << table[0][y][x] + v if i >= c table[1][i][j] = cand.max end end table << table.shift end p table[-1][s][t-s]
a.cc:6:10: error: too many decimal points in number 6 | table = (0..1).map { (0..s).map{|g| [0] * ((g < t-s ? g : t-s) + 1)} } | ^~~~ a.cc:6:23: error: too many decimal points in number 6 | table = (0..1).map { (0..s).map{|g| [0] * ((g < t-s ? g : t-s) + 1)} } | ^~~~ a.cc:7:10: error: too many decimal points in number 7 | for k in 0..items.size-1 | ^~~~~~~~~~~~~~~ a.cc:9:18: error: too many decimal points in number 9 | for i in 0..s | ^~~~ a.cc:11:26: error: too many decimal points in number 11 | for j in 0..j_max | ^~~~~~~~ a.cc:1:1: error: 'n' does not name a type 1 | n, t, s = gets.split.map &:to_i | ^ a.cc:6:1: error: 'table' does not name a type; did you mean 'mutable'? 6 | table = (0..1).map { (0..s).map{|g| [0] * ((g < t-s ? g : t-s) + 1)} } | ^~~~~ | mutable a.cc:7:1: error: expected unqualified-id before 'for' 7 | for k in 0..items.size-1 | ^~~
s998145880
p00496
C++
//Solution for aoj 0573: Night Market #include<iostream> #include<algorithm> using namespace std; int n, s, t, time = 0, happy = 0 , ans; double save; int sho[3000][2], dp[3000][3000]; void solve(){ for (int i = 2; i <= n; i++){ for (int j = 1; j <= t; j++){ dp[i][j] = max(dp[i][j], max(dp[i - 1][j], dp[i][j - 1])); if (j >= s || s > j + sho[i + 1][1]){ if (j + sho[i + 1][1] <= t) dp[i + 1][j + sho[i + 1][1]] = dp[i][j] + sho[i + 1][0]; } } } } int main(){ cin >> n >> t >> s; for (int i = 1; i <= n; i++){ cin >> sho[i][0] >> sho[i][1]; } for (int i = 1; i <= t; i++){ if (i >= sho[1][1]) dp[1][i] = sho[1][0]; if (i >= s || s >= sho[2][1] + i){ dp[2][i + sho[2][1]] = dp[1][i] + sho[2][0]; } } solve(); cout << dp[n][t] << endl; }
a.cc:5:14: error: 'int time' redeclared as different kind of entity 5 | int n, s, t, time = 0, happy = 0 , ans; | ^~~~ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)' 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~
s527591835
p00496
C++
#include <iostream> using namespace std; int a[3010],b[3010],dp[2][3010],mm1[3010][2],mm2[3010][2]; int main(){ int N,T,S,I,O,hog,hma,res; cin>>N>>T>>S; for(int i=1;i<=N;i++){ cin>>a[i]>>b[i]; } memset(dp[0],-1,sizeof(dp[0])); I=0;O=1; dp[0][0]=0; for(int i=1;i<=N;i++){ memset(dp[O],-1,sizeof(dp[O])); hma=-1; for(int j=0;j<=S;j++){ hog=dp[I][j]; if(j>=b[i]&&dp[I][j-b[i]]!=-1)hog=max(hog,dp[I][j-b[i]]+a[i]); dp[O][j]=hog; hma=max(hma,hog); } mm1[i][0]=hma; hog=dp[I][S+1]; if(S+1>=b[i]&&dp[I][S+1-b[i]]!=-1)hog=max(hog,dp[I][S+1-b[i]]+a[i]); dp[O][S+1]=hog; mm1[i][1]=max(hma,hog); swap(I,O); } memset(dp[I],-1,sizeof(dp[I])); dp[I][0]=0; for(int i=N;i>=1;i--){ memset(dp[O],-1,sizeof(dp[O])); hma=-1; for(int j=0;j<=T-S;j++){ hog=dp[I][j]; if(j>=b[i]&&dp[I][j-b[i]]!=-1)hog=max(hog,dp[I][j-b[i]]+a[i]); dp[O][j]=hog; hma=max(hma,hog); } mm2[i][1]=hma; hog=dp[I][T-S+1]; if(T-S+1>=b[i]&&dp[I][T-S+1-b[i]]!=-1)hog=max(hog,dp[I][T-S+1-b[i]]+a[i]); dp[O][T-S+1]=hog; mm2[i][0]=max(hma,hog); swap(I,O); } res=0; mm1[0][0]=mm1[0][1]=mm2[N+1][0]=mm2[N+1][1]=0; for(int i=0;i<=N;i++){ for(int j=0;j<2;j++){ //cout<<i<<" "<<j<<" "<<mm1[i][j]<<" "<<mm2[i][j]<<endl; res=max(mm1[i][j]+mm2[i+1][j],res); } } cout<<res<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:9: error: 'memset' was not declared in this scope 11 | memset(dp[0],-1,sizeof(dp[0])); | ^~~~~~ 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 | using namespace std;
s487549830
p00496
C++
#include <algorithm> #include <iostream> #include <cstdint> using namespace std; int N,T,S,A[3000],B[3000]; int dp[3000][3000]; void init() { memset(dp,NULL,3000*3000); } int rc(int depth,int time,int d_end) { if(dp[depth][time] != 0) { return dp[depth][time]; } else { int res1 = 0; int res2 = 0; if(depth < d_end && time > 0) { if(B[depth] <= time) { res1 = rc(depth + 1,time - B[depth],d_end) + A[depth]; } res2 = rc(depth + 1,time,d_end); } int result = max(res1,res2); dp[depth][time] = result; return result; } } int main(void) { cin >> N >> T >> S; for(int i = 0;i < N;i++) { cin >> A[i] >> B[i]; } int maxres = 0; for(int i = 0;i <= N;i++) { init(); int rc1 = rc(0,S,i); init(); int rc2 = rc(i,T - S,N); maxres = max(rc1 + rc2, maxres); } cout << maxres << endl; return 0; }
a.cc: In function 'void init()': a.cc:13:9: error: 'memset' was not declared in this scope 13 | memset(dp,NULL,3000*3000); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <cstdint> +++ |+#include <cstring> 4 |
s486645503
p00496
C++
#include <algorithm> #include <iostream> #include <cstdint> using namespace std; int N,T,S,A[3000],B[3000]; int dp[3000][3000]; void init() { memset(dp,NULL,3000*3000); } int rc(int depth,int time,int d_end) { if(dp[depth][time] != 0) { return dp[depth][time]; } else { int res1 = 0; int res2 = 0; if(depth < d_end && time > 0) { if(B[depth] <= time) { res1 = rc(depth + 1,time - B[depth],d_end) + A[depth]; } res2 = rc(depth + 1,time,d_end); } int result = max(res1,res2); dp[depth][time] = result; return result; } } int main(void) { cin >> N >> T >> S; for(int i = 0;i < N;i++) { cin >> A[i] >> B[i]; } int maxres = 0; for(int i = 0;i <= N;i++) { init(); int rc1 = rc(0,S,i); init(); int rc2 = rc(i,T - S,N); maxres = max(rc1 + rc2, maxres); } cout << maxres << endl; return 0; }
a.cc: In function 'void init()': a.cc:13:9: error: 'memset' was not declared in this scope 13 | memset(dp,NULL,3000*3000); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <cstdint> +++ |+#include <cstring> 4 |
s155478531
p00496
C++
#include<iostream> #include<string> #include<cmath> #include<queue> #include<map> #include<set> #include<list> #include<iomanip> #include<vector> #include<functional> #include<algorithm> #include<cstdio> using namespace std; typedef long long ll; int dp[3001][3001]; ll n, t, s; struct A { ll a, b; }; A a[3000]; ll solve(ll i, ll j) { if (i == n) return 0; ll sum = 0; if (j + a[i].b <= t) { if (j<s&&j + a[i].b>s&&s+a[i].b<=t) { if (dp[i + 1][s + a[i].b] != -1) { sum = max(sum, a[i].a + dp[i + 1][s + a[i].b]); } else { sum = max(sum, a[i].a + (dp[i + 1][s + a[i].b] = solve(i + 1, s + a[i].b))); } } else if (!(j<s&&j + a[i].b>s)){ if (dp[i + 1][j + a[i].b] != -1) { sum = max(sum, a[i].a + dp[i + 1][j + a[i].b]); } else { sum = max(sum, a[i].a + (dp[i + 1][j + a[i].b] = solve(i + 1, j + a[i].b))); } } }//?????? if (dp[i + 1][j] != -1) { sum = max(sum, dp[i + 1][j]); } else { sum = max(sum, dp[i + 1][j] = solve(i + 1, j)); }//???????????? return sum; } int main() { while (cin >> n >> t >> s) { for (ll i = 0; i < n; i++) { cin >> a[i].a >> a[i].b; for (ll j = 0; j <= t; j++) { dp[i][j] = -1; } } cout << solve(0, 0) << endl; } }
a.cc: In function 'll solve(ll, ll)': a.cc:45:26: error: no matching function for call to 'max(ll&, int&)' 45 | sum = max(sum, dp[i + 1][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:45:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 45 | sum = max(sum, dp[i + 1][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:11: /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:45:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 45 | sum = max(sum, dp[i + 1][j]); | ~~~^~~~~~~~~~~~~~~~~~~ a.cc:48:26: error: no matching function for call to 'max(ll&, int&)' 48 | sum = max(sum, dp[i + 1][j] = solve(i + 1, j)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:48:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 48 | sum = max(sum, dp[i + 1][j] = solve(i + 1, 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 /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:48:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 48 | sum = max(sum, dp[i + 1][j] = solve(i + 1, j)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s079214561
p00496
C++
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; int N, S, T; int A[3000], B[3000]; int dp[3001][3001]; int main() { cin >> N >> T >> S; for (int i = 0; i < N; i++) { cin >> A[i] >> B[i]; } dp[0][0] = 0; if (B[0] <= S && B[0] < T)dp[B[0]][1] = A[0]; for (int i = 0; i < T - 1; i++) { for (int j = 0; j < N; j++) { dp[i + 1][j] = max(dp[i][j], dp[i + 1][j]); dp[i][j + 1] = max(dp[i][j], dp[i][j + 1]); if (((i <= S && i + B[j] <= S) || (S <= i)) && i + B[j] < T) dp[i + B[j]][j + 1] = max(dp[i + B[j]][j + 1], dp[i][j] + A[j]); } } ll ans = 0; for (int i = 0; i <= N; i++)ans = max(ans, dp[T - 1][i]); cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:30:42: error: no matching function for call to 'max(ll&, int&)' 30 | for (int i = 0; i <= N; i++)ans = max(ans, dp[T - 1][i]); | ~~~^~~~~~~~~~~~~~~~~~~ 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:30:42: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 30 | for (int i = 0; i <= N; i++)ans = max(ans, dp[T - 1][i]); | ~~~^~~~~~~~~~~~~~~~~~~ /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:30:42: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 30 | for (int i = 0; i <= N; i++)ans = max(ans, dp[T - 1][i]); | ~~~^~~~~~~~~~~~~~~~~~~
s673607194
p00496
C++
#include<stdio.h> #include<algorithm> using namespace std; int a[3000],b[3000],c[3001][3001]; int main(void) { int n,s,t,i,j,m; scanf("%d %d %d",&m,&s,&t); for(i=0;i<m;i++){ scanf("%d %d",&a[i],&b[i]); } for(i=0;i<=m;i++){ for(j=0;j<=s;j++){ c[i][j]=0; } } for(i=0;i<m;i++){ for(j=0;j<=s;j++){ if(j+b[i]<=s&&c[i+1][j+b[i]]<a[i]+c[i][j]&&(j+b[i]<=t||j>=t)){ c[i+1][j+b[i]]=a[i]+c[i][j]; } if(c[i+1][j]<c[i][j]){ c[i+1][j]=c[i][j]; } } } /* for(i=0;i<=m;i++){ for(j=0;j<=s;j++){ printf("%d ",c[i][j]); } printf("\n"); */ } n=0; for(i=0;i<=s;i++){ if(n<c[m][i]){ n=c[m][i]; } } printf("%d\n",n); return 0; }
a.cc:33:9: error: 'n' does not name a type 33 | n=0; | ^ a.cc:34:9: error: expected unqualified-id before 'for' 34 | for(i=0;i<=s;i++){ | ^~~ a.cc:34:17: error: 'i' does not name a type 34 | for(i=0;i<=s;i++){ | ^ a.cc:34:22: error: 'i' does not name a type 34 | for(i=0;i<=s;i++){ | ^ a.cc:39:15: error: expected constructor, destructor, or type conversion before '(' token 39 | printf("%d\n",n); | ^ a.cc:40:9: error: expected unqualified-id before 'return' 40 | return 0; | ^~~~~~ a.cc:41:1: error: expected declaration before '}' token 41 | } | ^
s722279222
p00496
C++
include<stdio.h> #include<algorithm> using namespace std; int a[3000],b[3000],c[3001][3001]; int main(void) { int n,s,t,i,j,m; scanf("%d %d %d",&m,&s,&t); for(i=0;i<m;i++){ scanf("%d %d",&a[i],&b[i]); } for(i=0;i<=m;i++){ for(j=0;j<=s;j++){ c[i][j]=0; } } for(i=0;i<m;i++){ for(j=0;j<=s;j++){ if(j+b[i]<=s&&c[i+1][j+b[i]]<a[i]+c[i][j]&&(j+b[i]<=t||j>=t)){ c[i+1][j+b[i]]=a[i]+c[i][j]; } if(c[i+1][j]<c[i][j]){ c[i+1][j]=c[i][j]; } } } /* for(i=0;i<=m;i++){ for(j=0;j<=s;j++){ printf("%d ",c[i][j]); } printf("\n"); } */ n=0; for(i=0;i<=s;i++){ if(n<c[m][i]){ n=c[m][i]; } } printf("%d\n",n); return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<stdio.h> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s907429257
p00496
C++
#include<stdio.h> int max,n,m,h,max,sum,a[100000],b[3000],i; int main(void) { scanf("%d %d %d",&n,&m,&h); for(i=1;i<=n;i++) scanf("%d %d",&a[i],&b[i]); sum=0; max=0; func(0,1); printf("%d\n",max); return 0; } int func(int m1,int n1){ if(n>=n1&&m>=m1){ if(m1<h&&m1+b[n1]>h); else if(m1+b[n1]<=m){ m1+=b[n1]; sum+=a[n1]; } // printf("%d %d %d\n",n1,m1,sum); if(m1==m&&sum>max) max=sum; func(m1+1,n1+1); } }
a.cc:2:15: error: redefinition of 'int max' 2 | int max,n,m,h,max,sum,a[100000],b[3000],i; | ^~~ a.cc:2:5: note: 'int max' previously declared here 2 | int max,n,m,h,max,sum,a[100000],b[3000],i; | ^~~ a.cc: In function 'int main()': a.cc:8:9: error: 'func' was not declared in this scope 8 | func(0,1); | ^~~~ a.cc: In function 'int func(int, int)': a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type] 23 | } | ^
s400849077
p00496
C++
//============================================================================ // Name : tiny.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include <cstring> #include <vector> typedef unsigned int uint; typedef unsigned long ul; #define rep(i,n) for(long i = 0;i<n;i++) using namespace std; long happy[3010],time[3010]; long dp[3010][3010]; int main() { long N,T,S; memset(dp,0,sizeof(dp)); memset(happy,0,sizeof(happy)); memset(time,0,sizeof(time)); cin >> N >> T >> S; rep(i,N){ uint A,B; cin >> A >> B; happy[i] = A;time[i] = B; } for(long i = 0;i<N;i++)for(long j = 0;j<T;j++){ if(j - time[i] >S){ dp[i][j] = max(dp[i-1][j],dp[i-1][j-time[i]] + happy[i]); } else if(j-time[i] < S && j-time[i] >=0){ dp[i][j] = max(dp[i-1][j],dp[i-1][j-time[i]] + happy[i]); } } //ul result = 0; rep(i,T){ //cout << dp[N-1][i] << " "; } cout << dp[N-1][T-1]; return 0; }
a.cc:17:27: error: 'long int time [3010]' redeclared as different kind of entity 17 | long happy[3010],time[3010]; | ^ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:9: /usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)' 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~ a.cc: In function 'int main()': a.cc:23:30: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive] 23 | memset(time,0,sizeof(time)); | ~^~~~~ a.cc:23:16: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive] 23 | memset(time,0,sizeof(time)); | ^~~~ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} In file included from /usr/include/c++/14/cstring:43, from a.cc:10: /usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)' 61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); | ~~~~~~^~~ a.cc:28:36: warning: pointer to a function used in arithmetic [-Wpointer-arith] 28 | happy[i] = A;time[i] = B; | ^ a.cc:28:38: error: assignment of read-only location '*(time + ((sizetype)i))' 28 | happy[i] = A;time[i] = B; | ~~~~~~~~^~~ a.cc:31:30: warning: pointer to a function used in arithmetic [-Wpointer-arith] 31 | if(j - time[i] >S){ | ^ a.cc:31:22: error: invalid operands of types 'long int' and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} to binary 'operator-' 31 | if(j - time[i] >S){ | ~ ^ ~~~~~~~ | | | | long int time_t(time_t*) noexcept {aka long int(long int*) noexcept} a.cc:32:67: warning: pointer to a function used in arithmetic [-Wpointer-arith] 32 | dp[i][j] = max(dp[i-1][j],dp[i-1][j-time[i]] + happy[i]); | ^ a.cc:32:60: error: invalid operands of types 'long int' and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} to binary 'operator-' 32 | dp[i][j] = max(dp[i-1][j],dp[i-1][j-time[i]] + happy[i]); | ~^~~~~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | long int a.cc:34:33: warning: pointer to a function used in arithmetic [-Wpointer-arith] 34 | else if(j-time[i] < S && j-time[i] >=0){ | ^ a.cc:34:26: error: invalid operands of types 'long int' and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} to binary 'operator-' 34 | else if(j-time[i] < S && j-time[i] >=0){ | ~^~~~~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | long int a.cc:34:50: warning: pointer to a function used in arithmetic [-Wpointer-arith] 34 | else if(j-time[i] < S && j-time[i] >=0){ | ^ a.cc:34:43: error: invalid operands of types 'long int' and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} to binary 'operator-' 34 | else if(j-time[i] < S && j-time[i] >=0){ | ~^~~~~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | long int a.cc:35:67: warning: pointer to a function used in arithmetic [-Wpointer-arith] 35 | dp[i][j] = max(dp[i-1][j],dp[i-1][j-time[i]] + happy[i]); | ^ a.cc:35:60: error: invalid operands of types 'long int' and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} to binary 'operator-' 35 | dp[i][j] = max(dp[i-1][j],dp[i-1][j-time[i]] + happy[i]); | ~^~~~~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | long int
s754156985
p00496
C++
#include <cstdio> #include <algorithm> using namespace std; int main(){ long long n,s,t,a[3001],b[3001]; long long dp[3001][3001]={}; scanf("%lld %lld %lld",&n,&s,&t); for(int i=0;i<n;i++){ scanf("%d %d",&a[i],&b[i]); } for(int i=0;i<n;i++){ for(int j=0;j<=t;j++){ if(j<b[i]){ dp[i+1][j]=dp[i][j]; }else{ if(j-b[i]<t-s && t-s<j){ dp[i+1][j]=max(dp[i][j],dp[i][t-s]+a[i]); }else{ dp[i+1][j]=max(dp[i][j],dp[i][j-b[i]]+a[i]); } } } printf("%lld\n",dp[n][t]); return 0; }
a.cc: In function 'int main()': a.cc:25:2: error: expected '}' at end of input 25 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s240396910
p00496
C++
#include <cstdio> #include <algorithm> using namespace std; long long dp[3001][3001]={}; long long x[3001][2]; long long n,t,s; int main(){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j-x[i+1][1]<0){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=dp[i][j]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}else{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j>s && j-x[i+1][1]<s){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=dp[i][j]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}else{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long long maxi=0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int k=0;k<=j-x[i+1][1];k++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;maxi=max(maxi,dp[i][k]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=max(dp[i][j],maxi+x[i+1][0]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}/*DEGwer*/ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//for(int i=1;i<=n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; for(int j=0;j<=t;j++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;&#160;&#160;&#160;&#160; printf("%d ",dp[i][j]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; } &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; printf("\n"); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long long&#160; ans=0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//for(int i=0;i<=t;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;&#160;ans=max(ans,dp[n][i]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printf("%lld\n",dp[n][t]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%d",&n); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return 0; &#160;&#160;&#160;&#160;}
a.cc:8:2: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:8: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:14: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:20: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:26: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:32: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:38: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:44: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:9:2: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:8: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:14: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:20: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:26: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:32: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:38: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:44: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:10:2: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:8: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:14: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:20: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:26: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:32: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:38: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:44: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:50: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:56: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:62: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:68: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:11:2: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:8: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:14: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:20: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:26: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:32: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:38: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:44: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:12:2: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:8: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:14: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:20: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:26: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:32: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:38: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:44: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:13:2: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:8: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:14: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:20: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:26: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:32: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:38: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:44: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:14:2: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:8: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:14: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:20: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:26: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:32: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:38: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:44: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:50: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:56: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:62: error
s617079483
p00496
C++
#include <cstdio> #include <algorithm> using namespace std; long long dp[3001][3001]={}; long long x[3001][2]; long long n,t,s; int main(){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j-x[i+1][1]<0){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=dp[i][j]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}else{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j>s && j-x[i+1][1]<s){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=dp[i][j]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}else{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long long maxi=0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int k=0;k<=j-x[i+1][1];k++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;maxi=max(maxi,dp[i][k]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=max(dp[i][j],maxi+x[i+1][0]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}/*DEGwer*/ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//for(int i=1;i<=n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; for(int j=0;j<=t;j++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;&#160;&#160;&#160;&#160; printf("%d ",dp[i][j]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; } &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; printf("\n"); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long long&#160; ans=0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//for(int i=0;i<=t;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;&#160;ans=max(ans,dp[n][i]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printf("%lld\n",dp[n][t]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%d",&n); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return 0; &#160;&#160;&#160;&#160;}
a.cc:8:2: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:8: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:14: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:20: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:26: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:32: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:38: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:8:44: error: stray '#' in program 8 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld %lld",&n,&t,&s); | ^ a.cc:9:2: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:8: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:14: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:20: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:26: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:32: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:38: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:44: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:10:2: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:8: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:14: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:20: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:26: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:32: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:38: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:44: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:50: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:56: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:62: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:68: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:11:2: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:8: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:14: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:20: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:26: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:32: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:38: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:44: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:12:2: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:8: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:14: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:20: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:26: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:32: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:38: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:44: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:13:2: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:8: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:14: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:20: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:26: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:32: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:38: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:44: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:14:2: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:8: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:14: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:20: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:26: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:32: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:38: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:44: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:50: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:56: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:62: error
s893220099
p00496
C++
#include <cstdio> #include <algorithm> using namespace std; long long dp[3001][3001]={}; long long x[3001][2]; long long n,t,s; int main(){ scanf("%lld %lld %lld",&n,&t,&s); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j-x[i+1][1]<0){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=dp[i][j]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}else{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j>s && j-x[i+1][1]<s){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=dp[i][j]; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}else{ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long long maxi=0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int k=0;k<=j-x[i+1][1];k++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;maxi=max(maxi,dp[i][k]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[i+1][j]=max(dp[i][j],maxi+x[i+1][0]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}/*DEGwer*/ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//for(int i=1;i<=n;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; for(int j=0;j<=t;j++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;&#160;&#160;&#160;&#160; printf("%d ",dp[i][j]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; } &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160; printf("\n"); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;long long&#160; ans=0; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//for(int i=0;i<=t;i++){ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//&#160;&#160;ans=max(ans,dp[n][i]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;//} &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;printf("%lld\n",dp[n][t]); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%d",&n); &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;return 0; &#160;&#160;&#160;&#160;}
a.cc:9:2: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:8: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:14: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:20: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:26: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:32: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:38: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:9:44: error: stray '#' in program 9 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<=n;i++){ | ^ a.cc:10:2: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:8: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:14: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:20: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:26: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:32: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:38: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:44: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:50: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:56: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:62: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:10:68: error: stray '#' in program 10 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;scanf("%lld %lld",&x[i][0],&x[i][1]); | ^ a.cc:11:2: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:8: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:14: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:20: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:26: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:32: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:38: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:11:44: error: stray '#' in program 11 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;} | ^ a.cc:12:2: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:8: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:14: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:20: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:26: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:32: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:38: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:12:44: error: stray '#' in program 12 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dp[1][x[1][1]]=x[1][0]; | ^ a.cc:13:2: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:8: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:14: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:20: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:26: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:32: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:38: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:13:44: error: stray '#' in program 13 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(int i=1;i<n;i++){ | ^ a.cc:14:2: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:8: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:14: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:20: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:26: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:32: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:38: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:44: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:50: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:56: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:62: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:14:68: error: stray '#' in program 14 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for(long long j=0;j<=t;j++){ | ^ a.cc:15:2: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j-x[i+1][1]<0){ | ^ a.cc:15:8: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j-x[i+1][1]<0){ | ^ a.cc:15:14: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j-x[i+1][1]<0){ | ^ a.cc:15:20: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if(j-x[i+1][1]<0){ | ^ a.cc:15:26: error: stray '#' in program 15 | &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&