submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s270176284
p00449
C++
#include<bits/stdc++.h> #define r(i,n) for(int i=0;i<n;i++) using namespace std; int main(){ int n,m,a[101][101]; while(cin>>n>>m,n){ r(i,n)r(j,n)a[i][j]=(i==j)?0:1e9; while(m--){ int t,q,w,e; cin>>t; if(t){ cin>>q>>w>>e; if(a[--q][--w]>e){ a[q][w]=a[w][q]=e; r(i,n)r(j,n) a[i][j]=min(a[i][j],min(a[i][q]+a[q][w]+a[w][j],a[j][q]+a[q][w]+a[w][i])); } } else{ cin>>q>>w; if(a[--q][--w]!=1e9)cout<<a[q][w]<<endl; else cout<<(-1)<<endl; } } }
a.cc: In function 'int main()': a.cc:25:4: error: expected '}' at end of input 25 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s019688072
p00449
C++
#include <iostream> #include <vector> #include <cstring> #include <queue> #include <utility> #include <algorithm> #define INF 700000000 using namespace std; vector<pair<int, int>> adj[110]; int solve (int x, int d) { int dst[110]; bool done[110]; priority_queue<pair<int, int>> que; for (int i=0; i<110; i++) dst[i]=INF; memset(done, false, sizeof(done)); dst[x]=0; que.push({0,x}); while (!que.empty()) { int a=que.top().second; que.pop(); if (done[a]) continue; done[a]=true; for (auto u : adj[a]) { int b=u.first, w=u.second; if (dst[a]+w<dst[b]) { dst[b]=dst[a]+w; que.push({-dst[b], b}); } } } if (dst[d]==INF) return -1; else return dst[d]; } int main() { while (1) { adj.clear(); int n, k, a, b, c, d; bool ok; cin>>n>>k; if (n==0 && k==0) break; for (int i=0; i<k; i++) { cin>>a>>b>>c; if (a==0) { cout<<solve(b,c)<<'\n'; } else { cin>>d; ok=true; for (auto itr=adj[b].begin(); itr!=adj[b].end(); itr++) { if (itr->first==c) { itr->second=min(itr->second, d); ok=false; } } if (ok) adj[b].push_back({c,d}); ok=true; for (auto itr=adj[c].begin(); itr!=adj[c].end(); itr++) { if (itr->first==b) { itr->second=min(itr->second, d); ok=false; } } if (ok) adj[c].push_back({b,d}); } } return 0; } }
a.cc: In function 'int main()': a.cc:46:13: error: request for member 'clear' in 'adj', which is of non-class type 'std::vector<std::pair<int, int> > [110]' 46 | adj.clear(); | ^~~~~
s410820769
p00449
C++
#include <iostream> //#include <vector> using namespace std; #define INF 1000001 int main(){ int n , k , x , y; cin >> n >> k; int judge; if (n == 0 && k == 0) break; int shima[n][n]; for (int i=0 ; i < n ; i++){ for (int j=0 ; j < n ; j++){ shima[i][j] = INF; if (i == j)shima[i][j] = 0; } } for (int i=0 ; i < k ; i++){ cin >> judge; if (judge == 1){ cin >> x >> y >> cost; if (shima[x][y] > cost){ shima[x][y] = cost; shima[y][x] = cost; } for(int i=0; i < n ; i++){ for(int j=0 ; j < n ; j++){ if (shima[i][j] > shima[i][x] + shima[x][y] + shima[y][j]){ shima[i][j] = shima[i][x] + shima[x][y] + shima[y][j]); } } } }else if (judge == 0){ cin >> x >> y; if (shima[x][y] == INF) { cout << -1 << endl; } else{ cout << shima[x][y] << endl; } } //cout << cost; } }
a.cc: In function 'int main()': a.cc:14:31: error: break statement not within loop or switch 14 | if (n == 0 && k == 0) break; | ^~~~~ a.cc:30:42: error: 'cost' was not declared in this scope; did you mean 'const'? 30 | cin >> x >> y >> cost; | ^~~~ | const a.cc:40:94: error: expected ';' before ')' token 40 | shima[i][j] = shima[i][x] + shima[x][y] + shima[y][j]); | ^ | ;
s529996211
p00449
C++
#include <iostream> //#include <vector> using namespace std; #define INF 1000001 int main(){ int n , k , x , y; cin >> n >> k; int judge; if (n == 0 && k == 0) break; int shima[n][n]; for (int i=0 ; i < n ; i++){ for (int j=0 ; j < n ; j++){ shima[i][j] = INF; if (i == j)shima[i][j] = 0; } } for (int i=0 ; i < k ; i++){ cin >> judge; if (judge == 1){ cin >> x >> y >> cost; if (shima[x][y] > cost){ shima[x][y] = cost; shima[y][x] = cost; } for(int j=0; j < n ; j++){ for(int l=0 ; l < n ; l++){ if (shima[j][l] > shima[j][x] + shima[x][y] + shima[y][l]){ shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); } } } }else if (judge == 0){ cin >> x >> y; if (shima[x][y] == INF) { cout << -1 << endl; } else{ cout << shima[x][y] << endl; } } //cout << cost; } }
a.cc: In function 'int main()': a.cc:15:31: error: break statement not within loop or switch 15 | if (n == 0 && k == 0) break; | ^~~~~ a.cc:31:42: error: 'cost' was not declared in this scope; did you mean 'const'? 31 | cin >> x >> y >> cost; | ^~~~ | const a.cc:41:94: error: expected ';' before ')' token 41 | shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); | ^ | ;
s181255291
p00449
C++
#include <iostream> //#include <vector> using namespace std; #define INF 1000001 int main(){ int n , k , x , y; cin >> n >> k; int judge; int shima[n][n]; for (int i=0 ; i < n ; i++){ for (int j=0 ; j < n ; j++){ shima[i][j] = INF; if (i == j)shima[i][j] = 0; } } for (int i=0 ; i < k ; i++){ cin >> judge; if (judge == 1){ cin >> x >> y >> cost; if (shima[x][y] > cost){ shima[x][y] = cost; shima[y][x] = cost; } for(int j=0; j < n ; j++){ for(int l=0 ; l < n ; l++){ if (shima[j][l] > shima[j][x] + shima[x][y] + shima[y][l]){ shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); } } } }else if (judge == 0){ cin >> x >> y; if (shima[x][y] == INF) { cout << -1 << endl; } else{ cout << shima[x][y] << endl; } } if (n == 0 && k == 0) break; //cout << cost; } }
a.cc: In function 'int main()': a.cc:28:42: error: 'cost' was not declared in this scope; did you mean 'const'? 28 | cin >> x >> y >> cost; | ^~~~ | const a.cc:38:94: error: expected ';' before ')' token 38 | shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); | ^ | ;
s280294652
p00449
C++
#include <iostream> //#include <vector> using namespace std; #define INF 1000001 int main(){ int n , k , x , y; cin >> n >> k; int judge; int shima[n][n]; for (int i=0 ; i < n ; i++){ for (int j=0 ; j < n ; j++){ shima[i][j] = INF; if (i == j)shima[i][j] = 0; } } for (int i=0 ; i < k ; i++){ cin >> judge; if (judge == 1){ cin >> x >> y >> cost; if (shima[x][y] > cost){ shima[x][y] = cost; shima[y][x] = cost; } for(int j=0; j < n ; j++){ for(int l=0 ; l < n ; l++){ if (shima[j][l] > shima[j][x] + shima[x][y] + shima[y][l]){ shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); } } } if (judge == 0){ cin >> x >> y; if (shima[x][y] == INF) { cout << -1 << endl; } else{ cout << shima[x][y] << endl; } } if (n == 0 && k == 0) break; //cout << cost; } }
a.cc: In function 'int main()': a.cc:27:42: error: 'cost' was not declared in this scope; did you mean 'const'? 27 | cin >> x >> y >> cost; | ^~~~ | const a.cc:37:94: error: expected ';' before ')' token 37 | shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); | ^ | ; a.cc:54:2: error: expected '}' at end of input 54 | } | ^ a.cc:7:11: note: to match this '{' 7 | int main(){ | ^
s177117997
p00449
C++
#include <iostream> //#include <vector> using namespace std; #define INF 1000001 int main(){ int n , k , x , y; cin >> n >> k; int judge; int shima[n][n]; for (int i=0 ; i < n ; i++){ for (int j=0 ; j < n ; j++){ shima[i][j] = INF; if (i == j)shima[i][j] = 0; } } for (int i=0 ; i < k ; i++){ cin >> judge; if (judge == 1){ cin >> x >> y >> cost; if (shima[x][y] > cost){ shima[x][y] = cost; shima[y][x] = cost; } for(int j=0; j < n ; j++){ for(int l=0 ; l < n ; l++){ if (shima[j][l] > shima[j][x] + shima[x][y] + shima[y][l]){ shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); } } } if (judge == 0){ cin >> x >> y; if (shima[x][y] == INF) { cout << -1 << endl; } else{ cout << shima[x][y] << endl; } } if (n == 0 && k == 0) break; //cout << cost; } }
a.cc: In function 'int main()': a.cc:27:42: error: 'cost' was not declared in this scope; did you mean 'const'? 27 | cin >> x >> y >> cost; | ^~~~ | const a.cc:37:94: error: expected ';' before ')' token 37 | shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); | ^ | ; a.cc:54:2: error: expected '}' at end of input 54 | } | ^ a.cc:7:11: note: to match this '{' 7 | int main(){ | ^
s925499564
p00449
C++
#include <iostream> //#include <vector> using namespace std; #define INF 1000001 int main(){ int n , k , x , y; cin >> n >> k; int judge; int shima[n][n]; for (int i=0 ; i < n ; i++){ for (int j=0 ; j < n ; j++){ shima[i][j] = INF; if (i == j)shima[i][j] = 0; } } for (int i=0 ; i < k ; i++){ cin >> judge; if (judge == 1){ cin >> x >> y >> cost; if (shima[x][y] > cost){ shima[x][y] = cost; shima[y][x] = cost; } for(int j=0; j < n ; j++){ for(int l=0 ; l < n ; l++){ if (shima[j][l] > shima[j][x] + shima[x][y] + shima[y][l]){ shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); } } } } if (judge == 0){ cin >> x >> y; if (shima[x][y] == INF) { cout << -1 << endl; } else{ cout << shima[x][y] << endl; } } if (n == 0 && k == 0) break; //cout << cost; } }
a.cc: In function 'int main()': a.cc:27:42: error: 'cost' was not declared in this scope; did you mean 'const'? 27 | cin >> x >> y >> cost; | ^~~~ | const a.cc:37:102: error: expected ';' before ')' token 37 | shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); | ^ | ;
s713251012
p00449
C++
#include <iostream> //#include <vector> using namespace std; #define INF 1000001 int main(){ int n , k , x , y; cin >> n >> k; int judge; int shima[n][n]; for (int i=0 ; i < n ; i++){ for (int j=0 ; j < n ; j++){ shima[i][j] = INF; if (i == j)shima[i][j] = 0; } } for (int i=0 ; i < k ; i++){ cin >> judge; if (judge == 1){ cin >> x >> y >> cost; if (shima[x][y] > cost){ shima[x][y] = cost; shima[y][x] = cost; } for(int j=0; j < n ; j++){ for(int l=0 ; l < n ; l++){ if (shima[j][l] > shima[j][x] + shima[x][y] + shima[y][l]){ shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); } } } } if (judge == 0){ cin >> x >> y; if (shima[x][y] == INF) { cout << -1 << endl; } else{ cout << shima[x][y] << endl; } } if (n == 0 && k == 0) break; //cout << cost; } }
a.cc: In function 'int main()': a.cc:27:42: error: 'cost' was not declared in this scope; did you mean 'const'? 27 | cin >> x >> y >> cost; | ^~~~ | const a.cc:37:102: error: expected ';' before ')' token 37 | shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); | ^ | ;
s595440542
p00449
C++
#include <iostream> //#include <vector> using namespace std; #define INF 1000001 int main(){ int n , k , x , y; cin >> n >> k; int judge; int shima[n][n]; for (int i=0 ; i < n ; i++){ for (int j=0 ; j < n ; j++){ shima[i][j] = INF; if (i == j)shima[i][j] = 0; } } for (int i=0 ; i < k ; i++){ cin >> judge; if (judge == 1){ cin >> x >> y >> cost; if (shima[x][y] > cost){ shima[x][y] = cost; shima[y][x] = cost; } for(int j=0; j < n ; j++){ for(int l=0 ; l < n ; l++){ if (shima[j][l] > shima[j][x] + shima[x][y] + shima[y][l]){ shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); } } } } if (judge == 0){ cin >> x >> y; if (shima[x][y] == INF) { cout << -1 << endl; } else{ cout << shima[x][y] << endl; } } if (n == 0 && k == 0) break; //cout << cost; } }
a.cc: In function 'int main()': a.cc:27:42: error: 'cost' was not declared in this scope; did you mean 'const'? 27 | cin >> x >> y >> cost; | ^~~~ | const a.cc:37:102: error: expected ';' before ')' token 37 | shima[j][l] = shima[j][x] + shima[x][y] + shima[y][l]); | ^ | ;
s859502980
p00449
C++
#include<stdio.h> int graph[101][101],n,c,d; void warshall_floyd(){ int i,j; for(i=1;i<=n;i++) for(j=1;j<=n;j++) graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]); } int min(int x,int y){ return x<y?x:y; } int main(){ int k,i,j,x,e,a,b; while(scanf("%d %d",&n,&k),n,k){ for(i=0;i<=n;i++) for(j=0;j<=n;j++) graph[i][j]=i==j?0:1000000; for(i=0;i<k;i++){ if(scanf("%d",&x),x){ scanf("%d %d %d",&c,&d,&e); if(graph[c][d]>e){ graph[c][d]=graph[d][c]=e; warshall_floyd(); } }else{ scanf("%d %d",&a,&b); printf(graph[a][b]>=1000000?"-1\n":"%d\n",graph[a][b]); } } } return 0; }
a.cc: In function 'void warshall_floyd()': a.cc:8:31: error: 'min' was not declared in this scope 8 | graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]); | ^~~
s510144179
p00449
C++
#include<stdio.h> #define INF 1000000 int graph[101][101],n,c,d; void warshall_floyd(){ int i,j; for(i=1;i<=n;i++) for(j=1;j<=n;j++) graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]); } int min(int x,int y){ return x<y?x:y; } int main(){ int k,i,j,x,e,a,b; while(scanf("%d %d",&n,&k),n,k){ for(i=0;i<=n;i++) for(j=0;j<=n;j++) graph[i][j]=i==j?0:INF; for(i=0;i<k;i++){ if(scanf("%d",&x),x){ scanf("%d %d %d",&c,&d,&e); if(graph[c][d]>e){ graph[c][d]=graph[d][c]=e; warshall_floyd(); } }else{ scanf("%d %d",&a,&b); printf(graph[a][b]>=INF?"-1\n":"%d\n",graph[a][b]); } } } return 0; }
a.cc: In function 'void warshall_floyd()': a.cc:9:31: error: 'min' was not declared in this scope 9 | graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]); | ^~~
s101732611
p00449
C++
#include <iostream> #define zmin(a,b) a=(a<b&&a>0?a:b) using namespace std; int boat[1001][1001]; int main(){ int i,j,n,k,s,d,c,f; while(cin>>n>>k,n){ memset(boat,0,sizeof(boat)); while(k--){ cin>>f>>s>>d; if(f){ cin>>c; zmin(boat[s][d],c); zmin(boat[d][s],c); }else{ int D[1001]={0},v[1001]={0}; for(;!v[d];){ int mini=-1; for(i=1;i<=n;i++) zmin(D[i],D[s]+boat[s][i]); v[s]=1; for(i=1;i<=n;i++) if(!v[i]&&D[i]&&(mini<0||D[i]<D[mini])) mini=i; if(mini<0)break; s=mini; } cout<<(D[d]?D[d]:-1)<<endl; } } } }
a.cc: In function 'int main()': a.cc:8:17: error: 'memset' was not declared in this scope 8 | memset(boat,0,sizeof(boat)); | ^~~~~~ 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 | #define zmin(a,b) a=(a<b&&a>0?a:b)
s337118120
p00449
C++
3 8 1 3 1 10 0 2 3 1 2 3 20 1 1 2 5 0 3 2 1 1 3 7 1 2 1 9 0 2 3 5 16 1 1 2 343750 1 1 3 3343 1 1 4 347392 1 1 5 5497 1 2 3 123394 1 2 4 545492 1 2 5 458 1 3 4 343983 1 3 5 843468 1 4 5 15934 0 2 1 0 4 1 0 3 2 0 4 2 0 4 3 0 5 3 0 0
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3 8 | ^
s668100025
p00449
C++
#include <cstdlib> #include <iostream> #include <queue> #include <utility> #include <vector> using namespace std; struct edge { int to, cost; edge(int t, int c):to(t), cost(c){} }; typedef pair<int, int> P; vector<vector<edge> > es; int dijkstra(int s, int t) { priority_queue<P, vector<P>, greater<P> > que; vector<int> dist(es.size(), INT_MAX); que.push(P(0, s)); dist[s] = 0; while(!que.empty()) { P p = que.top(); que.pop(); int v = p.second; if(dist[v] < p.first) continue; if(v == t) return dist[t]; for(int i = 0; i < es[v].size(); ++i) { edge& e = es[v][i]; if(dist[e.to] > dist[v] + e.cost) { dist[e.to] = dist[v] + e.cost; que.push(P(dist[e.to], e.to)); } } } return -1; } int main() { cin.tie(0); ios::sync_with_stdio(false); for(int n, k; cin >> n >> k, n;) { es.clear(); es.resize(n); for(int i = 0; i < k; ++i) { int q; cin >> q; if(!q) { int from, to; cin >> from >> to; --from; --to; cout << dijkstra(from, to) << endl; } else { int u, v, cost; cin >> u >> v >> cost; --u; --v; es[u].push_back(edge(v, cost)); es[v].push_back(edge(u, cost)); } } } return EXIT_SUCCESS; }
a.cc: In function 'int dijkstra(int, int)': a.cc:18:37: error: 'INT_MAX' was not declared in this scope 18 | vector<int> dist(es.size(), INT_MAX); | ^~~~~~~ a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 4 | #include <utility> +++ |+#include <climits> 5 | #include <vector>
s676816879
p00449
C++
#include <cstdio> #include <iostream> #include <algorithm> #include <cstdlib> #include <vector> #include <queue> #include <map> #include <functional> #include <cstring> using namespace std; #define INF 1000000000 int main(){ int n,k; while(scanf("%d%d",&n,&k),(n|k)){ int a; int d[128][128]; for(int i = 0; i < 101; i++){ for(int j = 0; j < 101; j++){ d[i][j] = i == j?0:INF; } } scanf("%d",&a); if(a == 1){ int f,t,c; scanf("%d%d%d",&f,&t,&c); f--; t--; if(d[f][t] > cost){ d[f][t] = cost; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ d[i][j] = min(d[i][j],d[i][f] + d[f][t] + d[t][j]); d[i][j] = min(d[i][j],d[i][t] + d[t][f] + d[f][j]); d[j][i] = d[i][j]; } } } } else{ int f,t; scanf("%d%d",&f,&t); f--; t--; if(d[f][t] == INF)puts("-1"); else printf("%d\n",d[f][t]); } } return 0; }
a.cc: In function 'int main()': a.cc:28:38: error: 'cost' was not declared in this scope; did you mean 'const'? 28 | if(d[f][t] > cost){ | ^~~~ | const
s288138258
p00449
C++
//AOJ 0526 //菴ソ縺?婿繧ゅo縺九i縺ェ縺?¥縺帙↓include縺励∪縺上k莠コ髢薙?繧ッ繧コ #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #include<cmath> #include<stack> #include<queue> #include<vector> #include<list> #include<deque> using namespace std; #define INF 1 << 20 #define MAX_B 101 int a, b, i, j, k, money[MAX_B][MAX_B], time[MAX_B][MAX_B], n, m, c, d; bool judge; stack<int> left, right; int main(){ scanf("%d %d", &n, &m); if(n == 0 && m == 0) return 0; for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ money[i][j] = INF; } } for(i = 1; i <= n; i++){ money[i][i] = 0; } for(i = 0; i < m; i++){ scanf("%d", &a); if(a == 0){ scanf("%d %d", &b, &c); if(money[b][c] == INF) printf("-1\n"); else printf("%d\n", money[b][c]); continue; } scanf("%d %d %d", &b, &c, &d); if(money[b][c] > d){ money[b][c] = d; money[c][b] = d; for(j = 1; j <= n; j++){ for(k = 1; k <= n; k++{ money[j][b] = money[b][j] = min(money[j][b], money[j][c] + money[c][j]); money[j][c] = money[c][j] = min(money[j][c], money[j][b] + money[b][j]); } } } } return 0; }
a.cc: In function 'int main()': a.cc:46:31: error: expected ')' before '{' token 46 | for(k = 1; k <= n; k++{ | ~ ^ | )
s915658778
p00449
C++
//AOJ 0526 //菴ソ縺?婿繧ゅo縺九i縺ェ縺?¥縺帙↓include縺励∪縺上k莠コ髢薙?繧ッ繧コ #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #include<cmath> #include<stack> #include<queue> #include<vector> #include<list> #include<deque> using namespace std; #define INF 1 << 20 #define MAX_B 101 int a, b, i, j, k, money[MAX_B][MAX_B], time[MAX_B][MAX_B], n, m, c, d; bool judge; stack<int> left, right; int main(){ scanf("%d %d", &n, &m); if(n == 0 && m == 0) return 0; for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ money[i][j] = INF; } } for(i = 1; i <= n; i++){ money[i][i] = 0; } for(i = 0; i < m; i++){ scanf("%d", &a); if(a == 0){ scanf("%d %d", &b, &c); if(money[b][c] == INF) printf("-1\n"); else printf("%d\n", money[b][c]); continue; } scanf("%d %d %d", &b, &c, &d); if(money[b][c] > d){ money[b][c] = d; money[c][b] = d; for(j = 1; j <= n; j++){ for(k = 1; k <= n; k++{ money[j][b] = money[b][j] = min(money[j][b], money[j][c] + money[c][j]); money[j][c] = money[c][j] = min(money[j][c], money[j][b] + money[b][j]); } } } return 0; }
a.cc: In function 'int main()': a.cc:46:31: error: expected ')' before '{' token 46 | for(k = 1; k <= n; k++{ | ~ ^ | ) a.cc:53:2: error: expected '}' at end of input 53 | } | ^ a.cc:22:11: note: to match this '{' 22 | int main(){ | ^
s157405926
p00449
C++
//AOJ 0526 //菴ソ縺?婿繧ゅo縺九i縺ェ縺?¥縺帙↓include縺励∪縺上k莠コ髢薙?繧ッ繧コ #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #include<cmath> #include<stack> #include<queue> #include<vector> #include<list> #include<deque> using namespace std; #define INF 1 << 20 #define MAX_B 101 int a, b, i, j, k, money[MAX_B][MAX_B], time[MAX_B][MAX_B], n, m, c, d; bool judge; stack<int> left, right; int main(){ scanf("%d %d", &n, &m); if(n == 0 && m == 0) return 0; for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ money[i][j] = INF; } } for(i = 1; i <= n; i++){ money[i][i] = 0; } for(i = 0; i < m; i++){ scanf("%d", &a); if(a == 0){ scanf("%d %d", &b, &c); if(money[b][c] == INF) printf("-1\n"); else printf("%d\n", money[b][c]); continue; } scanf("%d %d %d", &b, &c, &d); if(money[b][c] > d){ money[b][c] = d; money[c][b] = d; for(j = 1; j <= n; j++){ for(k = 1; k <= n; k++){ money[j][b] = money[b][j] = min(money[j][b], money[j][c] + money[c][j]); money[j][c] = money[c][j] = min(money[j][c], money[j][b] + money[b][j]); } } } return 0; }
a.cc: In function 'int main()': a.cc:53:2: error: expected '}' at end of input 53 | } | ^ a.cc:22:11: note: to match this '{' 22 | int main(){ | ^
s819621522
p00449
C++
//AOJ 0526 //菴ソ縺?婿繧ゅo縺九i縺ェ縺?¥縺帙↓include縺励∪縺上k莠コ髢薙?繧ッ繧コ #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #include<cmath> #include<stack> #include<queue> #include<vector> #include<list> #include<deque> using namespace std; #define INF 1 << 30 #define MAX_B 101 int a, b, i, j, k, money[MAX_B][MAX_B], time[MAX_B][MAX_B], n, m, c, d; bool judge; stack<int> left, right; int main(){ scanf("%d %d", &n, &m); if(n == 0 && m == 0) return 0; for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ money[i][j] = INF; } } for(i = 1; i <= n; i++){ money[i][i] = 0; } for(i = 0; i < m; i++){ scanf("%d", &a); if(a == 0){ scanf("%d %d", &b, &c); if(money[b][c] == INF) printf("-1\n"); else printf("%d\n", money[b][c]); continue; } scanf("%d %d %d", &b, &c, &d); if(money[b][c] > d){ money[b][c] = d; money[c][b] = d; for(j = 1; j <= n; j++){ money[j][c] = money[c][j] = min(money[j][c], money[j][b] + money[b][c]); money[j][b] = money[b][j] = min(money[j][b], money[j][c] + money[c][b]); } return 0; }
a.cc: In function 'int main()': a.cc:50:2: error: expected '}' at end of input 50 | } | ^ a.cc:33:25: note: to match this '{' 33 | for(i = 0; i < m; i++){ | ^ a.cc:50:2: error: expected '}' at end of input 50 | } | ^ a.cc:22:11: note: to match this '{' 22 | int main(){ | ^
s669344036
p00449
C++
//AOJ 0526 //菴ソ縺?婿繧ゅo縺九i縺ェ縺?¥縺帙↓include縺励∪縺上k莠コ髢薙?繧ッ繧コ #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #include<cmath> #include<stack> #include<queue> #include<vector> #include<list> #include<deque> using namespace std; #define INF 1 << 20 #define MAX_B 101 int a, b, i, j, k, money[MAX_B][MAX_B], time[MAX_B][MAX_B], n, m, c, d; bool judge; stack<int> left, right; int main(){ while(1){ scanf("%d %d", &n, &m); if(n == 0 && m == 0) return 0; for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ money[i][j] = INF; } } for(i = 1; i <= n; i++){ money[i][i] = 0; } for(i = 0; i < m; i++){ scanf("%d", &a); if(a == 0){ scanf("%d %d", &b, &c); if(money[b][c] == INF) printf("-1\n"); else printf("%d\n", money[b][c]); } } else{ scanf("%d %d %d", &b, &c, &d); if(money[b][c] > d){ money[b][c] = d; money[c][b] = d; } for(j = 1; j <= n; j++){ money[j][c] = money[c][j] = min(money[j][c], money[j][b] + money[b][c]); money[j][b] = money[b][j] = min(money[j][b], money[j][c] + money[c][b]); } } } return 0; }
a.cc: In function 'int main()': a.cc:42:5: error: 'else' without a previous 'if' 42 | else{ | ^~~~
s423534220
p00449
C++
#include "stdio.h" #include <iostream> #include <vector> #include <algorithm> #include <functional> int main() { while(1) { vector<pair<int,int> > ten[100]; int n,k; scanf("%d %d",&n,&k); if(n == 0 && k == 0) { break; } for(int i = 0; i < k; i++) { int w; scanf("%d",&w); if(w == 0) { int a,b; scanf("%d %d",&a,&b); a--; b--; int e[100]; for(int i = 0; i < n; i++) { e[i] = (2e9); } priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q; q.push(make_pair(0,a)); while(q.size() > 0) { if(e[q.top().second] > q.top().first) { e[q.top().second] = q.top().first; if(q.top().second == b) { break; } for(int ii = 0; ii < ten[q.top().second].size(); ii++) { q.push(make_pair(q.top().first + ten[q.top().second][ii].second,ten[q.top().second][ii].first)); } } q.pop(); } if(e[b] == (2e9)) { printf("-1\n"); } else { printf("%d\n",e[b]); } } else { int a,b,c; scanf("%d %d %d",&a,&b,&c); a--; b--; ten[a].push_back(make_pair(b,c)); ten[b].push_back(make_pair(a,c)); } } } }
a.cc: In function 'int main()': a.cc:11:9: error: 'vector' was not declared in this scope 11 | vector<pair<int,int> > ten[100]; | ^~~~~~ a.cc:11:9: note: suggested alternatives: In file included from /usr/include/c++/14/vector:66, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector' 428 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ /usr/include/c++/14/vector:93:13: note: 'std::pmr::vector' 93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>; | ^~~~~~ a.cc:11:16: error: 'pair' was not declared in this scope; did you mean 'std::pair'? 11 | vector<pair<int,int> > ten[100]; | ^~~~ | std::pair In file included from /usr/include/c++/14/string:48, 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:2: /usr/include/c++/14/bits/stl_iterator.h:3013:12: note: 'std::pair' declared here 3013 | struct pair; | ^~~~ a.cc:11:21: error: expected primary-expression before 'int' 11 | vector<pair<int,int> > ten[100]; | ^~~ a.cc:33:17: error: 'priority_queue' was not declared in this scope 33 | priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q; | ^~~~~~~~~~~~~~ a.cc:33:37: error: expected primary-expression before 'int' 33 | priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q; | ^~~ a.cc:34:17: error: 'q' was not declared in this scope 34 | q.push(make_pair(0,a)); | ^ a.cc:34:24: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'? 34 | q.push(make_pair(0,a)); | ^~~~~~~~~ | std::make_pair In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here 1132 | make_pair(_T1&& __x, _T2&& __y) | ^~~~~~~~~ a.cc:44:46: error: 'ten' was not declared in this scope 44 | for(int ii = 0; ii < ten[q.top().second].size(); ii++) | ^~~ a.cc:66:17: error: 'ten' was not declared in this scope 66 | ten[a].push_back(make_pair(b,c)); | ^~~ a.cc:66:34: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'? 66 | ten[a].push_back(make_pair(b,c)); | ^~~~~~~~~ | std::make_pair /usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here 1132 | make_pair(_T1&& __x, _T2&& __y) | ^~~~~~~~~
s320377985
p00449
C++
#include "stdio.h" #include <iostream> #include <vector> #include <algorithm> #include <functional> using namespace std; int main() { while(1) { vector<pair<int,int> > ten[100]; int n,k; scanf("%d %d",&n,&k); if(n == 0 && k == 0) { break; } for(int i = 0; i < k; i++) { int w; scanf("%d",&w); if(w == 0) { int a,b; scanf("%d %d",&a,&b); a--; b--; int e[100]; for(int i = 0; i < n; i++) { e[i] = (2e9); } priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q; q.push(make_pair(0,a)); while(q.size() > 0) { if(e[q.top().second] > q.top().first) { e[q.top().second] = q.top().first; if(q.top().second == b) { break; } for(int ii = 0; ii < ten[q.top().second].size(); ii++) { q.push(make_pair(q.top().first + ten[q.top().second][ii].second,ten[q.top().second][ii].first)); } } q.pop(); } if(e[b] == (2e9)) { printf("-1\n"); } else { printf("%d\n",e[b]); } } else { int a,b,c; scanf("%d %d %d",&a,&b,&c); a--; b--; ten[a].push_back(make_pair(b,c)); ten[b].push_back(make_pair(a,c)); } } } }
a.cc: In function 'int main()': a.cc:35:17: error: 'priority_queue' was not declared in this scope 35 | priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q; | ^~~~~~~~~~~~~~ a.cc:6:1: note: 'std::priority_queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>' 5 | #include <functional> +++ |+#include <queue> 6 | a.cc:35:45: error: expected primary-expression before ',' token 35 | priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q; | ^ a.cc:35:68: error: expected primary-expression before ',' token 35 | priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q; | ^ a.cc:35:93: error: expected primary-expression before '>' token 35 | priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q; | ^ a.cc:35:95: error: 'q' was not declared in this scope 35 | priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q; | ^
s743701306
p00449
C++
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <vector> #include <string> #include <map> #include <queue> #include <stack> #include <algorithm> #define rep(i,j) REP((i), 0, (j)) #define REP(i,j,k) for(int i=(j);(i)<(k);++i) #define between(a,x,b) ((a)<=(x)&&(x)<=(b)) #define INF 1 << 29 using namespace std; int main(){ int n, k; while(scanf("%d%d", &n, &k) && n+k){ int cost[100][100]; rep(i, n) rep(j, n) cost[i][j] = INF; // rep(i, n) cost[i][i] = 0; rep(i, k){ int z; scanf("%d", &z); if(z){ int c, d, e; scanf("%d%d%d", &c, &d, &e); c--;d--; cost[c][d] = cost[d][c] = e; rep(k, n) rep(i, n) if(k != i) rep(j, n) if(i != j && cost[i][j] > cost[i][k] + cost[k][j]) cost[i][j] = cost[i][k] + cost[k][j]; /* rep(i, n){ rep(j, n) printf("%05d ", cost[i][j]); puts(""); }*/ }else{ int a, b; scanf("%d%d", &a, &b); a--;b--; printf("%d\n", cost[a][b] < INF ? cost[a][b]:-1); } } } re
a.cc: In function 'int main()': a.cc:50:3: error: 're' was not declared in this scope; did you mean 'rep'? 50 | re | ^~ | rep a.cc:50:5: error: expected '}' at end of input 50 | re | ^ a.cc:19:11: note: to match this '{' 19 | int main(){ | ^
s600869509
p00450
C
#include<cstdio> int s[100000], x[100000], n, S; int main() { while (true) { scanf("%d",&n); if (!n) { break; } S = 0; for (int i = 0; i < n; i++) { scanf("%d",&s[i]); } for (int i = 0; i < n; i++) { x[i] = s[i]; if (i % 2 == 1) { for (int j = i - 1; j >= 0; j--) { if (x[j] == s[i]) { break; } else { x[j] = 1 - x[j]; } } } } for (int i = 0; i < n; i++) { if (x[i] == 0) { S++; } } printf("%d\n",S); } return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s382728122
p00450
C
int s[100000], x[100000], n, S; int main() { while (true) { scanf("%d",&n); if (!n) { break; } S = 0; for (int i = 0; i < n; i++) { scanf("%d",&s[i]); } for (int i = 0; i < n; i++) { x[i] = s[i]; if (i % 2 == 1) { for (int j = i - 1; j >= 0; j--) { if (x[j] == s[i]) { break; } else { x[j] = 1 - x[j]; } } } } for (int i = 0; i < n; i++) { if (x[i] == 0) { S++; } } printf("%d\n",S); } return 0; }
main.c: In function 'main': main.c:3:16: error: 'true' undeclared (first use in this function) 3 | while (true) { | ^~~~ main.c:1:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' +++ |+#include <stdbool.h> 1 | int s[100000], x[100000], n, S; main.c:3:16: note: each undeclared identifier is reported only once for each function it appears in 3 | while (true) { | ^~~~ main.c:4:17: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 4 | scanf("%d",&n); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int s[100000], x[100000], n, S; main.c:4:17: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 4 | scanf("%d",&n); | ^~~~~ main.c:4:17: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:24:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 24 | printf("%d\n",S); | ^~~~~~ main.c:24:17: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:24:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:24:17: note: include '<stdio.h>' or provide a declaration of 'printf'
s362188218
p00450
C++
#include<stdio.h> #include<iostream> using namespace std; int main(){ int n[100001]={},N,x,cou=0; while(1){ scanf("%d",&N); if(N==0)break; for(int i=0;i<N;i++) { cin>>x; if(i==0)n[i]=x; else if(i%2==1)n[i]=x; else if(i%2==0){ n[i]=x; for(int j=i;j>=0;j--) if(n[j]!=n[j-1])n[j-1]=n[j]; else if(n[j]==n[j-1])break; } for(int i=0;i<N;i++) if(n[i]==0)cou++; cout<<cou<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s232519577
p00450
C++
#include<cstdio> int x[100000], n, S; int main() { while (true) { scanf("%d",&n); if (!n) { break; } S = 0; for (int i = 0; i < n; i++) { scanf("%d",&x[i]) if (i % 2 == 1) { for (int j = i - 1; j >= 0; j--) { if (x[j] == x[i]) { break; } else { x[j] = 1 - x[j]; } } } } for (int i = 0; i < n; i++) { if (x[i] == 0) { S++; } } printf("%d\n",S); } return 0; }
a.cc: In function 'int main()': a.cc:9:42: error: expected ';' before 'if' 9 | scanf("%d",&x[i]) | ^ | ; 10 | if (i % 2 == 1) { | ~~
s016365227
p00450
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 ZERO(a) memset(a,0,sizeof(a)) #define len(a) sizeof(a) #define ll long long #define pii pair<int,int> #define INF 1<<29 #define MAX 101010 using namespace std; int a[MAX],g[MAX]; void solve(){ int n; for(;;){ cin>>n; if(!n) break; FOR(i,n) cin>>a[i]; FOR(i,n){ if(i&1){ g[i]=a[i]; continue; } int t; for(t=i-1;t>=0&&g[t]!=a[i];t--); FOR(j,t+1,i) g[j]^=1; } int tot=0; FOR(i,n) tot+=g[i]; cout<<n-tot<<endl; } } int main(){ solve(); return 0; }
a.cc:29:15: error: macro "FOR" passed 3 arguments, but takes just 2 29 | FOR(j,t+1,i) g[j]^=1; | ^ 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:29:4: error: 'FOR' was not declared in this scope 29 | FOR(j,t+1,i) g[j]^=1; | ^~~
s252323645
p00450
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 ZERO(a) memset(a,0,sizeof(a)) #define len(a) sizeof(a) #define ll long long #define pii pair<int,int> #define INF 1<<29 #define MAX 101010 using namespace std; int a[MAX],g[MAX]; void solve(){ int n; for(;;){ cin>>n; if(!n) break; FOR(i,n) cin>>a[i]; FOR(i,n){ g[i]=a[i] if(i&1) continue; int t; for(t=i-1;t>=0&&g[t]!=a[i];t--); FORR(j,t+1,i) g[j]^=1; } int tot=0; FOR(i,n) tot+=g[i]; cout<<n-tot<<endl; } } int main(){ solve(); return 0; }
a.cc: In function 'void solve()': a.cc:23:13: error: expected ';' before 'if' 23 | g[i]=a[i] | ^ | ; 24 | if(i&1) continue; | ~~
s916148280
p00450
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 ZERO(a) memset(a,0,sizeof(a)) #define len(a) sizeof(a) #define ll long long #define pii pair<int,int> #define INF 1<<29 #define MAX 101010 using namespace std; int a[MAX],p[MAX/2]; void solve(){ int n; for(;;){ cin>>n; if(!n) break; FOR(i,n) cin>>a[i]; for(int i=0;2*i+1<n;i++){ if(a[2*i]==a[2*i+1]){ p[i]=a[2*i]; continue; } p[i]=a[2*i+1]; int t=i-1; while(t>=0&&p[t]!=p[i]) p[t--]=p[i]; } for(int i=0;2*i+1<n;i++){ ans+=(p[i]^1)<<1; } if(n&1&&a[n-1]==0) ans++; cout<<ans<<endl; } } int main(){ solve(); return 0; }
a.cc: In function 'void solve()': a.cc:32:4: error: 'ans' was not declared in this scope; did you mean 'abs'? 32 | ans+=(p[i]^1)<<1; | ^~~ | abs a.cc:34:22: error: 'ans' was not declared in this scope; did you mean 'abs'? 34 | if(n&1&&a[n-1]==0) ans++; | ^~~ | abs a.cc:35:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 35 | cout<<ans<<endl; | ^~~ | abs
s140095653
p00450
C++
#include <bits/stdc++.h> #define rep(i,a,n) for(int i=a;i<n;i++) using namespace std; int main(){ int n; while (1){ cin >> n; if (n == 0) break; vector<int> d(n), f(n, 0); rep(i, 0, n) cin >> d[i]; f[0] = d[0]; rep(i, 1, n){ if (i % 2 == 0||d[i]==f[i-1]){ f[i] = d[i]; } else{ int ind; for (ind = i - 1; ind >= 0; ind--){ if (f[ind]==d[i]) ind++; break; } } if (ind < 0) ind = 0; rep(j, ind, i + 1){ f[j] = d[i]; } } } int ans = 0; rep(i, 0, n){ if (f[i] == 0) ans++; } cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:25:29: error: 'ind' was not declared in this scope; did you mean 'int'? 25 | if (ind < 0) ind = 0; | ^~~ | int a.cc:26:40: error: 'ind' was not declared in this scope; did you mean 'int'? 26 | rep(j, ind, i + 1){ | ^~~ a.cc:2:30: note: in definition of macro 'rep' 2 | #define rep(i,a,n) for(int i=a;i<n;i++) | ^ a.cc:33:29: error: 'f' was not declared in this scope 33 | if (f[i] == 0) ans++; | ^ a.cc: At global scope: a.cc:37:1: error: expected declaration before '}' token 37 | } | ^
s431101471
p00450
C++
#include<iostream> #include<algorithm> #define F 114514 using namespace std;int s[F],e[F],q;bool c[F];void a(bool t,bool r){if(t){if(c[q-1]!=r){if(q==1)e[0]++,c[0]=r;else{e[q-2]=e[q-1]+1;q--;}}else e[q-1]++;return;}if(c[q-1]!=r)s[q]=e[q-1],e[q]=s[q]+1,c[q]=r,q++;else e[q-1]++;return;}int main(){int n,t;while(true){cin>>n;if(!n)break;cin>>t;s[0]=0,e[0]=1,c[0]=t,q=1;for(int i=1;i<n;i++){cin>>t;a(i%2,t);}int s=0;for(int i=0;i<q;i++)if(!c[i])s+=e[i]-s[i];cout<<s<<endl;}return 0;}
a.cc: In function 'int main()': a.cc:4:396: error: invalid types 'int[int]' for array subscript 4 | using namespace std;int s[F],e[F],q;bool c[F];void a(bool t,bool r){if(t){if(c[q-1]!=r){if(q==1)e[0]++,c[0]=r;else{e[q-2]=e[q-1]+1;q--;}}else e[q-1]++;return;}if(c[q-1]!=r)s[q]=e[q-1],e[q]=s[q]+1,c[q]=r,q++;else e[q-1]++;return;}int main(){int n,t;while(true){cin>>n;if(!n)break;cin>>t;s[0]=0,e[0]=1,c[0]=t,q=1;for(int i=1;i<n;i++){cin>>t;a(i%2,t);}int s=0;for(int i=0;i<q;i++)if(!c[i])s+=e[i]-s[i];cout<<s<<endl;}return 0;} | ^
s121562644
p00450
C++
#include <vector> #include <algorithm> #include <set> #include <map> #include <queue> #include <stack> #include <iostream> #include <cstdio> #include <cmath> #include <cstring> using namespace std; typedef long long ll; typedef pair<ll,ll> P; typedef double db; ll n; vector<P> v;//first ???????????? second: 0or1 ll x; int main() {while(1) cin>>n; if(!n) return 0; v.clear(); for(ll i=1;i<=n;i++){ cin>>x; if(i==1||(i%2==1 && v[v.size()-1].second!=x)){//??°?????? v.push_back(P(i,x)); } else if(i%2==0&&v[v.size()-1].second!=x){//???????¶???? if(v.size()==1){ v[0].second=x; } else{ v.erase(v.end()-1); } } } ll ans=0; for(ll i=0;i<v.size();i++){ if(v[i].second==0) ans+=(i==v.size()-1?n+1:v[i+1].first)-v[i].first; } cout<<ans<<endl; }}
a.cc:42:2: error: expected declaration before '}' token 42 | }} | ^
s603805593
p00450
C++
8 1 0 1 1 0 0 0 0 8 1 0 1 1 0 0 0 1 0
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 8 | ^
s834203323
p00450
C++
#include <iostream> #include <list> using namespace std; #define W (0) #define B (1) int main(void) { while (1){ list<pair<int, int> > st; pair<int, int> add; int n; cin >> n; if (n == 0)break; cin >> add.first; add.second = 1; st.push_back(add); for (int i = 2; i <= n; i++){ int s; cin >> s; if (i % 2 == 1){ if (st.back().first == s){ st.back().second++; } else { add.first = s; add.second = 1; st.push_back(add); } } else { if (st.back().first == s){ st.back().second++; } else { if (st.size() == 1){ st.back().first = s; st.back().second++; } else { int c = st.back().second cout << c << endl; st.pop_back(); st.back().second += c + 1; } } } } list<pair<int, int> >::iterator it; int count = 0; for (it = st.begin(); it != st.end(); it++){ if (it->first == W){ count += it->second; } } cout << count << endl; } return (0); }
a.cc: In function 'int main()': a.cc:45:49: error: expected ',' or ';' before 'cout' 45 | cout << c << endl; | ^~~~
s981484465
p00450
C++
include <iostream> #include <algorithm> using namespace std; main() { while(1) { int n; cin >> n; if(n == 0) break; int cnt[2]; fill_n(cnt, 2, 0); int last[2][100000]; fill_n(last[0], 2*100000, 0); int p[2]; fill_n(p, 2, 0); for(int t = 1; t <= n; t++) { int a; cin >> a; cnt[a]++; if(t%2 == 0) { int tmp = t - last[a][p[a]] - 1; //cout << '!' << tmp << ':'; cnt[a] += tmp; cnt[1-a] -= tmp; p[1-a] -= tmp; } last[a][++p[a]] = t; //cout << cnt[0] << ", " << cnt[1] << endl; } cout << cnt[0] << endl; } }
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/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>
s314393295
p00450
C++
include <iostream> #include <algorithm> using namespace std; main() { while(1) { int n; cin >> n; if(n == 0) break; int cnt[2]; fill_n(cnt, 2, 0); int last[2][100000]; fill_n(last[0], 2*100000, 0); int p[2]; fill_n(p, 2, 0); for(int t = 1; t <= n; t++) { int a; cin >> a; cnt[a]++; if(t%2 == 0) { int tmp = t - last[a][p[a]] - 1; //cout << '!' << tmp << ':'; cnt[a] += tmp; cnt[1-a] -= tmp; p[1-a] -= tmp; } last[a][++p[a]] = t; //cout << cnt[0] << ", " << cnt[1] << endl; } cout << cnt[0] << endl; } }
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/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>
s026737407
p00450
C++
g#include <iostream> #include <vector> using namespace std; int main() { for (;;) { int n; cin >> n; if (!n) return 0; int r = 0; vector<int> sequences; sequences.push_back(1); cin >> r; for (int i = 2; i <= n; i++) { int c; cin >> c; if (r == c) ++sequences[sequences.size()-1]; else { r = c; if (i % 2) sequences.push_back(1); else { if (sequences.size() == 1) ++sequences[sequences.size()-1]; else { sequences[sequences.size()-2] += sequences[sequences.size()-1] + 1; sequences.pop_back(); } } } /* if (i % 2) if (r == c) ++sequences[sequences.size()-1]; else { sequences.push_back(1); r = c; } else if (r == c) ++sequences[sequences.size()-1]; else { sequences[sequences.size()-2] += sequences[sequences.size()-1] + 1; sequences.pop_back(); r = c; } */ } /* for (int i = 0; i < n; i++) { int c; cin >> c; if (r == c) ++sequences[sequences.size()-1]; else { r = c; if (i % 2) ++sequences[sequences.size()-1]; else sequences.push_back(1); } } */ int count = 0; for (int i = 0; i < sequences.size(); i++) if (r && i % 2 || !r && !(i % 2)) count += sequences[sequences.size()-i-1]; cout << count << endl; } }
a.cc:1:2: error: stray '#' in program 1 | g#include <iostream> | ^ a.cc:1:1: error: 'g' does not name a type 1 | g#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 |
s280155511
p00450
C++
#include<cstdio> #include<vector> using namespace std; int main(void){ int n; while(scanf("%d", &n) && n != 0){ int array[100005]={0}; int count = 1; int temp; for(int i = 1; i <= n; i++){ scanf("%d", &temp); //”’‚È‚ç‚O //•‚È‚ç‚P‚ª“ü—Í‚³‚ê‚éB //”’‚Ȃ琳‚̐” //•‚Ȃ畉‚̐”‚ð”z—ñ‚É‚¢‚ê‚éB if(i%2){ if(array[count-1] < 0 && temp == 1)array[count-1]--; else if(array[count-1] > 0 && temp == 0)array[count-1]++; else if(temp == 0){ array[count] ++; count++; } else { array[count] --; count++; } }else{ if(temp == 0){ if(array[count-1] > 0){ array[count-1]++; }else if(array[count-1] < 0){ array[count-2] += abs( array[count-1] )+1; array[count-1] = 0; count--; } }else{ if(array[count-1] < 0){ array[count-1]--; }else if(array[count-1] > 0){ array[count-2] -= abs(array[count-1])+1; array[count-1] = 0; count--; } } } /* printf("count -> %d\n",count); for(int i = 0; i <= count ; i++){ printf("%d%s",array[i],i>=0?" ":""); }puts(""); /* for(int i = 1; i < count; i++){ for(int j = 0; j < abs(array[i]); j++){ printf("%s", array[i]>0?"›":"œ"); } }puts(""); */ } int ans = 0; for(int i = 0; i <= count; i++){ if(array[i] > 0)ans+=array[i]; } printf("%d\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:37:67: error: 'abs' was not declared in this scope 37 | array[count-2] += abs( array[count-1] )+1; | ^~~ a.cc:45:67: error: 'abs' was not declared in this scope 45 | array[count-2] -= abs(array[count-1])+1; | ^~~
s398053582
p00450
C++
#include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <string> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <functional> #include <iostream> using namespace std; typedef pair<int,int> p; typedef pair<int,p> P; typedef pair<p,p> p2; #define pu push #define pb push_back #define mp make_pair int num[100005]; int par[100005]; int ran[100005]; void init(int n){ for(int i=0;i<n;i++){ par[i]=i; ran[i]=0; } } int find(int x){ if(par[x] == x){ return x; }else{ return par[x]=find(par[x]); } } void unite(int x,int y){ x=find(x); y=find(y); if(x == y) return ; if(ran[x]<=ran[y]){ par[x]=par[y]; }else{ par[y]=par[x]; if(ran[x] == ran[y]) ran[x]++; } } bool same(int x,int y){ return find(x)==find(y); } int main(){ while(1){ int n; scanf("%d",&n); if(!n) break; for(int i=0;i<n;i++){ scanf("%d",&num[i]); } init(n); int st=0; for(int i=0;i<n;i++){ if(num[st]==num[i]){ unite(st,i); }else{ st=i; } } int st=0; st=0; for(int i=0;i<n;i++){ if(!same(st,i)){ if(i%2==1){ unite(st,i); }else{ st=i; } } } st=0; int ans=0; for(int i=0;i<n;i++){ if(!same(st,i)){ int ro=num[par[st]]; if(!ro){ ans+=(i-st); } st=i; } } if(!(num[par[st]])){ ans+=(n-st); } printf("%d\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:66:13: error: redeclaration of 'int st' 66 | int st=0; | ^~ a.cc:58:13: note: 'int st' previously declared here 58 | int st=0; | ^~
s007852390
p00450
C++
#include <vector> #include <cstdio> using namespace std; typedef pair<int,int>pii; main(){ int n,x,i; for(;scanf("%d%d",&n,&x),n;printf("%d\n",x)){ vector<pii>v; v.push_back(make_pair(x,1)); for(i=1;i<n;i++){ pii p=v.back();v.pop_back(); scanf("%d",&x); if(i&1){ if(x==p.first) v.push_back(make_pair(x,p.second+1)); else{ pii q=v.back(),v.pop_back(); v.push_back(make_pair(x,q.second+p.second+1)); } }else{ if(x==p.first)v.push_back(make_pair(x,p.second+1)); else v.push_back(p),v.push_back(make_pair(x,1)); } } for(x=i=0;i<v.size();i++){ if(!v[i].first)x+=v[i].second; } } }
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:17:57: error: expected initializer before '.' token 17 | pii q=v.back(),v.pop_back(); | ^
s135279004
p00450
C++
#include <vector> #include <cstdio> typedef std::pair<int,int>pii; main(){ int n,x,i,q; pii p; for(;scanf("%d%d",&n,&x),n;printf("%d\n",x)){ std::vector<pii>v; v.push_back(make_pair(x,1)); for(i=1;i<n;i++) if(p=v.back(),scanf("%d",&x),x==p.first)v.back().second++; else if(i&1){ if(v.pop_back(),q=0,v.size())q=v.back().second,v.pop_back(); v.push_back(make_pair(x,q+p.second+1)); }else v.push_back(make_pair(x,1)); for(x=i=0;i<v.size();i++)if(!v[i].first)x+=v[i].second; } }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:9:29: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'? 9 | v.push_back(make_pair(x,1)); | ^~~~~~~~~ | std::make_pair In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/vector:62, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here 1132 | make_pair(_T1&& __x, _T2&& __y) | ^~~~~~~~~
s876326918
p00450
C++
#include <cstdio> #include <cstring> bool stone[100000]; int main() { int n; while(scanf("%d",&n),n) { memset(stone,0,sizeof(stone)); for(int i=0;i<n;i++) { scanf("%d",&stone[i]); if((i&1)&&(stone[i]^stone[i-1])) { for(int j=i-1;j>=0;j--) { if(stone[i]^stone[j]) stone[j^=1; else break; } } } int sum=0; for(int i=0;i<n;i++) sum+=!stone[i]; printf("%d\n",sum); } }
a.cc: In function 'int main()': a.cc:12:73: error: expected ']' before ';' token 12 | if(stone[i]^stone[j]) stone[j^=1; | ^ | ]
s176305849
p00450
C++
<iostream> #include<stack> using namespace std; int main() { int n; for(;cin>>n,n;) { stack<pair<int,int> >data; data.push(make_pair(0,0)); for(int i=0;i<n;i++) { int tmp; cin>>tmp; pair<int,int >tt; tt = data.top(); data.pop(); if(i%2!=0) { data.push(make_pair(tt.first+1,tmp)); } else { if(tt.second==tmp) data.push(make_pair(tt.first+1,tmp)); else { data.push(tt); data.push(make_pair(1,tmp)); } } } int ans=0; while(!data.empty()) { pair<int,int >tt; tt = data.top(); data.pop(); if(tt.second==0) ans+=tt.first; } cout<<ans<<endl; } }
a.cc:1:1: error: expected unqualified-id before '<' token 1 | <iostream> | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/deque:62, from /usr/include/c++/14/stack: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 __selec
s719931063
p00451
Java
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; import static java.util.Arrays.*; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); for(;sc.hasNext();){ String s=sc.next(); String t=sc.next(); System.out.println(lcs(s,t)); } } int lcs(String s, String t){ int m=s.length(), n=t.length(); int[][] d=new int[n+1][m+1]; int[][] v=new int[n+1][m+1]; for(int j=1; j<=n; j++){ for(int i=1; i<=m; i++){ if(s.charAt(i-1)==t.charAt(j-1)) d[j][i]=d[j-1][i-1]+1; d[j][i]=Math.max(d[j][i-1], d[j-1][i]); } } return d[n][m]; } }
Main.java:15: error: non-static method lcs(String,String) cannot be referenced from a static context System.out.println(lcs(s,t)); ^ 1 error
s591980755
p00451
Java
import java.util.Scanner; public class A0528 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String s1 = sc.next(); String s2 = sc.next(); int dp[][] = new int[s1.length()][s2.length()]; int max = 0; for (int i = 0; i < s1.length(); i++) { for (int j = 0; j < s2.length(); j++) { if (s1.charAt(i) != s2.charAt(j)) { dp[i][j] = 0; } else { if (i != 0 && j != 0) { dp[i][j] = dp[i - 1][j - 1] + 1; } else { dp[i][j] = 1; } } max = Math.max(max, dp[i][j]); } } System.out.println(max); } } }
Main.java:3: error: class A0528 is public, should be declared in a file named A0528.java public class A0528 { ^ 1 error
s668957221
p00451
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; public class Main2 { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while(true){ String ss = br.readLine(); if(ss.equals(""))break; String tt = br.readLine(); int[]s = new int[ss.length()]; int[]t = new int[tt.length()]; for(int i=0;i<s.length;i++){ s[i] = ss.charAt(i); } for(int i=0;i<t.length;i++){ t[i] = tt.charAt(i); } SuffixArray sa = new SuffixArray(s); int left=-1,right=t.length+1; while(left<right-1){ int len= (left+right)/2; boolean f = false; int[] sub = new int[len]; for(int i=0;i<t.length;i++){ if(i+len>t.length)break; for(int k=i;k<i+len;k++){ sub[k-i]=t[k]; } if(sa.contain(sub)){ f=true; break; } } if(f){ left=len; } else{ right=len; } } System.out.println(left); } } static class SuffixArray { int n,k=1; Integer[] sa,rank,tmp; int[] s; SuffixArray(int[] _s) { s=_s; n = s.length; rank=new Integer[n+1]; sa=new Integer[n+1]; tmp=new Integer[n+1]; for(int i=0;i<n;i++){ sa[i]=i; rank[i]=s[i]; } sa[n]=n; rank[n]=-1; for(k=1;k<=n;k<<=1){ Arrays.sort(sa,new Comparator<Integer>(){ @Override public int compare(Integer o1, Integer o2) { int r1=rank[o1]; int r2=rank[o2]; if(r1!=r2)return r1-r2; int r11=o1+k <= n ? rank[o1+k] : -1; int r22=o2+k <= n ? rank[o2+k] : -1; return r11-r22; } }); tmp[sa[0]]=0; for(int i=1;i<=n;i++){ tmp[sa[i]]=tmp[sa[i-1]]+ (compare(sa[i-1],sa[i])!=0?1:0); } for(int i=0;i<=n;i++){ rank[i]=tmp[i]; } } } /* * s.contains(t)的な */ boolean contain(int[] t){ return contain(s,sa,t); } private boolean contain(int[]s,Integer[] sa,int[] t){ int a=0,b=s.length; while(b-a>1){ int c = (a+b)/2; // String sub = s.substring(sa[c], Math.min(sa[c]+t.length, s.length)); if(compare(s,sa[c],Math.min(sa[c]+t.length, s.length),t)<0){ a=c; } else{ b=c; } } return compare(s,sa[b], Math.min(sa[b]+t.length, s.length),t)==0; } /* * s.substring(i1,i2).compareTo(t) 的な */ private int compare(int[]s,int i1,int i2,int[] t){ for(int i=i1;i<i2;i++){ if(i-i1>=t.length){ return 1; } if(s[i]!=t[i-i1]){ return s[i]-t[i-i1]; } } return (i2-i1)-t.length; } private int compare(Integer o1, Integer o2) { int r1=rank[o1]; int r2=rank[o2]; if(r1!=r2)return (r1-r2); int r11=o1+k <= n ? rank[o1+k] : -1; int r22=o2+k <= n ? rank[o2+k] : -1; return (r11-r22); } } }
Main.java:8: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s779284565
p00451
C
#include <stdio.h> b=5e3,m,i,j,c; char s[10000],t[10000]; main() { gets(s+b); gets(t+b); m=0; for(i=-b;i<b;i++) { c=0; for(j=b;s[j];j++) { if(s[j]!=t[i+j]) c=0; else if(m<++c)m=c; } } printf("%d\n",m); return 0; }
main.c:2:1: warning: data definition has no type or storage class 2 | b=5e3,m,i,j,c; | ^ main.c:2:1: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int] main.c:2:7: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 2 | b=5e3,m,i,j,c; | ^ main.c:2:9: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] 2 | b=5e3,m,i,j,c; | ^ main.c:2:11: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 2 | b=5e3,m,i,j,c; | ^ main.c:2:13: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] 2 | b=5e3,m,i,j,c; | ^ main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int] 4 | main() { | ^~~~ main.c: In function 'main': main.c:5:5: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 5 | gets(s+b); | ^~~~ | fgets
s412444284
p00451
C
main(){ short_coding_muzui_owata(); }
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int] 1 | main(){ | ^~~~ main.c: In function 'main': main.c:2:1: error: implicit declaration of function 'short_coding_muzui_owata' [-Wimplicit-function-declaration] 2 | short_coding_muzui_owata(); | ^~~~~~~~~~~~~~~~~~~~~~~~
s971546983
p00451
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { static int dp[4001][4001]; char str1[4001], str2[4001]; int len1, len2; int i, j, ans; while (scanf("%s", str1) != EOF){ getchar(); scanf("%s", str2); getchar(); len1 = strlen(str1); len2 = strlen(str2); memset(dp, 0, sizeof(dp)); ans = 0; for (i = 0; i < len1; i++){ for (j = 0; j < len2; j++){ if (str1[i] == str2[j]){ dp[i + 1][j + 1] = dp[i][j] + 1; } else { dp[i + 1][j + 1] = min(dp[i + 1][j], dp[i][j + 1]); } ans = max(dp[i][j], ans); } } printf("%d\n", ans); } return (0); }
main.c: In function 'main': main.c:28:40: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration] 28 | dp[i + 1][j + 1] = min(dp[i + 1][j], dp[i][j + 1]); | ^~~ | main main.c:30:23: error: implicit declaration of function 'max' [-Wimplicit-function-declaration] 30 | ans = max(dp[i][j], ans); | ^~~
s117208461
p00451
C
a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}}
main.c:1:1: warning: data definition has no type or storage class 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:1:13: error: variably modified 's' at file scope 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^ main.c:1:18: error: variably modified 't' at file scope 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^ main.c:1:23: warning: data definition has no type or storage class 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^ main.c:1:23: error: type defaults to 'int' in declaration of 'u' [-Wimplicit-int] main.c:1:23: error: variably modified 'u' at file scope main.c:1:28: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^ main.c:1:30: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^ main.c:1:32: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^ main.c:1:34: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^ main.c:1:36: error: return type defaults to 'int' [-Wimplicit-int] 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^~~~ main.c: In function 'main': main.c:1:36: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:50: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} main.c:1:50: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^~~~~ main.c:1:50: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:75: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^~~~~~ main.c:1:75: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:75: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:75: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:99: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen' +++ |+#include <string.h> 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} main.c:1:99: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 1 | a=4005;char s[a],t[a];u[a],m,i,j,c;main(n){for(;~scanf("%s%s",s,t+1);i=m=!printf("%d\n",m)){for(n=strlen(s);!i|t[i];i++)for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-t[i]?0:u[j]+1;}} | ^~~~~~ main.c:1:99: note: include '<string.h>' or provide a declaration of 'strlen'
s091919350
p00451
C
char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;}
main.c:1:14: warning: data definition has no type or storage class 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^ main.c:1:14: error: type defaults to 'int' in declaration of 'u' [-Wimplicit-int] main.c:1:22: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^ main.c:1:24: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^ main.c:1:26: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^ main.c:1:28: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^ main.c:1:30: error: return type defaults to 'int' [-Wimplicit-int] 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^~~~ main.c: In function 'main': main.c:1:30: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:46: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} main.c:1:46: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^~~~~ main.c:1:46: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:60: error: 't' undeclared (first use in this function) 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^ main.c:1:60: note: each undeclared identifier is reported only once for each function it appears in main.c:1:66: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^~~~~~ main.c:1:66: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:66: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:66: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:89: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'strlen' +++ |+#include <string.h> 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} main.c:1:89: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^~~~~~ main.c:1:89: note: include '<string.h>' or provide a declaration of 'strlen' main.c:1:106: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration] 1 | char s[4005];u[4005],m,j,c,d;main(n){for(;d=~scanf("%s ",s,t);m=!printf("%d\n",m))for(n=strlen(s);d-10;d=getchar())for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^~~~~~~ main.c:1:106: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
s018020910
p00451
C
#include <iostream> #include <string> #include <algorithm> using namespace std; string a,b; int n,m; int solve(int x, int y){ int ret=0,cnt=0; while(x < n && y < m){ if(a[x] == b[y]){ cnt++; }else{ ret = max(ret,cnt); cnt = 0; } x++; y++; } return max(ret,cnt); } int main(){ while(cin >> a >> b){ int x=0,y=0,t=1,tmp=0,ret=0; n=a.size(); m=b.size(); for(int i=0;i<n;i++){ ret = max(ret,solve(i,0)); } for(int i=0;i<m;i++){ ret = max(ret,solve(0,i)); } cout << ret << endl; } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s560879297
p00451
C
#include<stdio.h> #include<string.h> int max(int,int); int main(void){ char str1[4001],str2[4001]; int i,j,dp[4001][4001],count; while(~scanf("%[^\n]%*c",str1)){ scanf("%[^\n]%*c",str2); for(i=0;i<=strlen(str1);i++) for(j=0;j<=strlen(str2);j++) dp[i][j]=0; count=0; for(i=0;i<strlen(str1);i++){ for(j=0;j<strlen(str2);j++){ if(str1[i]==str2[j]){ dp[i+1][j+1]=dp[i][j]+1; count=max(count,dp[i+1][j+1]); } else dp[i+1][j+1]=0; } } printf("%d\n",count); } return 0; }
/usr/bin/ld: /tmp/cccIMsQy.o: in function `main': main.c:(.text+0x146): undefined reference to `max' collect2: error: ld returned 1 exit status
s011624866
p00451
C
#include<stdio.h> #include<stdlib.h> #define max(x, y) ((x) > (y) ? (x) : (y)) int main(){ int dp[4001][4001]; int i, j, k; while(scanf("%s %s", str1, str2) != EOF){ int res = 0; for(i = 0;i < strlen(str1);i++){ for(j = 0;j < strlen(str2);j++){ int x = 0; for(k = 0;i + k < strlen(str1) && j + k < strlen(str2);k++){ if(str1[i + k] == str2[j + k])x++; else x = 0; res = max(res, x); } } } printf("%d\n", res); } return 0; }
main.c: In function 'main': main.c:7:24: error: 'str1' undeclared (first use in this function) 7 | while(scanf("%s %s", str1, str2) != EOF){ | ^~~~ main.c:7:24: note: each undeclared identifier is reported only once for each function it appears in main.c:7:30: error: 'str2' undeclared (first use in this function) 7 | while(scanf("%s %s", str1, str2) != EOF){ | ^~~~ main.c:9:19: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 9 | for(i = 0;i < strlen(str1);i++){ | ^~~~~~ main.c:3:1: note: include '<string.h>' or provide a declaration of 'strlen' 2 | #include<stdlib.h> +++ |+#include <string.h> 3 | #define max(x, y) ((x) > (y) ? (x) : (y)) main.c:9:19: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 9 | for(i = 0;i < strlen(str1);i++){ | ^~~~~~ main.c:9:19: note: include '<string.h>' or provide a declaration of 'strlen'
s720918792
p00451
C
#include<stdio.h>#include <string.h>short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
main.c:1:18: warning: extra tokens at end of #include directive 1 | #include<stdio.h>#include <string.h>short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} | ^ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s591343330
p00451
C
#include<stdio.h> #include <string.h>short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=EOF){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
main.c:1:19: warning: extra tokens at end of #include directive 1 | #include<stdio.h> #include <string.h>short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=EOF){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} | ^ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s511744232
p00451
C
#include<stdio.h>#include <string.h> short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
main.c:1:18: warning: extra tokens at end of #include directive 1 | #include<stdio.h>#include <string.h> | ^ main.c: In function 'main': main.c:2:118: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} | ^~~~~~ main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen' 1 | #include<stdio.h>#include <string.h> +++ |+#include <string.h> 2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} main.c:2:118: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} | ^~~~~~ main.c:2:118: note: include '<string.h>' or provide a declaration of 'strlen' main.c:2:352: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration] 2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} | ^~~~~~ main.c:2:352: note: include '<string.h>' or provide a declaration of 'memset' main.c:2:352: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch] main.c:2:352: note: include '<string.h>' or provide a declaration of 'memset'
s426027808
p00451
C
#include<stdio.h>#include <string.h> short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
main.c:1:18: warning: extra tokens at end of #include directive 1 | #include<stdio.h>#include <string.h> | ^ main.c: In function 'main': main.c:2:118: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} | ^~~~~~ main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen' 1 | #include<stdio.h>#include <string.h> +++ |+#include <string.h> 2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} main.c:2:118: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} | ^~~~~~ main.c:2:118: note: include '<string.h>' or provide a declaration of 'strlen' main.c:2:352: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration] 2 | short dp[4001][4001]={},ans=0;char str1[2][4005];int main(){while(scanf("%s",str1[0])!=-1){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} | ^~~~~~ main.c:2:352: note: include '<string.h>' or provide a declaration of 'memset' main.c:2:352: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch] main.c:2:352: note: include '<string.h>' or provide a declaration of 'memset'
s538452308
p00451
C
#include<stdio.h>#include <string.h> short dp[4001][4001]={},ans=0; char str1[2][4005]; int main(){while(scanf("%s",str1[0])!=EOF){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){ if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;}
main.c:1:18: warning: extra tokens at end of #include directive 1 | #include<stdio.h>#include <string.h> | ^ main.c: In function 'main': main.c:4:70: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 4 | int main(){while(scanf("%s",str1[0])!=EOF){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){ | ^~~~~~ main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen' 1 | #include<stdio.h>#include <string.h> +++ |+#include <string.h> 2 | short dp[4001][4001]={},ans=0; main.c:4:70: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 4 | int main(){while(scanf("%s",str1[0])!=EOF){scanf("%s",str1[1]);int a=strlen(str1[0]),b=strlen(str1[1]); for(int i=0;i<a;i++){for(int j=0;j<b;j++){if(str1[0][i]==str1[1][j]){ | ^~~~~~ main.c:4:70: note: include '<string.h>' or provide a declaration of 'strlen' main.c:5:131: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration] 5 | if(!i || !j){dp[i][j]=1;if(!ans){ans++;}}else{dp[i][j]=1+dp[i-1][j-1];ans=ans<dp[i][j]?dp[i][j]:ans;}}}}printf("%d\n",ans); ans=0;memset(dp,0,sizeof(dp));}return 0;} | ^~~~~~ main.c:5:131: note: include '<string.h>' or provide a declaration of 'memset' main.c:5:131: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch] main.c:5:131: note: include '<string.h>' or provide a declaration of 'memset'
s792710792
p00451
C++
#include<iostream> #include<cstdio> #include<string> using namespace std; int main() { char a[4000],b[4000]; while(scanf("%s",a)!=EOF){ scanf("%s",b); int t[4002][4002]; for(int i=0;i<=strlen(a);i++){ t[0][i]=0; } for(int j=0;j<=strlen(b);j++){ t[j][0]=0; } for(int i=1;i<=strlen(a);i++){ for(int j=1;j<=strlen(b);j++){ if(a[i-1]==b[j-1])t[i][j]=t[i-1][j-1]+1; else t[i][j]=0; } } int ans=0; for(int i=1;i<=strlen(a);i++){ for(int j=1;j<=strlen(b);j++){ ans=max(ans,t[i][j]); } } cout << ans << "\n"; } return 0; }
a.cc: In function 'int main()': a.cc:11:24: error: 'strlen' was not declared in this scope 11 | for(int i=0;i<=strlen(a);i++){ | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<cstdio> +++ |+#include <cstring> 3 | #include<string> a.cc:14:24: error: 'strlen' was not declared in this scope 14 | for(int j=0;j<=strlen(b);j++){ | ^~~~~~ a.cc:14:24: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:17:24: error: 'strlen' was not declared in this scope 17 | for(int i=1;i<=strlen(a);i++){ | ^~~~~~ a.cc:17:24: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:25:24: error: 'strlen' was not declared in this scope 25 | for(int i=1;i<=strlen(a);i++){ | ^~~~~~ a.cc:25:24: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s796775037
p00451
C++
#include<iostream> #include<cstdio> using namespace std; int dp[4001][4001]; int main(){ char str1[4001],str2[4001]; while(cin>>str1>>str2){ int ans=0; memset(dp,0,sizeof(dp)); for(int i=0;str1[i]!='\0';i++){ for(int j=0;str2[j]!='\0';j++){ if(str1[i]==str2[j]){ dp[i+1][j+1]=dp[i][j]+1; } if(ans<dp[i+1][j+1]){ ans=dp[i+1][j+1]; } } } printf("%d\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:11:17: error: 'memset' was not declared in this scope 11 | memset(dp,0,sizeof(dp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<cstdio> +++ |+#include <cstring> 3 | using namespace std;
s075500794
p00451
C++
#include <iostream> #include <iomanip> #include <vector> #include <set> #include <map> #include <list> #include <iterator> #include <queue> #include <stack> #include <deque> #include <sstream> #include <algorithm> #include <numeric> #include <string> #include <cmath> #include <complex> #include <functional> #include <cstdio> #include <cstring> #include <cstdlib> #include <cassert> #include <cstdlib> #include <cctype> #define REP(i,m,n) for(int i=m;i<n;i++) #define rep(i,n) for(int i=0;i<n;i++) #define rp(i,c) rep(i,(int)c.size()) #define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++) #define mp make_pair #define pb push_back #define all(c) (c).begin(),(c).end() #define rall(u) (u).rbegin(),(u).rend() #define dbg(x) cerr<<#x<<" = "<<(x)<<endl #define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end()) #define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end()) #define VV(T) vector<vector< T > > #define init(a,b) memset((a), (b), sizeof((a))) using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> pi; const int inf=1<<28; const double EPS=1e-9; const long long INF = 100001000010000100ll; template<class T>int SIZE(T a){return a.size();} template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();} template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;} template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);} template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;} template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; } template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; } typedef pair<int,int> pii; string L, R; int dp[4000+10][4000+10]; int main(){ while(cin >> L >> R, L){ memset(dp, 0, sizeof(dp)); int ans=0; rp(i, R){ rp(j, L){ if(R[i]==L[j]){ dp[i][j] = dp[i-1][j-1] + 1; }else{ dp[i][j]=0; } ans=max(ans, dp[i][j]); } } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:64:28: error: could not convert '(((void)std::operator>><char, char_traits<char>, allocator<char> >((* & std::operator>><char, char_traits<char>, allocator<char> >(std::cin, L)), R)), L)' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' 64 | while(cin >> L >> R, L){ | ~~~~~~~~~~~~~^~~ | | | std::string {aka std::__cxx11::basic_string<char>}
s474677690
p00451
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int dp[4001][4001]; int main(){ string s, t; while(cin >> s >> t){ memset(dp, -1, sizeof(dp)); dp[0][0] = (s[0] == t[0]); for(int i = 1; i < s.size(); i++){ for(int j = 1; j < t.size(); j++){ if(s[i] == t[j]) dp[i][j] = dp[i - 1][j - 1] + 1; else dp[i][j] = 0; } } int maxi = 0; for(int i = 0; i < s.size(); i++){ maxi = max(maxi, *max_element(dp[i], dp[i] + t.size())); } cout << maxi << endl; } }
a.cc: In function 'int main()': a.cc:13:9: error: 'memset' was not declared in this scope 13 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | using namespace std;
s665369828
p00451
C++
#include<cstdio> #include<math.h> #include<algorithm> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) const int INF=1001001001; char A[4002],B[4002]; int DP[4002][4002]; int main(){ while(1){ scanf("%s",A); scanf("%s",B); memset(DP,0,sizeof(DP)); int ans=0; rep(i,strlen(A)){ rep(j,strlen(B)){ if(A[i]==B[j]){ if(i!=0&&j!=0){ DP[i][j]+=DP[i-1][j-1]; } DP[i][j]++; } ans=max(ans,DP[i][j]); } } printf("%d\n",ans); } }
a.cc: In function 'int main()': a.cc:17:17: error: 'memset' was not declared in this scope 17 | memset(DP,0,sizeof(DP)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<algorithm> +++ |+#include <cstring> 4 | a.cc:19:23: error: 'strlen' was not declared in this scope 19 | rep(i,strlen(A)){ | ^~~~~~ a.cc:7:32: note: in definition of macro 'rep' 7 | #define rep(i,n) for(int i=0;i<n;i++) | ^ a.cc:19:23: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 19 | rep(i,strlen(A)){ | ^~~~~~ a.cc:7:32: note: in definition of macro 'rep' 7 | #define rep(i,n) for(int i=0;i<n;i++) | ^
s134258808
p00451
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string s, t; int roop1, roop2 = 0, save[10000], ans = 0; while(1){ cin >> s >> t; if(s=='') break; for (int i = 0; i<s.size(); i++){ for (int j = 0; j<t.size(); j++){ if (s[i] == t[j]){ roop1 = 0; save[roop2] = 0; while (1){ if (s[i + roop1] == 0|| t[j + roop1] ==0){ break; } else{ if (s[i + roop1] == t[j + roop1]){ save[roop2] += 1; roop1++; } else if (s[i + roop1] != t[j + roop1]){ roop2++; break; } } } } } } sort(save, save + roop2 + 1); ans = save[roop2]; cout << ans << endl; } return 0; }
a.cc:9:15: error: empty character constant 9 | if(s=='') | ^~ a.cc: In function 'int main()': a.cc:9:13: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 9 | if(s=='') | ~^~~~ | | | | | char | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:9:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 9 | if(s=='') | ^~ In file included from /usr/include/c++/14/string:43, 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: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:9:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>' 9 | if(s=='') | ^~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:9:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 9 | if(s=='') | ^~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:9:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 9 | if(s=='') | ^~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:9:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 9 | if(s=='') | ^~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:9:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 9 | if(s=='') | ^~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:9:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 9 | if(s=='') | ^~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:9:15: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 9 | if(s=='') | ^~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:9:15: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 9 | if(s=='') | ^~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:9:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char' 9 | if(s=='') | ^~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:9:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char' 9 | if(s=='') | ^~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:9:15: note: mismatched types 'const _CharT*' and 'char' 9 | if(s=='') | ^~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:9:15: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 9 | if(s=='') | ^~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:9:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 9 | if(s=='') | ^~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:9:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 9 | if(s=='') | ^~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33, from /usr/include/c++/14/bits/allocator.h:46: /usr/include/c++/14/bits/new_allocator.h:215:9: note: candidate: 'template<class _Up> bool std::operator==(const __new_allocator<char>&, const __new_allocator<_Tp>&)' 215 | operator==(co
s075212997
p00451
C++
//JOI 0528 Common Sub-String #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string s, t; int roop1, roop2 = 0, save[10000], ans = 0; while(1){ cin>>s>>t for (int i = 0; i<s.size(); i++){ for (int j = 0; j<t.size(); j++){ if (s[i] == t[j]){ roop1 = 0; save[roop2] = 0; while (1){ if (s[i + roop1] == 0 || t[j + roop1] == 0){ break; } else{ if (s[i + roop1] == t[j + roop1]){ save[roop2] += 1; roop1++; } else if (s[i + roop1] != t[j + roop1]){ roop2++; break; } } } } } } sort(save, save + roop2 + 1); ans = save[roop2]; cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:18: error: expected ';' before 'for' 9 | cin>>s>>t | ^ | ; 10 | for (int i = 0; i<s.size(); i++){ | ~~~ a.cc:10:25: error: 'i' was not declared in this scope 10 | for (int i = 0; i<s.size(); i++){ | ^
s977354575
p00451
C++
//JOI 0528 Common Sub-String #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string s, t; int roop1, roop2 = 0, save[10000], ans = 0; while(cin>>s>>t&&){ for (int i = 0; i<s.size(); i++){ for (int j = 0; j<t.size(); j++){ if (s[i] == t[j]){ roop1 = 0; save[roop2] = 0; while (1){ if (s[i + roop1] == 0 || t[j + roop1] == 0){ break; } else{ if (s[i + roop1] == t[j + roop1]){ save[roop2] += 1; roop1++; } else if (s[i + roop1] != t[j + roop1]){ roop2++; break; } } } } } } sort(save, save + roop2 + 1); ans = save[roop2]; cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:26: error: expected primary-expression before ')' token 8 | while(cin>>s>>t&&){ | ^
s329782442
p00451
C++
//JOI 0528 Common Sub-String #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string s, t; int roop1, roop2 = 0, save[10000], ans = 0; while(cin){ cin>>s>>t: if(cin.eof()) break; for (int i = 0; i<s.size(); i++){ for (int j = 0; j<t.size(); j++){ if (s[i] == t[j]){ roop1 = 0; save[roop2] = 0; while (1){ if (s[i + roop1] == 0 || t[j + roop1] == 0){ break; } else{ if (s[i + roop1] == t[j + roop1]){ save[roop2] += 1; roop1++; } else if (s[i + roop1] != t[j + roop1]){ roop2++; break; } } } } } } sort(save, save + roop2 + 1); ans = save[roop2]; cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:23: error: expected ';' before ':' token 9 | cin>>s>>t: | ^ | ;
s867764083
p00451
C++
//JOI 0528 Common Sub-String #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { while(cin){ string s, t; int roop1=0, save=0, ans = 0; cin>>s; cin>>t; if(s==/0){ break; } for (int i = 0; i<s.size(); i++){ for (int j = 0; j<t.size(); j++){ if (s[i] == t[j]){ roop1 = 0; save= 0; while (1){ if (s[i + roop1] == 0 || t[j + roop1] == 0){ break; } else{ if (s[i + roop1] == t[j + roop1]){ save += 1; roop1++; } else if (s[i + roop1] != t[j + roop1]){ ans=max(ans,save); break; } } } } } } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:11:23: error: expected primary-expression before '/' token 11 | if(s==/0){ | ^
s016553155
p00451
C++
//JOI 0528 Common Sub-String #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { while(1){ string s, t; int roop1=0, save=0, ans = 0; cin>>s; cin>>t; if(s==\0){ break; } for (int i = 0; i<s.size(); i++){ for (int j = 0; j<t.size(); j++){ if (s[i] == t[j]){ roop1 = 0; save= 0; while (1){ if (s[i + roop1] == 0 || t[j + roop1] == 0){ break; } else{ if (s[i + roop1] == t[j + roop1]){ save += 1; roop1++; } else if (s[i + roop1] != t[j + roop1]){ ans=max(ans,save); break; } } } } } } cout<<ans<<endl; } return 0; }
a.cc:11:23: error: stray '\' in program 11 | if(s==\0){ | ^ a.cc: In function 'int main()': a.cc:11:21: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 11 | if(s==\0){ | ~^~ ~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 11 | if(s==\0){ | ^ In file included from /usr/include/c++/14/string:43, 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: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>' 11 | if(s==\0){ | ^ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(s==\0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(s==\0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(s==\0){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(s==\0){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 11 | if(s==\0){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(s==\0){ | ^ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(s==\0){ | ^ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:11:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 11 | if(s==\0){ | ^ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:11:24: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 11 | if(s==\0){ | ^ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:11:24: note: mismatched types 'const _CharT*' and 'int' 11 | if(s==\0){ | ^ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:11:24: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 11 | if(s==\0){ | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 11 | if(s==\0){ | ^ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 11 | if(s==\0){ | ^ In file included fro
s065822778
p00451
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { while(true){ string s,t; cin>>s>>t; if(s){ break; } int ans=0; for(int i=0;i<s.size();i++){ for(int j=0;j<t.size();j++){ if(s[i]==t[j]){ int sum=0; sum++; for(int k=1;k<min(s.size(),t.size());k++){ if(s[i+k]==t[j+k]){ sum++; } else{ ans=max(ans,sum); break; } } } } } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:10:20: error: could not convert 's' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' 10 | if(s){ | ^ | | | std::string {aka std::__cxx11::basic_string<char>}
s262358668
p00451
C++
#include<bits/stdc++.h> using namespace std; short cnt[4100][4100]; int main(){ string str1,str2; while(cin >> str1){ cin >> str2; int len1 = str1.size(); int len2 = str2.size(); str1 = ' ' + str1; str2 = ' ' + str2; for(int i=1;i<=len1;i++){ cnt[i][0] = 0; } for(int i=1;i<=len2;i++){ cnt[0][i] = 0; } int ret = 0; for(int i=1;i<=len1;i++){ for(int j=1;j<=len2;j++){ if(str1[i] == str2[j]){ cnt[i][j] = cnt[i-1][j-1] + 1; } else { cnt[i][j] = 0; } ret = max(ret,cnt[i][j]); } } cout << ret << endl; } }
a.cc: In function 'int main()': a.cc:27:18: error: no matching function for call to 'max(int&, short int&)' 27 | ret = max(ret,cnt[i][j]); | ~~~^~~~~~~~~~~~~~~ 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:27:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'short int') 27 | ret = max(ret,cnt[i][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: /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:27:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 27 | ret = max(ret,cnt[i][j]); | ~~~^~~~~~~~~~~~~~~
s972571957
p00451
C++
#include <algorithm> #include <bitset> #include <cstdio> #include <cstring> #include <cassert> #include <cmath> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long LL; typedef pair<int, int> P; typedef pair<LL, LL> PLL; short dp[4000][4000]; char s[4001], t[4001]; int main() { while (cin >> s >> t) { for (int j = 0; j < 4000; ++j) { fill(dp[j], dp[j] + 4000, 0); } int sLen = strlen(s); int tLen = strlen(t); int ret = 0; for (int j = 0; j < sLen; ++j) { for (int k = 0; k < tLen; ++k) { if (s[j] != t[k]) { dp[j][k] = 0; } else if (j == 0 || k == 0) { dp[j][k] = 1; } else { dp[j][k] = dp[j-1][k-1] + 1; } ret = max(ret, dp[j][k]); } } cout << ret << endl; } return 0; }
a.cc: In function 'int main()': a.cc:45:26: error: no matching function for call to 'max(int&, short int&)' 45 | ret = max(ret, dp[j][k]); | ~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, 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' ('int' and 'short int') 45 | ret = max(ret, dp[j][k]); | ~~~^~~~~~~~~~~~~~~ /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:45:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 45 | ret = max(ret, dp[j][k]); | ~~~^~~~~~~~~~~~~~~
s149860841
p00451
C++
#include <iostream> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define REP(i,n) for (int i=0;i<(n);i++) #define PB push_back #define MP make_pair #define LL long long const int INF = 1145141919; int dp[4002][4002]; int main(){ string s1, s2; while (cin >> s1){ cin >> s2; int ans = 0; memset (dp, 0, sizeof(dp)); REP (i, s1.size()){ REP (j, s2.size()){ if (s1[i] == s2[j]){ dp[i+1][j+1] = dp[i][j] + 1; ans = max (ans, dp[i+1][j+1]); } } } cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:17:17: error: 'memset' was not declared in this scope 17 | 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;
s953970087
p00451
C++
#include <iostream> #include <cstdio> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define REP(i,n) for (int i=0;i<(n);i++) #define PB push_back #define MP make_pair #define LL long long const int INF = 1145141919; int dp[4002][4002]; int main(){ string s1, s2; while (cin >> s1){ cin >> s2; int ans = 0; memset (dp, 0, sizeof(dp)); REP (i, s1.size()){ REP (j, s2.size()){ if (s1[i] == s2[j]){ dp[i+1][j+1] = dp[i][j] + 1; ans = max (ans, dp[i+1][j+1]); } } } cout << ans << endl; } }
a.cc: In function 'int main()': a.cc:18:17: error: 'memset' was not declared in this scope 18 | memset (dp, 0, sizeof(dp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <cstdio> +++ |+#include <cstring> 3 | using namespace std;
s051137703
p00451
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int dp[4001][4001]; void solve() { string a, b; while (cin >> a) { cin >> b; memset(dp, 0, sizeof(dp)); int ans = 0; for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < b.size(); ++j) { if (a[i] == b[j]) { dp[i + 1][j + 1] = dp[i][j] + 1; ans = max(ans, dp[i + 1][j + 1]); } else { dp[i + 1][j + 1] = 0; } } } cout << ans << endl; } } int main() { solve(); return(0); }
a.cc: In function 'void solve()': a.cc:15:17: error: 'memset' was not declared in this scope 15 | memset(dp, 0, sizeof(dp)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 |
s344860057
p00451
C++
#include <string> #include <vector> #include <iostream> #include <algorithm> using namespace std; class SuffixArray { void CEB(vector<int> &v, vector<int> &b) { int vs = v.size(), bs = b.size(); fill(b.begin(), b.end(), 0); for (int i = 0; i < vs; i++) b[v[i]]++; for (int i = 1; i < bs; i++) b[i] += b[i - 1]; } void ISort(vector<int> &v, vector<int> &SA, int mv, vector<int> &b, vector<int> &isL) { int vs = v.size(), bs = b.size(); fill(b.begin(), b.end(), 0); for (int i = 0; i < vs; i++) b[v[i]]++; int sum = 0; for (int i = 0; i < bs; i++) b[i] += sum, swap(sum, b[i]); for (int i = 0; i < vs; i++) { if (SA[i] > 0 && isL[SA[i] - 1]) SA[b[v[SA[i] - 1]]++] = SA[i] - 1; } } void IISort(vector<int> &v, vector<int> &SA, int mv, vector<int> &b, vector<int> &isL) { CEB(v, b); for (int i = v.size() - 1; i >= 0; i--) { if (SA[i] > 0 && !isL[SA[i] - 1]) SA[--b[v[SA[i] - 1]]] = SA[i] - 1; } } vector<int>SA_IS(vector<int> v, int mv) { int vs = v.size(); if (vs == 1) return vector<int>(1, 0); vector<int> isL(vs), b(mv + 1), SA(vs, -1), ord(vs); auto isLMS = [&](int x)->bool { return x > 0 && isL[x - 1] && !isL[x]; }; for (int i = vs - 2; i >= 0; i--) isL[i] = (v[i] > v[i + 1]) || (v[i] == v[i + 1] && isL[i + 1]); CEB(v, b); for (int i = 0; i < vs; i++) { if (isLMS(i)) SA[--b[v[i]]] = i; } ISort(v, SA, mv, b, isL); IISort(v, SA, mv, b, isL); int cur = 0; for (int i = 0; i < vs; i++) { if (isLMS(i)) ord[i] = cur++; } vector<int> nxv(cur); cur = -1; int prev = -1; for (int i = 0; i < vs; i++) { if (!isLMS(SA[i])) continue; bool diff = false; for (int d = 0; d < vs; d++) { if (prev == -1 || v[SA[i] + d] != v[prev + d] || isL[SA[i] + d] != isL[prev + d]) { diff = true; break; } else if (d && isLMS(SA[i] + d))break; } if (diff) cur++, prev = SA[i]; nxv[ord[SA[i]]] = cur; } vector<int> reord(nxv.size()); for (int i = 0; i < vs; i++) { if (isLMS(i)) reord[ord[i]] = i; } vector<int> nxSA = SA_IS(nxv, cur); CEB(v, b); for (int i = 0; i < SA.size(); i++) SA[i] = -1; for (int i = nxSA.size() - 1; i >= 0; i--) { SA[--b[v[reord[nxSA[i]]]]] = reord[nxSA[i]]; } ISort(v, SA, mv, b, isL); IISort(v, SA, mv, b, isL); return SA; } vector<int>SA_IS(string s) { vector<int> v(s.size() + 1); for (int i = 0; i < s.size(); i++) v[i] = s[i] + 1; return SA_IS(v, *max_element(v.begin(), v.end())); } vector<int>construct_lcp(string &s, vector<int> &sa) { vector<int> lcp, rank(s.size() + 1); int n = s.size(), h = 0; for (int i = 0; i <= n; i++) rank[sa[i]] = i; for (int i = 0; i < n; i++) { int j = sa[rank[i] - 1]; if (h) h--; for (; j + h < n && i + h < n; h++) { if (s[j + h] != s[i + h]) break; } lcp[rank[i] - 1] = h; } return lcp; } public: string s; vector<int> sa, lcp; void init(string &T) { s = T; sa = SA_IS(s); lcp = construct_lcp(s, sa); } SuffixArray(string &t) { init(t); } SuffixArray() {} bool contain(string &t) { int a = 0, b = s.size(); while (b - a > 1) { int c = (a + b) / 2; if (s.compare(sa[c], t.size(), t) < 0) a = c; else b = c; } return s.compare(sa[b], t.size(), t) == 0; } }; string s, t; int main() { while(cin >> s >> t) { SuffixArray v(s + "$" + t); int ret = 0, e = s.size() + t.size() + 1; for(int i = 0; i < e; i++) { if((v.sa[i] < sl) != (v.sa[i + 1] < sl)) ret = max(ret, v.lcp[i]) } cout << ret << endl; } }
a.cc: In function 'int main()': a.cc:117:39: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>' 117 | SuffixArray v(s + "$" + t); | ~~~~~~~~^~~ a.cc:102:29: note: initializing argument 1 of 'SuffixArray::SuffixArray(std::string&)' 102 | SuffixArray(string &t) { init(t); } | ~~~~~~~~^ a.cc:120:39: error: 'sl' was not declared in this scope; did you mean 's'? 120 | if((v.sa[i] < sl) != (v.sa[i + 1] < sl)) ret = max(ret, v.lcp[i]) | ^~ | s a.cc:120:90: error: expected ';' before '}' token 120 | if((v.sa[i] < sl) != (v.sa[i + 1] < sl)) ret = max(ret, v.lcp[i]) | ^ | ; 121 | } | ~
s753371712
p00451
C++
#include <string> #include <vector> #include <iostream> #include <algorithm> using namespace std; class SuffixArray { void CEB(vector<int> &v, vector<int> &b) { int vs = v.size(), bs = b.size(); fill(b.begin(), b.end(), 0); for (int i = 0; i < vs; i++) b[v[i]]++; for (int i = 1; i < bs; i++) b[i] += b[i - 1]; } void ISort(vector<int> &v, vector<int> &SA, int mv, vector<int> &b, vector<int> &isL) { int vs = v.size(), bs = b.size(); fill(b.begin(), b.end(), 0); for (int i = 0; i < vs; i++) b[v[i]]++; int sum = 0; for (int i = 0; i < bs; i++) b[i] += sum, swap(sum, b[i]); for (int i = 0; i < vs; i++) { if (SA[i] > 0 && isL[SA[i] - 1]) SA[b[v[SA[i] - 1]]++] = SA[i] - 1; } } void IISort(vector<int> &v, vector<int> &SA, int mv, vector<int> &b, vector<int> &isL) { CEB(v, b); for (int i = v.size() - 1; i >= 0; i--) { if (SA[i] > 0 && !isL[SA[i] - 1]) SA[--b[v[SA[i] - 1]]] = SA[i] - 1; } } vector<int>SA_IS(vector<int> v, int mv) { int vs = v.size(); if (vs == 1) return vector<int>(1, 0); vector<int> isL(vs), b(mv + 1), SA(vs, -1), ord(vs); auto isLMS = [&](int x)->bool { return x > 0 && isL[x - 1] && !isL[x]; }; for (int i = vs - 2; i >= 0; i--) isL[i] = (v[i] > v[i + 1]) || (v[i] == v[i + 1] && isL[i + 1]); CEB(v, b); for (int i = 0; i < vs; i++) { if (isLMS(i)) SA[--b[v[i]]] = i; } ISort(v, SA, mv, b, isL); IISort(v, SA, mv, b, isL); int cur = 0; for (int i = 0; i < vs; i++) { if (isLMS(i)) ord[i] = cur++; } vector<int> nxv(cur); cur = -1; int prev = -1; for (int i = 0; i < vs; i++) { if (!isLMS(SA[i])) continue; bool diff = false; for (int d = 0; d < vs; d++) { if (prev == -1 || v[SA[i] + d] != v[prev + d] || isL[SA[i] + d] != isL[prev + d]) { diff = true; break; } else if (d && isLMS(SA[i] + d))break; } if (diff) cur++, prev = SA[i]; nxv[ord[SA[i]]] = cur; } vector<int> reord(nxv.size()); for (int i = 0; i < vs; i++) { if (isLMS(i)) reord[ord[i]] = i; } vector<int> nxSA = SA_IS(nxv, cur); CEB(v, b); for (int i = 0; i < SA.size(); i++) SA[i] = -1; for (int i = nxSA.size() - 1; i >= 0; i--) { SA[--b[v[reord[nxSA[i]]]]] = reord[nxSA[i]]; } ISort(v, SA, mv, b, isL); IISort(v, SA, mv, b, isL); return SA; } vector<int>SA_IS(string s) { vector<int> v(s.size() + 1); for (int i = 0; i < s.size(); i++) v[i] = s[i] + 1; return SA_IS(v, *max_element(v.begin(), v.end())); } vector<int>construct_lcp(string &s, vector<int> &sa) { vector<int> lcp, rank(s.size() + 1); int n = s.size(), h = 0; for (int i = 0; i <= n; i++) rank[sa[i]] = i; for (int i = 0; i < n; i++) { int j = sa[rank[i] - 1]; if (h) h--; for (; j + h < n && i + h < n; h++) { if (s[j + h] != s[i + h]) break; } lcp[rank[i] - 1] = h; } return lcp; } public: string s; vector<int> sa, lcp; void init(string &T) { s = T; sa = SA_IS(s); lcp = construct_lcp(s, sa); } SuffixArray(string &t) { init(t); } SuffixArray() {} bool contain(string &t) { int a = 0, b = s.size(); while (b - a > 1) { int c = (a + b) / 2; if (s.compare(sa[c], t.size(), t) < 0) a = c; else b = c; } return s.compare(sa[b], t.size(), t) == 0; } }; string s, t; int main() { while(cin >> s >> t) { SuffixArray v(s + string("$") + t); int ret = 0, e = s.size() + t.size() + 1; for(int i = 0; i < e; i++) { if((v.sa[i] < sl) != (v.sa[i + 1] < sl)) ret = max(ret, v.lcp[i]) } cout << ret << endl; } }
a.cc: In function 'int main()': a.cc:117:47: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>' 117 | SuffixArray v(s + string("$") + t); | ~~~~~~~~~~~~~~~~^~~ a.cc:102:29: note: initializing argument 1 of 'SuffixArray::SuffixArray(std::string&)' 102 | SuffixArray(string &t) { init(t); } | ~~~~~~~~^ a.cc:120:39: error: 'sl' was not declared in this scope; did you mean 's'? 120 | if((v.sa[i] < sl) != (v.sa[i + 1] < sl)) ret = max(ret, v.lcp[i]) | ^~ | s a.cc:120:90: error: expected ';' before '}' token 120 | if((v.sa[i] < sl) != (v.sa[i + 1] < sl)) ret = max(ret, v.lcp[i]) | ^ | ; 121 | } | ~
s066491368
p00451
C++
#include <iostream> #include <string> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) int ans, dp[4001][4001]; int main() { while (true) { ans = 0; memset(dp, 0, sizeof(dp)); string str[2]; cin >> str[0]; if (str[0].empty()) break; cin >> str[1]; REP(i, (int)str[0].size()) { REP(j, (int)str[1].size()) { if (str[0][i] == str[1][j]) { dp[i + 1][j + 1] = dp[i][j] + 1; ans = ans < dp[i + 1][j + 1] ? dp[i + 1][j + 1] : ans; } else dp[i + 1][j + 1] = 0; } } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:17: error: 'memset' was not declared in this scope 14 | 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 | #include <string>
s973304284
p00451
C++
#include <iostream> #include <algorithm> #include <climits> #include <string> #include <vector> #include <cmath> using namespace std; #define rep(i, n) for (int i=0; i<int(n); i++) #define rep3(i, s, n) for (int i=int(s); i<int(n); i++) #define rev_rep(i, n) for (int i=int(n)-1; i>=0; i-=1) char s[4010]; char t[4010]; int dp[4010][4010]; int main() { while (cin >> s >> t) { int s_len = strlen(s), t_len = strlen(t); rep(i, s_len) { rep(j, t_len) { if (s[i] == t[j]) dp[i][j] = ((i>1&&j>1) ? dp[i-1][j-1] : 0) + 1; else dp[i][j] = 0; } } int ans = 0; rep(i, s_len) { rep (j, t_len) { ans = max(ans, dp[i][j]); } } cout << ans << "\n"; } return 0; }
a.cc: In function 'int main()': a.cc:19:15: error: 'strlen' was not declared in this scope 19 | int s_len = strlen(s), t_len = strlen(t); | ^~~~~~ 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 | a.cc:21:12: error: 't_len' was not declared in this scope; did you mean 's_len'? 21 | rep(j, t_len) { | ^~~~~ a.cc:10:44: note: in definition of macro 'rep' 10 | #define rep(i, n) for (int i=0; i<int(n); i++) | ^ a.cc:28:13: error: 't_len' was not declared in this scope; did you mean 's_len'? 28 | rep (j, t_len) { | ^~~~~ a.cc:10:44: note: in definition of macro 'rep' 10 | #define rep(i, n) for (int i=0; i<int(n); i++) | ^
s737341936
p00451
C++
#include <iostream> #include <algorithm> #include <climits> #include <string> #include <vector> #include <cmath> #include <cstdlib> using namespace std; #define rep(i, n) for (int i=0; i<int(n); i++) #define rep3(i, s, n) for (int i=int(s); i<int(n); i++) #define rev_rep(i, n) for (int i=int(n)-1; i>=0; i-=1) char s[4010]; char t[4010]; int dp[4010][4010]; int main() { while (cin >> s >> t) { int s_len = strlen(s), t_len = strlen(t); rep(i, s_len) { rep(j, t_len) { if (s[i] == t[j]) dp[i][j] = ((i>1&&j>1) ? dp[i-1][j-1] : 0) + 1; else dp[i][j] = 0; } } int ans = 0; rep(i, s_len) { rep (j, t_len) { ans = max(ans, dp[i][j]); } } cout << ans << "\n"; } return 0; }
a.cc: In function 'int main()': a.cc:20:15: error: 'strlen' was not declared in this scope 20 | int s_len = strlen(s), t_len = strlen(t); | ^~~~~~ a.cc:8:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 7 | #include <cstdlib> +++ |+#include <cstring> 8 | a.cc:22:12: error: 't_len' was not declared in this scope; did you mean 's_len'? 22 | rep(j, t_len) { | ^~~~~ a.cc:11:44: note: in definition of macro 'rep' 11 | #define rep(i, n) for (int i=0; i<int(n); i++) | ^ a.cc:29:13: error: 't_len' was not declared in this scope; did you mean 's_len'? 29 | rep (j, t_len) { | ^~~~~ a.cc:11:44: note: in definition of macro 'rep' 11 | #define rep(i, n) for (int i=0; i<int(n); i++) | ^
s229384990
p00451
C++
#include "bits/stdc++.h" #include<unordered_map> #include<unordered_set> #pragma warning(disable:4996) using namespace std; using ld = long double; template<class T> using Table = vector<vector<T>>; const ld eps=1e-9; //// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer" int main() { string a, b; while (cin >> a >> b;) { int dp[4001][4001]; for (int i = 0; i < 4001; ++i) { for (int j = 0; j < 4001; ++j) { dp[i][j] = -1e9; } } dp[0][0] = 0; int ans = 0; for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a.size(); ++j) { if (a[i] == b[j]) { if (i > 0 && j > 0) { dp[i][j] = dp[i - 1][j - 1] + 1; } else { dp[i][j] = 1; } } ans = max(ans, dp[i][j]); } } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:29: error: expected ')' before ';' token 14 | while (cin >> a >> b;) { | ~ ^ | ) a.cc:14:30: error: expected primary-expression before ')' token 14 | while (cin >> a >> b;) { | ^
s908384663
p00451
C++
#include <bits/stdc++.h> using namespace std; #define Rep(i,N) for(int i = 0; i < N; i++) int main() { string S, W; while(cin >> S >> W) { int dp[4005] = {0}; int maxv = 0; Rep(i,W.size()) { for(int j = S.size(); j > 0; j--) { if(S[j - 1] == W[i]) { dp[j] = dp[j - 1] + 1; maxv = max(maxv, dp[j]); } else dp[j] = 0; } } } cout << maxv << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:11: error: 'maxv' was not declared in this scope 20 | cout << maxv << endl; | ^~~~
s756109451
p00451
C++
#include<cstdio> #include <iostream> #include<algorithm> #include<string> #include<queue> #include<vector> #include<functional> #include<cmath> #include<map> #include<stack> #include<cstdlib> #include<list> #include<set> #include<numeric> #define MOD 1000000007 using namespace std; typedef long long ll; typedef pair<int, int> P; char a[4010], b[4010]; int dp[4010][4010]; int main() { while (cin >> a) { cin >> b; int len_a = strlen(a); int len_b = strlen(b); for (int i = 0; i <= len_a; i++) for (int j = 0; j <= len_b; j++) dp[i][j] = 0; for (int i = 0; i < len_a; i++) { for (int j = 0; j < len_b; j++) { if (a[i] == b[j]) dp[i + 1][j + 1] = dp[i][j] + 1; } } int ans = 0; for (int i = 0; i <= len_a; i++) for (int j = 0; j <= len_b; j++) ans = max(ans, dp[i][j]); cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:29:29: error: 'strlen' was not declared in this scope 29 | int len_a = strlen(a); | ^~~~~~ a.cc:15:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 14 | #include<numeric> +++ |+#include <cstring> 15 |
s931817692
p00451
C++
include<bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) for(int i=0;i<(n);i++) #define VS vector<string> int main(void) { string s,t; int max=0; while(cin >> s >> t) { int dp[s.size()][t.size()]; REP(i,s.size()) { REP(j,t.size()) { dp[i][j] = -1; } } REP(i,s.size()) { dp[i][0] = 0; } REP(i,t.size()) { dp[0][i] = 0; } FOR(i,1,s.size()) { FOR(j,1,t.size()) { if(s[i] != t[j]) dp[i][j] = 0; else dp[i][j] = dp[i-1][j-1] + 1; max = fmax(max, dp[i][j]); } } cout << max << endl; max = 0; } }
a.cc:1:1: error: 'include' does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:8:5: error: 'string' was not declared in this scope 8 | string s,t; | ^~~~~~ a.cc:10:11: error: 'cin' was not declared in this scope 10 | while(cin >> s >> t) { | ^~~ a.cc:10:18: error: 's' was not declared in this scope 10 | while(cin >> s >> t) { | ^ a.cc:10:23: error: 't' was not declared in this scope 10 | while(cin >> s >> t) { | ^ a.cc:14:17: error: 'dp' was not declared in this scope 14 | dp[i][j] = -1; | ^~ a.cc:18:13: error: 'dp' was not declared in this scope 18 | dp[i][0] = 0; | ^~ a.cc:21:13: error: 'dp' was not declared in this scope 21 | dp[0][i] = 0; | ^~ a.cc:26:34: error: 'dp' was not declared in this scope 26 | if(s[i] != t[j]) dp[i][j] = 0; | ^~ a.cc:27:22: error: 'dp' was not declared in this scope 27 | else dp[i][j] = dp[i-1][j-1] + 1; | ^~ a.cc:28:33: error: 'dp' was not declared in this scope 28 | max = fmax(max, dp[i][j]); | ^~ a.cc:28:23: error: 'fmax' was not declared in this scope; did you mean 'max'? 28 | max = fmax(max, dp[i][j]); | ^~~~ | max a.cc:31:9: error: 'cout' was not declared in this scope 31 | cout << max << endl; | ^~~~ a.cc:31:24: error: 'endl' was not declared in this scope 31 | cout << max << endl; | ^~~~
s255393162
p00451
C++
#include <bits/stdc++.h> #define ll long long #define rep(i,n) for(int i=0;i<n;i++) #define INF 100000005 #define MAX 5001 using namespace std; //__gcd(a,b), __builtin_popcount(a); int dp[4005][4005]; int main(){ string s1, s2; while(cin >> s1 >> s2, s1){ s1 = " " + s1;s2 = " " + s2; fill((int*)dp, (int*)(dp+4005), 0); int ans = 0; for(int i = 1;i <= s1.size();i++){ for(int j = 1;j <= s2.size();j++){ if(s1[i] == s2[j])dp[i][j] = dp[i-1][j-1]+1; ans = max(ans, dp[i][j]); } } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:30: error: could not convert '(((void)std::operator>><char, char_traits<char>, allocator<char> >((* & std::operator>><char, char_traits<char>, allocator<char> >(std::cin, s1)), s2)), s1)' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' 12 | while(cin >> s1 >> s2, s1){ | ~~~~~~~~~~~~~~~^~~~ | | | std::string {aka std::__cxx11::basic_string<char>}
s144552872
p00451
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define INF (1<<30) #define INFLL (1ll<<60) typedef pair<int, int> P; typedef pair<ll, P> E; #define MOD (1000000007ll) #define l_ength size #define PI 3.14159265358979 void mul_mod(ll& a, ll b){ a *= b; a %= MOD; } void add_mod(ll& a, ll b){ b += MOD; a += b; a %= MOD; } int n,m; int memo[4444][4444]; bool done[4444][4444]; char s[4444],t[4444]; int dp(int i, int j){ if(done[i][j]){ return memo[i][j]; } done[i][j] = true; if(i == n || j == m){ memo[i][j] = 0ll; }else if(s[i] != t[j]){ memo[i][j] = 0ll; }else{ memo[i][j] = dp(i+1,j+1) + 1; } return memo[i][j]; } int main(void){ int i,j; ll ans; while(scanf("%s",s)!=EOF){ fill(done[0],done[4444],false); ans = 0ll; scanf("%s",t); n = strlen(s); m = strlen(t); for(i=0; i<n; ++i){ for(j=0; j<m; ++j){ ans = max(ans,dp(i,j)); } } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:53:26: error: no matching function for call to 'max(ll&, int)' 53 | ans = max(ans,dp(i,j)); | ~~~^~~~~~~~~~~~~ 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:53:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 53 | ans = max(ans,dp(i,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: /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:53:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 53 | ans = max(ans,dp(i,j)); | ~~~^~~~~~~~~~~~~
s328884905
p00451
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define INF (1<<30) #define INFLL (1ll<<60) typedef pair<int, int> P; typedef pair<ll, P> E; #define MOD (1000000007ll) #define l_ength size #define PI 3.14159265358979 void mul_mod(ll& a, ll b){ a *= b; a %= MOD; } void add_mod(ll& a, ll b){ b += MOD; a += b; a %= MOD; } int n,m; int memo[4444][4444]; bool done[4444][4444]; char s[4444],t[4444]; int dp(int i, int j){ if(done[i][j]){ return memo[i][j]; } done[i][j] = true; if(i == n || j == m){ memo[i][j] = 0; }else if(s[i] != t[j]){ memo[i][j] = 0; }else{ memo[i][j] = dp(i+1,j+1) + 1; } return memo[i][j]; } int main(void){ int i,j; ll ans; while(scanf("%s",s)!=EOF){ fill(done[0],done[4444],false); ans = 0ll; scanf("%s",t); n = strlen(s); m = strlen(t); for(i=0; i<n; ++i){ for(j=0; j<m; ++j){ ans = max(ans,dp(i,j)); } } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:53:26: error: no matching function for call to 'max(ll&, int)' 53 | ans = max(ans,dp(i,j)); | ~~~^~~~~~~~~~~~~ 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:53:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 53 | ans = max(ans,dp(i,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: /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:53:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 53 | ans = max(ans,dp(i,j)); | ~~~^~~~~~~~~~~~~
s916889540
p00451
C++
#include<cstdio> #include<iostream> #include<vector> #include<algorithm> #include<map> #include<set> #include<queue> #include<string> using namespace std; #define rep(i,n) for(int i=0;i<int(n);i++) #define reps(i,n) for(int i=1;i<=int(n);i++) #define sint(i) scanf("%d",&i); #define sintt(i,j) scanf("%d%d",&i,&j); #define sinttt(i,j,k) scanf("%d%d%d",&i,&j,&k); #define sintttt(i,j,k,m) scanf("%d%d%d%d",&i,&j,&k,&m); #define INF 1010000000 int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; short dp[4001][4001]; int main(){ while(1){ string a,b; cin>>a>>b; if(b.size()==0){ break; } rep(i,4001)rep(j,4001)dp[i][j]=0; int maxi=0; reps(i,a.size()){ reps(j,b.size()){ if(a[i-1]==b[j-1]){ dp[i][j]=dp[i-1][j-1]+1; } maxi=max(maxi,dp[i][j]); } } printf("%d\n",maxi); } }
a.cc: In function 'int main()': a.cc:42:41: error: no matching function for call to 'max(int&, short int&)' 42 | maxi=max(maxi,dp[i][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:2: /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:42:41: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'short int') 42 | maxi=max(maxi,dp[i][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:4: /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:42:41: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 42 | maxi=max(maxi,dp[i][j]); | ~~~^~~~~~~~~~~~~~~
s764103475
p00451
C++
class Main{ }
a.cc:3:2: error: expected ';' after class definition 3 | } | ^ | ;
s793154852
p00451
C++
class Main{ }
a.cc:3:2: error: expected ';' after class definition 3 | } | ^ | ;
s501030076
p00451
C++
class Main{ public static void main(){ Scanner sc=new Scanner(System.in); for(;sc.hasNext();){ String s=sc.next(); String t=sc.next(); System.out.println(lcs(s,t).length()); } } static String lcs(String s, String t){ int m=s.length(), n=t.length(); int[][] d=new int[n+1][m+1]; int[][] v=new int[n+1][m+1]; for(int j=1; j<=n; j++){ for(int i=1; i<=m; i++){ if(s.charAt(i-1)==t.charAt(j-1)){ d[j][i]=d[j-1][i-1]+1; v[j][i]=0; }else if(d[j][i-1]>d[j-1][i]){ d[j][i]=d[j][i-1]; v[j][i]=+1; }else{ d[j][i]=d[j-1][i]; v[j][i]=-1; } } } String r=""; for(int i=m, j=n; i>0&&j>0;){ debug(i, j); if(v[j][i]>0) i--; else if(v[j][i]<0) j--; else{ r=s.charAt(i-1)+r; i--; j--; } } return r; } }
a.cc:2:7: error: expected ':' before 'static' 2 | public static void main(){ | ^~~~~~~ | : a.cc:11:16: error: 'String' does not name a type 11 | static String lcs(String s, String t){ | ^~~~~~ a.cc:45:2: error: expected ';' after class definition 45 | } | ^ | ; a.cc: In static member function 'static void Main::main()': a.cc:3:1: error: 'Scanner' was not declared in this scope 3 | Scanner sc=new Scanner(System.in); | ^~~~~~~ a.cc:4:6: error: 'sc' was not declared in this scope 4 | for(;sc.hasNext();){ | ^~ a.cc:5:1: error: 'String' was not declared in this scope 5 | String s=sc.next(); | ^~~~~~ a.cc:6:8: error: expected ';' before 't' 6 | String t=sc.next(); | ^ a.cc:7:1: error: 'System' was not declared in this scope 7 | System.out.println(lcs(s,t).length()); | ^~~~~~ a.cc:7:24: error: 's' was not declared in this scope 7 | System.out.println(lcs(s,t).length()); | ^ a.cc:7:26: error: 't' was not declared in this scope 7 | System.out.println(lcs(s,t).length()); | ^ a.cc:7:20: error: 'lcs' was not declared in this scope 7 | System.out.println(lcs(s,t).length()); | ^~~
s805559808
p00451
C++
class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); for(;sc.hasNext();){ String s=sc.next(); String t=sc.next(); System.out.println(lcs(s,t).length()); } } static String lcs(String s, String t){ int m=s.length(), n=t.length(); int[][] d=new int[n+1][m+1]; int[][] v=new int[n+1][m+1]; for(int j=1; j<=n; j++){ for(int i=1; i<=m; i++){ if(s.charAt(i-1)==t.charAt(j-1)){ d[j][i]=d[j-1][i-1]+1; v[j][i]=0; }else if(d[j][i-1]>d[j-1][i]){ d[j][i]=d[j][i-1]; v[j][i]=+1; }else{ d[j][i]=d[j-1][i]; v[j][i]=-1; } } } String r=""; for(int i=m, j=n; i>0&&j>0;){ debug(i, j); if(v[j][i]>0) i--; else if(v[j][i]<0) j--; else{ r=s.charAt(i-1)+r; i--; j--; } } return r; } }
a.cc:2:7: error: expected ':' before 'static' 2 | public static void main(String[] args){ | ^~~~~~~ | : a.cc:2:25: error: 'String' has not been declared 2 | public static void main(String[] args){ | ^~~~~~ a.cc:2:34: error: expected ',' or '...' before 'args' 2 | public static void main(String[] args){ | ^~~~ a.cc:11:16: error: 'String' does not name a type 11 | static String lcs(String s, String t){ | ^~~~~~ a.cc:45:2: error: expected ';' after class definition 45 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:3:1: error: 'Scanner' was not declared in this scope 3 | Scanner sc=new Scanner(System.in); | ^~~~~~~ a.cc:4:6: error: 'sc' was not declared in this scope 4 | for(;sc.hasNext();){ | ^~ a.cc:5:1: error: 'String' was not declared in this scope 5 | String s=sc.next(); | ^~~~~~ a.cc:6:8: error: expected ';' before 't' 6 | String t=sc.next(); | ^ a.cc:7:1: error: 'System' was not declared in this scope 7 | System.out.println(lcs(s,t).length()); | ^~~~~~ a.cc:7:24: error: 's' was not declared in this scope 7 | System.out.println(lcs(s,t).length()); | ^ a.cc:7:26: error: 't' was not declared in this scope 7 | System.out.println(lcs(s,t).length()); | ^ a.cc:7:20: error: 'lcs' was not declared in this scope 7 | System.out.println(lcs(s,t).length()); | ^~~
s813086080
p00451
C++
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); for(;sc.hasNext();){ String s=sc.next(); String t=sc.next(); System.out.println(lcs(s,t).length()); } } static String lcs(String s, String t){ int m=s.length(), n=t.length(); int[][] d=new int[n+1][m+1]; int[][] v=new int[n+1][m+1]; for(int j=1; j<=n; j++){ for(int i=1; i<=m; i++){ if(s.charAt(i-1)==t.charAt(j-1)){ d[j][i]=d[j-1][i-1]+1; v[j][i]=0; }else if(d[j][i-1]>d[j-1][i]){ d[j][i]=d[j][i-1]; v[j][i]=+1; }else{ d[j][i]=d[j-1][i]; v[j][i]=-1; } } } String r=""; for(int i=m, j=n; i>0&&j>0;){ debug(i, j); if(v[j][i]>0) i--; else if(v[j][i]<0) j--; else{ r=s.charAt(i-1)+r; i--; j--; } } return r; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.lang.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.math.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.io.*; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import static java.lang.Math.*; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: 'import' does not name a type 7 | import static java.util.Arrays.*; | ^~~~~~ a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:9:1: error: expected unqualified-id before 'public' 9 | public class Main{ | ^~~~~~
s248737793
p00451
C++
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); for(;sc.hasNext();){ String s=sc.next(); String t=sc.next(); System.out.println(lcs(s,t).length()); } } static String lcs(String s, String t){ int m=s.length(), n=t.length(); int[][] d=new int[n+1][m+1]; int[][] v=new int[n+1][m+1]; for(int j=1; j<=n; j++){ for(int i=1; i<=m; i++){ if(s.charAt(i-1)==t.charAt(j-1)){ d[j][i]=d[j-1][i-1]+1; v[j][i]=0; }else if(d[j][i-1]>d[j-1][i]){ d[j][i]=d[j][i-1]; v[j][i]=+1; }else{ d[j][i]=d[j-1][i]; v[j][i]=-1; } } } String r=""; for(int i=m, j=n; i>0&&j>0;){ if(v[j][i]>0) i--; else if(v[j][i]<0) j--; else{ r=s.charAt(i-1)+r; i--; j--; } } return r; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.lang.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.math.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.io.*; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import static java.lang.Math.*; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: 'import' does not name a type 7 | import static java.util.Arrays.*; | ^~~~~~ a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:9:1: error: expected unqualified-id before 'public' 9 | public class Main{ | ^~~~~~
s559999166
p00451
C++
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; import static java.util.Arrays.*; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); for(;sc.hasNext();){ String s=sc.next(); String t=sc.next(); System.out.println(lcs(s,t).length()); } } static String lcs(String s, String t){ int m=s.length(), n=t.length(); int[][] d=new int[n+1][m+1]; int[][] v=new int[n+1][m+1]; for(int j=1; j<=n; j++){ for(int i=1; i<=m; i++){ if(s.charAt(i-1)==t.charAt(j-1)){ d[j][i]=d[j-1][i-1]+1; v[j][i]=0; }else if(d[j][i-1]>d[j-1][i]){ d[j][i]=d[j][i-1]; v[j][i]=+1; }else{ d[j][i]=d[j-1][i]; v[j][i]=-1; } } } String r=""; for(int i=m, j=n; i>0&&j>0;){ if(v[j][i]>0) i--; else if(v[j][i]<0) j--; else{ r=s.charAt(i-1)+r; i--; j--; } } return r; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.lang.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.math.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.io.*; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import static java.lang.Math.*; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: 'import' does not name a type 7 | import static java.util.Arrays.*; | ^~~~~~ a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:10:7: error: expected ':' before 'static' 10 | public static void main(String[] args){ | ^~~~~~~ | : a.cc:10:25: error: 'String' has not been declared 10 | public static void main(String[] args){ | ^~~~~~ a.cc:10:34: error: expected ',' or '...' before 'args' 10 | public static void main(String[] args){ | ^~~~ a.cc:19:16: error: 'String' does not name a type 19 | static String lcs(String s, String t){ | ^~~~~~ a.cc:52:2: error: expected ';' after class definition 52 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:11:1: error: 'Scanner' was not declared in this scope 11 | Scanner sc=new Scanner(System.in); | ^~~~~~~ a.cc:12:6: error: 'sc' was not declared in this scope 12 | for(;sc.hasNext();){ | ^~ a.cc:13:1: error: 'String' was not declared in this scope 13 | String s=sc.next(); | ^~~~~~ a.cc:14:8: error: expected ';' before 't' 14 | String t=sc.next(); | ^ a.cc:15:1: error: 'System' was not declared in this scope 15 | System.out.println(lcs(s,t).length()); | ^~~~~~ a.cc:15:24: error: 's' was not declared in this scope 15 | System.out.println(lcs(s,t).length()); | ^ a.cc:15:26: error: 't' was not declared in this scope 15 | System.out.println(lcs(s,t).length()); | ^ a.cc:15:20: error: 'lcs' was not declared in this scope 15 | System.out.println(lcs(s,t).length()); | ^~~
s560733195
p00451
C++
#include <iostream> #include <algorithm> #include <string> #include <fstream> using namespace std; int check(string, string); int main() { //ifstream ifs("data.txt"); string str1, str2; while( cin >> str1 >> str2 ){ int res = 0; for(int i = 0; i < max(str1.size(), str2.size()); i++){ if(str1.size() > str2.size()) rotate(str1.begin(), str1.begin() + 1, str1.end()); else rotate(str2.begin(), str2.begin() + 1, str2.end()); res = max(res, check(str1, str2)); } cout << res << endl; } ifs.close(); } int check(string str1, string str2) { int sn = 0, res = 0; for(int i = 0; i < min(str1.size(), str2.size()); i++){ if(str1[i] == str2[i]) sn++; res = max(res, sn); else{ sn = 0; } } return res; }
a.cc: In function 'int main()': a.cc:29:3: error: 'ifs' was not declared in this scope 29 | ifs.close(); | ^~~ a.cc: In function 'int check(std::string, std::string)': a.cc:39:5: error: 'else' without a previous 'if' 39 | else{ | ^~~~
s545552902
p00451
C++
char s[4005],t[4005];u[4005],m,i,j,c,d;main(n){for(;d=~scanf("%s%s",s,t);i=m=!printf("%d\n",m))for(n=strlen(s);d;d=t[i++])for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;}
a.cc:1:22: error: 'u' does not name a type 1 | char s[4005],t[4005];u[4005],m,i,j,c,d;main(n){for(;d=~scanf("%s%s",s,t);i=m=!printf("%d\n",m))for(n=strlen(s);d;d=t[i++])for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^ a.cc:1:44: error: expected constructor, destructor, or type conversion before '(' token 1 | char s[4005],t[4005];u[4005],m,i,j,c,d;main(n){for(;d=~scanf("%s%s",s,t);i=m=!printf("%d\n",m))for(n=strlen(s);d;d=t[i++])for(j=n;j--;m<c?m=c:0)u[j+1]=c=s[j]-d?0:u[j]+1;} | ^