submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s759389250 | p00500 | C++ | int main(void){
int N, i, k, cnt = 0, l, a, data[200][3];
scanf("%d", &N);
for(i = 1; i <= N; i++){
for(k = 1; k <= 3; k++){
scanf("%d", data[i][k]);
}
}
for(k = 1; k <= 3; k++){
for(i = 1; i <= N; i++){
a = data[i][k];
for(l = 1; l <= N; l++){
if(i == l)continue;
if(a == data[l][k]){
cnt += 1;
break;
}
if(cnt == 0)data[i][0] += a;
}
}
}
for(i = 1; i <= N; i++){
printf("%d\n", data[i][0]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:3:9: error: 'scanf' was not declared in this scope
3 | scanf("%d", &N);
| ^~~~~
a.cc:23:17: error: 'printf' was not declared in this scope
23 | printf("%d\n", data[i][0]);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | int main(void){
|
s827226669 | p00500 | C++ | int main(void){
int N, i, k, cnt = 0, l, a, data[200][3];
scanf("%d", &N);
for(i = 1; i <= N; i++){
for(k = 1; k <= 3; k++){
scanf("%d", data[i][k]);
}
printf("\n");
}
for(k = 1; k <= 3; k++){
for(i = 1; i <= N; i++){
a = data[i][k];
for(l = 1; l <= N; l++){
if(i == l)continue;
if(a == data[l][k]){
cnt += 1;
break;
}
if(cnt == 0)data[i][0] += a;
}
}
}
for(i = 1; i <= N; i++){
printf("%d\n", data[i][0]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:3:9: error: 'scanf' was not declared in this scope
3 | scanf("%d", &N);
| ^~~~~
a.cc:8:17: error: 'printf' was not declared in this scope
8 | printf("\n");
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | int main(void){
a.cc:24:17: error: 'printf' was not declared in this scope
24 | printf("%d\n", data[i][0]);
| ^~~~~~
a.cc:24:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
|
s435249414 | p00500 | C++ | #include<sydio.h>
int main(){
int N, i, k, cnt = 0, l, a, data[200][3];
scanf("%d", &N);
for(i = 1; i <= N; i++){
for(k = 1; k <= 3; k++){
scanf("%d", &data[i][k]);
}
}
for(k = 1; k <= 3; k++){
for(i = 1; i <= N; i++){
a = data[i][k];
for(l = 1; l <= N; l++){
if(i == l)continue;
if(a == data[l][k]){
cnt += 1;
break;
}
if(cnt == 0)data[i][0] += a;
}
}
}
for(i = 1; i <= N; i++){
printf("%d\n", data[i][0]);
}
return 0;
} | a.cc:1:9: fatal error: sydio.h: No such file or directory
1 | #include<sydio.h>
| ^~~~~~~~~
compilation terminated.
|
s371833056 | p00500 | C++ | #include<bits/stdc++.h>
using namespace std;
int n[200][3],x,y[200],z[100];
int main(){
cin>>x;
for(int i=0;i<x;i++){cin>>n[i][0]>>n[i][1]>>n[i][2];}
for(int i=0;i<3;i++){memset(z,0,sizeof(z));
for(int k=0;k<200;k++){z[n[k][i]]++;}
for(int j=0;j<n;j++){if(z[n[j][i]]==1){y[j]+=n[j][i];}}
}
for(int i=0;i<n;i++){cout<<y[i]<<endl;}} | a.cc: In function 'int main()':
a.cc:9:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | for(int j=0;j<n;j++){if(z[n[j][i]]==1){y[j]+=n[j][i];}}
| ~^~
a.cc:11:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
11 | for(int i=0;i<n;i++){cout<<y[i]<<endl;}}
| ~^~
|
s254966533 | p00500 | C++ | d | a.cc:1:1: error: 'd' does not name a type
1 | d
| ^
|
s245733976 | p00500 | C++ | d | a.cc:1:1: error: 'd' does not name a type
1 | d
| ^
|
s194613188 | p00500 | C++ | #include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
int n; cin>>n;
int v[100][3]={0};
vvi hoge(n,vi(3));
rep(i,n){a
rep(j,3){
int temp; cin>>temp;
hoge[i][j]=temp;
v[temp][j]++;
}
}
rep(i,n){
int ans=0;
rep(j,3)if(v[hoge[i][j]][j]==1)ans+=hoge[i][j];
cout<<ans<<endl;
}
} | a.cc: In function 'int main()':
a.cc:48:14: error: 'a' was not declared in this scope
48 | rep(i,n){a
| ^
a.cc:49:13: error: 'j' was not declared in this scope
49 | rep(j,3){
| ^
a.cc:34:30: note: in definition of macro 'rep'
34 | #define rep(i,n) for(int i=0;i<n;i++)
| ^
|
s990821257 | p00500 | C++ | import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;
public class Main{
static final Scanner s=new Scanner(System.in);
static IntStream REPS(int v){return IntStream.range(0,v);}
static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
static IntStream INS(int n){return REPS(n).map(i->getInt());}
static int getInt(){return Integer.parseInt(s.next());}
public static void main(String[]$){
int n=getInt(),
a[][]=REPS(n).mapToObj(i->INS(3).toArray()).toArray(int[][]::new),
r[]=new int[n];
REPS(3).forEach(o->{
loop:
for(int i=0;i<n;i++) {
int v=a[i][o];
for(int j=0;j<n;j++) if(j!=i){
if(a[j][o]==v)
continue loop;
}
r[i]+=v;
}
});
Arrays.stream(r).forEach(System.out::println);
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Arrays;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.util.Scanner;
| ^~~~~~
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.util.stream.IntStream;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
5 | public class Main{
| ^~~~~~
|
s263901412 | p00500 | C++ | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
int num[][]=new int[n][3];
for(int i=0; i<n; i++){
for(int j=0; j<3; j++){
num[i][j]=sc.nextInt();
}
}
int score[]=new int[n];
for(int i=0;i<n;i++){
score[i]=0;
}
for(int j=0; j<3; j++){
for(int i=0; i<n; i++){
for(int k=i+1; k<n; k++){
if(num[i][j]==num[k][j]){
num[i][j]=num[k][j]=0;
}
}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<3;j++){
score[i]+=num[i][j];
}
}
for(int i=0;i<n;i++){
System.out.println(score[i]);
}
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s812476728 | p00500 | C++ | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
using namespace std;
/*
const int MAX_E=2*(100-1);
const int MAX_V=100;
const long long int INF=100000000;
struct edge { int from,to,cost;};
edge es[MAX_E];
//int d[MAX_V];
int V,E;
void shortest_path(int s,int e,vector<int>& d);
int main(){
int n,k;
while(cin >> n >> k&&n!=0&&k!=0){
int V=n;
int E=2*(n-1);
vector<int> land(V);
int l=0;
for(int i=0; i<E; ++i){
es[i].cost=-1;
es[i].from=-1;
es[i].to=-1;
}
for(int i=0; i<k; ++k){
int m;
cin >> m;
if(m==0){
int a,b;
cin >> a >> b;
shortest_path(a,b,land);
cout << land[b] << "\n";
} else if(m==1){
int c,d,e;
cin >> c >> d >> e;
es[l].from=c;
es[l].to=d;
es[l].cost=e;
es[l+1].from=d;
es[l+1].to=c;
es[l+1].cost=e;
l+=2;
}
}
}
return 0;
}
void shortest_path(int s,int e,vector<int>& d){
cout << "ok1\n";
for(int i=0; i<V; ++i) {
cout << "ok\n";
d[i]=INF;
}
d[s]=0;
while(true){
cout << "ok2\n";
bool update=false;
for(int i=0; i<E; ++i){
edge e=es[i];
if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
d[e.to]=d[e.from]+e.cost;
update=true;
}
}
if(!update) break;
}
}
*/
/*
const int INF=100000000;
int main(){
int n;
while(cin >> n&&n!=0){
vector<int> color;
for(int i=0; i<n; ++i){
int t;
cin >> t;
color.push_back(t);
}
int maxDel=INF;
for(int i=0; i<n; ++i){
for(int j=1; j<=3; ++j){
if(color[i]==j) continue;
int up=i-1;
int down=i+1;
int sum=0;
int c=1;
int col=j;
while(1){
int nCal=-1;
while(1){
if(up<0) break;
if(color[up]!=col){
nCal=color[up];
break;
}
up--;
c++;
}
while(1){
if(down>=n) break;
if(color[down]!=col){
if(nCal==-1) nCal=color[down];
break;
}
++down;
++c;
}
if(c>=4){
sum+=c;
} else{
break;
}
c=0;
if(nCal==-1){
break;
}else{
col=nCal;
}
}
maxDel=min(maxDel,n-sum);
}
}
cout << maxDel << "\n";
}
return 0;
}
*/
int main(){
int n;
cin >> n;
vector< vector<int> > a(n,3);
vector<int> sum(n);
for(int i=0; i<n; ++i){
for(int j=0; j<3; ++j){
cin >> a[i][j];
}
}
for(int j=0; j<3; ++j){
for(int i=0; i<n; ++i){
bool f=true;
for(int k=0; k<n; ++k){
if(a[i][j]==a[k][j]&&i!=k){
f=false;
break;
}
}
if(f)sum[i]+=a[i][j];
}
}
for(int i=0; i<n; ++i){
cout << sum[i] << "\n";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:142:36: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int&, int)'
142 | vector< vector<int> > a(n,3);
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66,
from /usr/include/c++/14/string:47,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _InIter> using std::_RequireInputIter = std::__enable_if_t<((bool)std::is_convertible<typename std::iterator_traits< <template-parameter-1-1> >::iterator_category, std::input_iterator_tag>::value)> [with _InIter = int]':
/usr/include/c++/14/bits/stl_vector.h:705:9: required from here
705 | typename = std::_RequireInputIter<_InputIterator>>
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:252:57: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
252 | input_iterator_tag>::value>;
| ^~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<int> >'
678 | vector(initializer_list<value_type> __l,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >&&'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >&'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
569 | vector(size_type __n, const value_type& __value,
| ~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::allocator_type&' {aka 'const std::allocator<std::vector<int> >&'}
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
|
s752451127 | p00500 | C++ | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
using namespace std;
/*
const int MAX_E=2*(100-1);
const int MAX_V=100;
const long long int INF=100000000;
struct edge { int from,to,cost;};
edge es[MAX_E];
//int d[MAX_V];
int V,E;
void shortest_path(int s,int e,vector<int>& d);
int main(){
int n,k;
while(cin >> n >> k&&n!=0&&k!=0){
int V=n;
int E=2*(n-1);
vector<int> land(V);
int l=0;
for(int i=0; i<E; ++i){
es[i].cost=-1;
es[i].from=-1;
es[i].to=-1;
}
for(int i=0; i<k; ++k){
int m;
cin >> m;
if(m==0){
int a,b;
cin >> a >> b;
shortest_path(a,b,land);
cout << land[b] << "\n";
} else if(m==1){
int c,d,e;
cin >> c >> d >> e;
es[l].from=c;
es[l].to=d;
es[l].cost=e;
es[l+1].from=d;
es[l+1].to=c;
es[l+1].cost=e;
l+=2;
}
}
}
return 0;
}
void shortest_path(int s,int e,vector<int>& d){
cout << "ok1\n";
for(int i=0; i<V; ++i) {
cout << "ok\n";
d[i]=INF;
}
d[s]=0;
while(true){
cout << "ok2\n";
bool update=false;
for(int i=0; i<E; ++i){
edge e=es[i];
if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
d[e.to]=d[e.from]+e.cost;
update=true;
}
}
if(!update) break;
}
}
*/
/*
const int INF=100000000;
int main(){
int n;
while(cin >> n&&n!=0){
vector<int> color;
for(int i=0; i<n; ++i){
int t;
cin >> t;
color.push_back(t);
}
int maxDel=INF;
for(int i=0; i<n; ++i){
for(int j=1; j<=3; ++j){
if(color[i]==j) continue;
int up=i-1;
int down=i+1;
int sum=0;
int c=1;
int col=j;
while(1){
int nCal=-1;
while(1){
if(up<0) break;
if(color[up]!=col){
nCal=color[up];
break;
}
up--;
c++;
}
while(1){
if(down>=n) break;
if(color[down]!=col){
if(nCal==-1) nCal=color[down];
break;
}
++down;
++c;
}
if(c>=4){
sum+=c;
} else{
break;
}
c=0;
if(nCal==-1){
break;
}else{
col=nCal;
}
}
maxDel=min(maxDel,n-sum);
}
}
cout << maxDel << "\n";
}
return 0;
}
*/
int main(){
int n;
cin >> n;
vector< vector<int> > a(n,3);
vector<int> sum(n);
for(int i=0; i<n; ++i){
for(int j=0; j<3; ++j){
cin >> a[i][j];
}
}
for(int j=0; j<3; ++j){
for(int i=0; i<n; ++i){
bool f=true;
for(int k=0; k<n; ++k){
if(a[i][j]==a[k][j]&&i!=k){
f=false;
break;
}
}
if(f)sum[i]+=a[i][j];
}
}
for(int i=0; i<n; ++i){
cout << sum[i] << "\n";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:142:36: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int&, int)'
142 | vector< vector<int> > a(n,3);
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66,
from /usr/include/c++/14/string:47,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _InIter> using std::_RequireInputIter = std::__enable_if_t<((bool)std::is_convertible<typename std::iterator_traits< <template-parameter-1-1> >::iterator_category, std::input_iterator_tag>::value)> [with _InIter = int]':
/usr/include/c++/14/bits/stl_vector.h:705:9: required from here
705 | typename = std::_RequireInputIter<_InputIterator>>
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:252:57: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
252 | input_iterator_tag>::value>;
| ^~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<int> >'
678 | vector(initializer_list<value_type> __l,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >&&'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >&'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
569 | vector(size_type __n, const value_type& __value,
| ~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::allocator_type&' {aka 'const std::allocator<std::vector<int> >&'}
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
|
s545969129 | p00501 | Java | import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.PriorityQueue;
import java.math.BigInteger;
public class Main{
static final InputStream in=System.in;
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static final long LINF=Long.MAX_VALUE/2;
static int n;
static String str;
public static void main(String[] args) throws IOException{
InputReader ir=new InputReader(in);
n=ir.nextInt();
str=ir.next();
int len=str.length();
int cnt=0;
lo1: while(n-->0){
String old=ir.next();
lo2: for(int i=0;i<=old.length()-len;i++){
if(len.charAt(i)!=old.charAt(0)) continue;
lo3: for(int j=1;;j++){
if(i+(len-1)*j>=old.length()) continue lo2:
for(int k=0;k<len;k++){
if(str.charAt(i+j*k)!=old.charAt(k)) continue lo3;
if(k==len-1){
cnt++;
continue lo1;
}
}
}
}
}
out.println(cnt);
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in;}
public int readByte() {
if(lenbuf==-1) throw new InputMismatchException();
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}
catch (IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0)
return -1;
}
return buffer[curbuf++];
}
public boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;}
public String next() {
int b=skip();
StringBuilder sb=new StringBuilder();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public int[] toIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
}
} | Main.java:36: error: ';' expected
if(i+(len-1)*j>=old.length()) continue lo2:
^
1 error
|
s275770556 | p00501 | Java | import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.PriorityQueue;
import java.math.BigInteger;
public class Main{
static final InputStream in=System.in;
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static final long LINF=Long.MAX_VALUE/2;
static int n;
static String str;
public static void main(String[] args) throws IOException{
InputReader ir=new InputReader(in);
n=ir.nextInt();
str=ir.next();
int len=str.length();
int cnt=0;
lo1: while(n-->0){
String old=ir.next();
lo2: for(int i=0;i<=old.length()-len;i++){
if(len.charAt(i)!=old.charAt(0)) continue;
lo3: for(int j=1;;j++){
if(i+(len-1)*j>=old.length()) continue lo2;
for(int k=0;k<len;k++){
if(str.charAt(i+j*k)!=old.charAt(k)) continue lo3;
if(k==len-1){
cnt++;
continue lo1;
}
}
}
}
}
out.println(cnt);
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in;}
public int readByte() {
if(lenbuf==-1) throw new InputMismatchException();
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}
catch (IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0)
return -1;
}
return buffer[curbuf++];
}
public boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;}
public String next() {
int b=skip();
StringBuilder sb=new StringBuilder();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public int[] toIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
}
} | Main.java:34: error: int cannot be dereferenced
if(len.charAt(i)!=old.charAt(0)) continue;
^
1 error
|
s825699935 | p00501 | Java | import java.util.*;
public class main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int cnt = 0, space, work;
boolean flag;
char[] target = sc.next().toCharArray();
for(int i=0; i<n; i++){
char[] old = sc.next().toCharArray();
flag = true;
for(int j=0; j<old.length; j++){
if(target[0]==old[j]){//??????????????????????????£??????
for(int k=j+1; k<old.length; k++){
if(target[1]==old[k]){//??????????????????????????£??????
space = k-j;
if(old.length<=space*(target.length-1)+j) break;//??????????????\???????????¨????????£??????
work = k;
for(int l=2; l<target.length; l++){
work+=space;
if(old[work]!=target[l]) break;//??????????????\???????????£??????
if(l==target.length-1){
cnt++;
flag = false;//???????????£???????????§?¬?????????????
}
}
}
}
}
if(flag==false) break;
}
}
System.out.println(cnt);
}
} | Main.java:3: error: class main is public, should be declared in a file named main.java
public class main {
^
1 error
|
s701688365 | p00501 | Java | import java.util.*;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int cnt = 0, space, work;
boolean flag;
char[] target = sc.next().toCharArray();
for(int i=0; i<n; i++){
char[] old = sc.next().toCharArray();
flag = true;
for(int j=0; j<old.length; j++){
if(target[0]==old[j]){//??????????????????????????£??????
for(int k=j+1; k<old.length; k++){
if(target[1]==old[k]){//??????????????????????????£??????
space = k-j;
if(old.length<=space*(target.length-1)+j) break;//??????????????\???????????¨????????£??????
work = k;
for(int l=2; l<target.length; l++){
work+=space;
if(old[work]!=target[l]) break;//??????????????\???????????£??????
if(l==target.length-1){
cnt++;
flag = false;//???????????£???????????§?¬?????????????
}
}
}
}
}
if(flag==false) break;
}
}
System.out.println(cnt);
}
} | Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
^
(use --enable-preview to enable unnamed classes)
Main.java:44: error: class, interface, enum, or record expected
}
^
2 errors
|
s677591297 | p00501 | Java | import java.util.Scanner;
public class main {
public static boolean stringMach(char[] base,String boardStr) {
int boardStrlen = boardStr.length()-1;
int baseIndex = 0;
for(int i=0;i<boardStrlen;i++){
if(base[baseIndex]==boardStr.charAt(i)){
baseIndex++;
for(int j=i+1;j<boardStrlen;j++){
if(base[baseIndex]==boardStr.charAt(j)){
int margin = j-i;
baseIndex++;
for(int k=j+margin;k<=boardStrlen;k+=margin){
if(base[baseIndex]==boardStr.charAt(k)){
baseIndex++;
if(baseIndex==base.length){
return true;
}
}
}
}
}
}
}
return false;
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int boardNam = sc.nextInt();
String [] board = new String[boardNam];
char base[] = sc.next().toCharArray();
boolean ans[] = new boolean[boardNam];
int trueNum = 0;
for(int i=0;i<boardNam;i++){
board[i] = sc.next();
}
for(int i=0;i<boardNam;i++){
ans[i] = stringMach(base, board[i]);
if(stringMach(base, board[i])){
System.out.println(i);
trueNum++;
}
}
System.out.println(trueNum);
}
} | Main.java:2: error: class main is public, should be declared in a file named main.java
public class main {
^
1 error
|
s097981907 | p00501 | Java | import java.util.Scanner;
public class main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int boardNam = sc.nextInt();
String [] board = new String[boardNam];
char base[] = sc.next().toCharArray();
boolean ans[] = new boolean[boardNam];
int trueNum = 0;
for(int i=0;i<boardNam;i++){
board[i] = sc.next();
}
for(int i=0;i<boardNam;i++){
ans[i] = stringMach(base, board[i]);
if(stringMach(base, board[i])){
System.out.println(i);
trueNum++;
}
}
System.out.println(trueNum);
}
public static boolean stringMach(char[] base,String boardStr) {
int boardStrlen = boardStr.length()-1;
int baseIndex = 0;
for(int i=0;i<boardStrlen;i++){
if(base[baseIndex]==boardStr.charAt(i)){
baseIndex++;
for(int j=i+1;j<boardStrlen;j++){
if(base[baseIndex]==boardStr.charAt(j)){
int margin = j-i;
baseIndex++;
for(int k=j+margin;k<=boardStrlen;k+=margin){
if(base[baseIndex]==boardStr.charAt(k)){
baseIndex++;
if(baseIndex==base.length){
return true;
}
}
}
}
}
}
}
return false;
}
} | Main.java:2: error: class main is public, should be declared in a file named main.java
public class main {
^
1 error
|
s571227770 | p00501 | Java | import java.util.*;
public class AOJ578 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int cnt = 0, space, work;
boolean flag;
char[] target = sc.next().toCharArray();
for(int i=0; i<n; i++){
char[] old = sc.next().toCharArray();
flag = true;
for(int j=0; j<old.length; j++){
if(target[0]==old[j]){//??????????????????????????£??????
for(int k=j+1; k<old.length; k++){
if(target[1]==old[k]){//??????????????????????????£??????
space = k-j;
if(old.length<=space*(target.length-1)+j) break;//??????????????\???????????¨????????£??????
work = k;
for(int l=2; l<target.length; l++){
work+=space;
if(old[work]!=target[l]) break;//??????????????\???????????£??????
if(l==target.length-1){
cnt++;
flag = false;//???????????£???????????§?¬?????????????
}
}
if(flag==false) break;
}
}
}
if(flag==false) break;
}
}
System.out.println(cnt);
}
} | Main.java:3: error: class AOJ578 is public, should be declared in a file named AOJ578.java
public class AOJ578 {
^
1 error
|
s371781323 | p00501 | Java |
import java.util.Scanner;
public class SignBoard {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int i, cnt = 0;
int N = sc.nextInt();
String name = sc.next();
String[] kanban = new String[N];
for(i=0; i<N; i++)kanban[i] = sc.next();
for(i=0; i<N; i++){
String board = kanban[i];
cnt += Check(name, board);
}
System.out.println(cnt);
}
public static int Check(String name, String board){
int i, j, k, x, y = 0, yy = 0, space;
char[] nameC = name.toCharArray();
A: for(i=0; i<board.length(); i++){
x = board.indexOf(nameC[0], i);
if(x<0)return 0;
for(j=0; j+i<board.length(); j++){
if(y == 0){
y = board.indexOf(nameC[1], x);
yy = y;
}
else y = board.indexOf(nameC[1], yy);
yy += y;
if(y<0)return 0;
space = y - x;
for(k=0; k+2<name.length(); k++){
if(board.indexOf(nameC[k+2]) < 0)continue A;
if(board.indexOf(nameC[k+2]) -board.indexOf(nameC[k+1]) !=space)continue A;
if(k+2 == name.length() -1)return 1;
}
}
}
return 0;
}
} | Main.java:4: error: class SignBoard is public, should be declared in a file named SignBoard.java
public class SignBoard {
^
1 error
|
s651061553 | p00501 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int i, cnt = 0;
boolean flag = false;
int N = sc.nextInt();
String name = sc.next();
String[] board = new String[N];
for(i=0; i<N; i++)board[i] = sc.next();
int num, j, k, x, y=0, yy = 0, space = 0;
char[] nameC = name.toCharArray();
A: for(num=0; num<board.length; num++){
B: for(i=0; i<board[num].length(); i++){
x = board[num].indexOf(nameC[0], i);
if(x<0)continue A;
for(j=0; j+i<board[num].length(); j++){
if(y == 0){
y = board[num].indexOf(nameC[1], x);
yy = y;
}
else y = board[num].indexOf(nameC[1], yy);
yy = y;
if(y<0)continue B;
space = y - x;
for(k=0, z=space+y ; k+2<name.length(); z+=space, k++){
flag = false;
if(board[num].indexOf(nameC[k+2]) -board[num].indexOf(nameC[k+1]) == space){
flag = true;
if(k+2 == name.length() -1){
cnt++;
continue A;
}
}
if(flag = false)break;
}
}
}
}
System.out.println(cnt);
}
} | Main.java:30: error: cannot find symbol
for(k=0, z=space+y ; k+2<name.length(); z+=space, k++){
^
symbol: variable z
location: class Main
Main.java:30: error: cannot find symbol
for(k=0, z=space+y ; k+2<name.length(); z+=space, k++){
^
symbol: variable z
location: class Main
2 errors
|
s687721889 | p00501 | Java | import java.util.Scanner;
??
public class Main{
??
????????public static void main(String[] args) {
????????????????// TODO Auto-generated method stub
????????????????Scanner sc = new Scanner(System.in);
????????????????int bannum = sc.nextInt();
????????????????String keyword = sc.next();
????????????????String kanban;
????????????????int cnt = 2;
????????????????int knum = 0;
????????????????for(int s = 0;s < bannum;s++){
????????????????????????kanban = sc.next();
????????????????????????loop:for(int i = 0; kanban.length()-i > keyword.length()-1;i++){
????????????????????????????????if(keyword.charAt(0) == kanban.charAt(i)){
????????????????????????????????????????for(int j = kanban.length()-1;j-i>=keyword.length()-1;j--){
????????????????????????????????????????????????if(keyword.charAt(keyword.length()-1) == kanban.charAt(j)){
????????????????????????????????????????????????????????cnt = 2;
????????????????????????????????????????????????????????for(int k = 1;k <= keyword.length()-1;k++){
????????????????????????????????????????????????????????????????//System.out.println(keyword.charAt(k));
????????????????????????????????????????????????????????????????//System.out.println(kanban.charAt((j-i)/(keyword.length()-1)*k+i));
????????????????????????????????????????????????????????????????if(keyword.charAt(k) == kanban.charAt((j-i)/(keyword.length()-1)*k+i)){
????????????????????????????????????????????????????????????????????????cnt++;
????????????????????????????????????????????????????????????????????????if(cnt-1 == keyword.length()){
????????????????????????????????????????????????????????????????????????????????knum++;
????????????????????????????????????????????????????????????????????????????????break loop;
????????????????????????????????????????????????????????????????????????}????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????}
????????????????????????????????????????????????????????}
????????????????????????????????????????????????}
????????????????????????????????????????}
????????????????????????????????}
????????????????????????}????????????????????
????????????????}
????????????????System.out.println(knum);
/*?????????? if(cnt-1 == keyword.length()){
????????????????????????System.out.print("??????£??????");
????????????????}
????????*/??
??????????????????
????????}
??
} | Main.java:2: error: class, interface, enum, or record expected
??
^
Main.java:4: error: illegal start of type
??
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: : expected
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: : expected
????????????????Scanner sc = new Scanner(System.in);
^
36 errors
printing javac parameters to: /w/javac.20260128_024353.args
|
s803044183 | p00501 | Java | import java.util.Scanner;
??
public class Main{
??
????????public static void main(String[] args) {
????????????????// TODO Auto-generated method stub
????????????????Scanner sc = new Scanner(System.in);
????????????????int bannum = sc.nextInt();
????????????????String keyword = sc.next();
????????????????String kanban;
????????????????int cnt = 2;
????????????????int knum = 0;
????????????????for(int s = 0;s < bannum;s++){
????????????????????????kanban = sc.next();
????????????????????????loop:for(int i = 0; kanban.length()-i > keyword.length()-1;i++){
????????????????????????????????if(keyword.charAt(0) == kanban.charAt(i)){
????????????????????????????????????????for(int j = kanban.length()-1;j-i>=keyword.length()-1;j--){
????????????????????????????????????????????????if(keyword.charAt(keyword.length()-1) == kanban.charAt(j)){
????????????????????????????????????????????????????????cnt = 2;
????????????????????????????????????????????????????????for(int k = 1;k <= keyword.length()-1;k++){
????????????????????????????????????????????????????????????????//System.out.println(keyword.charAt(k));
????????????????????????????????????????????????????????????????//System.out.println(kanban.charAt((j-i)/(keyword.length()-1)*k+i));
????????????????????????????????????????????????????????????????if(keyword.charAt(k) == kanban.charAt((j-i)/(keyword.length()-1)*k+i)){
????????????????????????????????????????????????????????????????????????cnt++;
????????????????????????????????????????????????????????????????????????if(cnt-1 == keyword.length()){
????????????????????????????????????????????????????????????????????????????????knum++;
????????????????????????????????????????????????????????????????????????????????break loop;
????????????????????????????????????????????????????????????????????????}????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????}
????????????????????????????????????????????????????????}
????????????????????????????????????????????????}
????????????????????????????????????????}
????????????????????????????????}
????????????????????????}????????????????????
????????????????}
????????????????System.out.println(knum);??????????????????
????????}
??
} | Main.java:2: error: class, interface, enum, or record expected
??
^
Main.java:4: error: illegal start of type
??
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: : expected
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: : expected
????????????????Scanner sc = new Scanner(System.in);
^
36 errors
printing javac parameters to: /w/javac.20260128_024353.args
|
s137915574 | p00501 | Java | import java.util.Scanner;
??
public class Main{
??
????????public static void main(String[] args) {
????????????????// TODO Auto-generated method stub
????????????????Scanner sc = new Scanner(System.in);
????????????????int bannum = sc.nextInt();
????????????????String keyword = sc.next();
????????????????String kanban;
????????????????int cnt = 2;
????????????????int knum = 0;
????????????????for(int s = 0;s < bannum;s++){
????????????????????????kanban = sc.next();
????????????????????????loop:for(int i = 0; kanban.length()-i > keyword.length()-1;i++){
????????????????????????????????if(keyword.charAt(0) == kanban.charAt(i)){
????????????????????????????????????????for(int j = kanban.length()-1;j-i>=keyword.length()-1;j--){
????????????????????????????????????????????????if(keyword.charAt(keyword.length()-1) == kanban.charAt(j)){
????????????????????????????????????????????????????????cnt = 2;
????????????????????????????????????????????????????????for(int k = 1;k <= keyword.length()-1;k++){
????????????????????????????????????????????????????????????????//System.out.println(keyword.charAt(k));
????????????????????????????????????????????????????????????????//System.out.println(kanban.charAt((j-i)/(keyword.length()-1)*k+i));
????????????????????????????????????????????????????????????????if(keyword.charAt(k) == kanban.charAt((j-i)/(keyword.length()-1)*k+i)){
????????????????????????????????????????????????????????????????????????cnt++;
????????????????????????????????????????????????????????????????????????if(cnt-1 == keyword.length()){
????????????????????????????????????????????????????????????????????????????????knum++;
????????????????????????????????????????????????????????????????????????????????break loop;
????????????????????????????????????????????????????????????????????????}????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????}
????????????????????????????????????????????????????????}
????????????????????????????????????????????????}
????????????????????????????????????????}
????????????????????????????????}
????????????????????????}????????????????????
????????????????}
????????????????System.out.println(knum);??????????????????
????????}
} | Main.java:2: error: class, interface, enum, or record expected
??
^
Main.java:4: error: illegal start of type
??
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:6: error: illegal start of expression
????????????????// TODO Auto-generated method stub
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: illegal start of expression
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: : expected
????????????????Scanner sc = new Scanner(System.in);
^
Main.java:7: error: : expected
????????????????Scanner sc = new Scanner(System.in);
^
36 errors
printing javac parameters to: /w/javac.20260128_024353.args
|
s496521231 | p00501 | Java | package spring;
import java.util.Scanner;
public class Signboard {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String name = sc .next();
int count =0;
for(int x=0; x<N; x++){
String oldname = sc.next();
label:for(int a=0; a<oldname.length(); a++){
if(name.charAt(0) == oldname.charAt(a));
int b=1;
if(name.charAt(1) == oldname.charAt(b));
int c=b-a;
for(int d=b+c; d<oldname.length(); d+=c) {
if(name.charAt(3)==oldname.charAt(d)) break;
else {
if(name.charAt(name.length()-1)==d) {
count++;
break label;
}
d++;
}
}
}
}
System.out.println(count);
}
}
| Main.java:4: error: class Signboard is public, should be declared in a file named Signboard.java
public class Signboard {
^
1 error
|
s771584792 | p00501 | Java | package spring;
import java.util.Scanner;
public class Signboard {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String name = sc .next();
int count =0;
for(int x=0; x<N; x++){
String oldname = sc.next();
label:for(int a=0; a<oldname.length()-1; a++){
if(name.charAt(0) != oldname.charAt(a));
int b=1;
if(name.charAt(1) != oldname.charAt(b));
int c=b-a;
for(int d=b+c; d<oldname.length(); d+=c) {
if(name.charAt(3)!=oldname.charAt(d)) break;
else {
if(name.charAt(d)==name.length()-1) {
count++;
break label;
}
d++;
}
}
}
}
System.out.println(count);
}
}
| Main.java:4: error: class Signboard is public, should be declared in a file named Signboard.java
public class Signboard {
^
1 error
|
s423687237 | p00501 | Java | public class Main {
char[] target;
int cnt=0;
void check(char[] o){
int space, work;
boolean flag;
for(int j=0; j<o.length; j++){
flag=true;
if(target[0]==o[j]){//??????????????????????????£??????
for(int k=j+1; k<o.length; k++){
if(target[1]==o[k]){//??????????????????????????£??????
space = k-j;
if(o.length<=space*(target.length-1)+j) break;//??????????????\???????????¨????????£??????
work = k;
for(int l=2; l<target.length; l++){
work+=space;
if(o[work]!=target[l]) break;//??????????????\???????????£??????
if(l==target.length-1){
cnt++;
flag = false;//???????????£???????????§?¬?????????????
}
}
if(flag==false) break;
}
}
}
if(flag==false) break;
}
}
void doIt(){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int cnt = 0;
target = sc.next().toCharArray();
char[] old;
for(int i=0; i<n; i++){
old = sc.next().toCharArray();
new Main().check(old);
}
System.out.println(cnt);
}
public static void main(String[] args){
new Main().doIt();
}
} | Main.java:38: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:38: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s342480714 | p00501 | Java | package sd_kadai_3;
import java.util.Scanner;
public class Main {
char[] target;
int cnt=0;
void check(char[] o){
int space, work;
boolean flag;
for(int j=0; j<o.length; j++){
flag=true;
if(target[0]==o[j]){//??????????????????????????£??????
for(int k=j+1; k<o.length; k++){
if(target[1]==o[k]){//??????????????????????????£??????
space = k-j;
if(o.length<=space*(target.length-1)+j) break;//??????????????\???????????¨????????£??????
work = k;
for(int l=2; l<target.length; l++){
work+=space;
if(o[work]!=target[l]) break;//??????????????\???????????£??????
if(l==target.length-1){
cnt++;
flag = false;//???????????£???????????§?¬?????????????
}
}
if(flag==false) break;
}
}
}
if(flag==false) break;
}
}
void doIt(){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
target = sc.next().toCharArray();
char[] old;
for(int i=0; i<n; i++){
old = sc.next().toCharArray();
new Main().check(old);
}
System.out.println(cnt);
}
public static void main(String[] args){
new Main().doIt();
retrun 0;
}
} | Main.java:57: error: not a statement
retrun 0;
^
Main.java:57: error: ';' expected
retrun 0;
^
2 errors
|
s618797861 | p00501 | Java | gimport java.io.*;
import java.util.*;
import java.util.regex.*;
public class Main {
BufferedReader br;
Main() {
br = new BufferedReader(new InputStreamReader(System.in));
}
public static void main(String[] args) {
new Main().run();
}
void debug(Object ... o) {
System.out.println(Arrays.deepToString(o));
}
int N;
String in;
String [] cand;
void init() {
try {
N = Integer.parseInt(br.readLine());
cand = new String[N];
in = br.readLine();
for (int i = 0; i < N; i++) cand[i] = br.readLine();
} catch (Exception e) {}
}
void run() {
init();
int c = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < 20; j++) {
StringBuilder sb = new StringBuilder();
sb.append(".*");
sb.append(in.charAt(0));
for (int k = 1; k < in.length(); k++) {
for (int l = 0; l < j; l++) sb.append('.');
sb.append(in.charAt(k));
}
sb.append(".*");
String pattern = sb.toString();
if (Pattern.matches(pattern, cand[i])) {
c++;
break;
}
}
}
System.out.println(c);
}
} | Main.java:1: error: class, interface, enum, or record expected
gimport java.io.*;
^
Main.java:2: error: class, interface, enum, or record expected
import java.util.*;
^
Main.java:3: error: class, interface, enum, or record expected
import java.util.regex.*;
^
3 errors
|
s727835270 | p00501 | Java | import java.util.*;
public class signboard {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ans = 0;
String tar = sc.next();
for(int i=0;i<n;i++){
String s = sc.next();
if(search(tar,s)){
ans++;
}
}
System.out.println(ans);
}
static boolean search(String tar , String str){
int keylen=tar.length();
int len=str.length();
int s=0;
boolean cntflg=true;
//現在検索している文字
for(int j=0;j<=len-keylen;j++){
//ターゲットの先頭文字と一致する文字をstrから探す
if(tar.charAt(0)==str.charAt(j)){
//System.out.println("first;"+j);
//空白をあけて文字列を検索
for(int leap=1;leap<=(len-j-1)/(keylen-1);leap++){
s=1;
cntflg=true;
int h=j;
for(s=1;s<keylen;s++){
h+=leap;
if(tar.charAt(s)==str.charAt(h)){
s++;
}else{
cntflg=false;
break;
}
}
//ずっとフラグがtrueのままだったなら文字列が存在する
if(cntflg)return true;
}
}
}
return false;
}
} | Main.java:3: error: class signboard is public, should be declared in a file named signboard.java
public class signboard {
^
1 error
|
s548687196 | p00501 | Java | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
//new AOJ0578().run();
new Main().run
}
void run(){
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
int count=0;
char name[]=sc.next().toCharArray();
char old[][]=new char[n][];
//いい名前が思い浮かばなかった。
//temp[i]はつくりたい看板のi文字目がoldの何文字目にあったかを入れておく.
int temp[]=new int[name.length];
for(int i=0; i<n; i++){
old[i]=sc.next().toCharArray();
}
for(int i=0; i<n; i++){
for(int j=0; j<old[i].length; j++){
if(name[0]==old[i][j]){
//なんか関数を呼ぶ
if(signBord(name, old[i], j, 0, temp)){
//System.out.println(i+" "+String.valueOf(old[i]));
count++;
break;
}
}
}
}
System.out.println(count);
}
}
boolean signBord(char name[],char old[],int k,int d, int temp[]){
temp[d]=k;
if(name.length-1 <= d){
for(int i=0; i+2<name.length; i++){
if(temp[i+1]-temp[i] != temp[i+2]-temp[i+1]){
return false;
}
}
return true;
}
boolean f;
for(int j=k+1; j<old.length; j++){
if(name[d+1]==old[j]){
if(signBord(name, old, j, d+1, temp)){
return true;
}
}
}
return false;
}
} | Main.java:8: error: not a statement
new Main().run
^
Main.java:8: error: ';' expected
new Main().run
^
2 errors
|
s227198243 | p00501 | Java | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO ティツ?ェテ・ツ仰陛ァツ板淌ヲツ按静」ツ?陛」ツつ古」ツ?淌」ツδ。テ」ツつステ」ツδε」ツδ嘉」ツδサテ」ツつケテ」ツつソテ」ツδ?
//new AOJ0578().run();
new Main().run
}
void run(){
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
int count=0;
char name[]=sc.next().toCharArray();
char old[][]=new char[n][];
//テ」ツ??」ツ??・ツ青催・ツ可催」ツ?古ヲツ?敕」ツ??ヲツオツョテ」ツ?凝」ツ?ーテ」ツ?ェテ」ツ?凝」ツ?」テ」ツ?淌」ツ??
//temp[i]テ」ツ?ッテ」ツ?、テ」ツ?湘」ツつ甘」ツ?淌」ツ??ァツ慊凝ヲツ敖ソテ」ツ?ョiテヲツ鳴?・ツュツ療ァツ崢ョテ」ツ?経ldテ」ツ?ョテ、ツスツ陛ヲツ鳴?・ツュツ療ァツ崢ョテ」ツ?ォテ」ツ?づ」ツ?」テ」ツ?淌」ツ?凝」ツつ津・ツ?・テ」ツつ古」ツ?ヲテ」ツ?甘」ツ??
int temp[]=new int[name.length];
for(int i=0; i<n; i++){
old[i]=sc.next().toCharArray();
}
for(int i=0; i<n; i++){
for(int j=0; j<old[i].length; j++){
if(name[0]==old[i][j]){
//テ」ツ?ェテ」ツつ禿」ツ?凝ゥツ鳴「テヲツ閉ーテ」ツつ津・ツ堕シテ」ツ?カ
if(signBord(name, old[i], j, 0, temp)){
//System.out.println(i+" "+String.valueOf(old[i]));
count++;
break;
}
}
}
}
System.out.println(count);
}
}
boolean signBord(char name[],char old[],int k,int d, int temp[]){
temp[d]=k;
if(name.length-1 <= d){
for(int i=0; i+2<name.length; i++){
if(temp[i+1]-temp[i] != temp[i+2]-temp[i+1]){
return false;
}
}
return true;
}
for(int j=k+1; j<old.length; j++){
if(name[d+1]==old[j]){
if(signBord(name, old, j, d+1, temp)){
return true;
}
}
}
return false;
}
} | Main.java:8: error: not a statement
new Main().run
^
Main.java:8: error: ';' expected
new Main().run
^
2 errors
|
s920424624 | p00501 | Java | import java.util.Scanner;
public class aoj0578 {
public static void main(String[] args){
new aoj0578().run();
}
void run(){
Scanner in = new Scanner(System.in);
int k = in.nextInt();
int count = 0;
char name[]=in.next().toCharArray();
int cnt[] = new int [name.length];
char yobi[][] = new char [k][];
for(int i = 0;i < k;i++){
yobi[i]=in.next().toCharArray();
}
for(int i = 0;i < k;i++){
for(int j=0; j<yobi[i].length; j++){
if(name[0]==yobi[i][j]){
if(barname(name,yobi[i],j,0,cnt)){
count++;
break;
}
}
}
}
System.out.println(count);
}
boolean barname(char name[],char yobi[],int j,int v,int cnt[]){
cnt[v]=j;
if(name.length-1 <= v){
for(int k=0; k+2<name.length; k++){
if(cnt[k+1]-cnt[k] != cnt[k+2]-cnt[k+1]){
return false;
}
}
return true;
}
for(int l=j+1; l<yobi.length; l++){
if(name[v+1]==yobi[l]){
if(barname(name, yobi, l, v+1, cnt)){
return true;
}
}
}
return false;
}
} | Main.java:3: error: class aoj0578 is public, should be declared in a file named aoj0578.java
public class aoj0578 {
^
1 error
|
s123108786 | p00501 | Java | import java.util.Scanner;
public class practice {
public static void Main(String[] args) {
new practice().run();
}
void run(){
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
int count=0;
char name[]=sc.next().toCharArray();
char old[][]=new char[n][];
int temp[]=new int[name.length];
for(int i=0; i<n; i++){
old[i]=sc.next().toCharArray();
}
for(int i=0; i<n; i++){
for(int j=0; j<old[i].length; j++){
if(name[0]==old[i][j]){
if(signBord(name, old[i], j, 0, temp)){
count++;
break;
}
}
}
}
System.out.println(count);
}
}
boolean signBord(char name[],char old[],int k,int d, int temp[]){
temp[d]=k;
if(name.length-1 <= d){
for(int i=0; i+2<name.length; i++){
if(temp[i+1]-temp[i] != temp[i+2]-temp[i+1]){
return false;
}
}
return true;
}
for(int j=k+1; j<old.length; j++){
if(name[d+1]==old[j]){
if(signBord(name, old, j, d+1, temp)){
return true;
}
}
}
return false;
}
} | Main.java:3: error: class practice is public, should be declared in a file named practice.java
public class practice {
^
1 error
|
s976961638 | p00501 | Java | public class Main {
public static void main(String[] args) {
java.util.Scanner in = new java.util.Scanner(System.in);
int n = in.nextInt();
String name = in.next();
int cnt = 0; //当てはまる個数
for (int i=0; i<n; i++) {
String board = in.next(); //古い看板
for(int k=0; k<board.length();k++) {
if (name.charAt(0) == board.charAt(k)) {
int same1 = k; // nameと1文字目が同じ添字を格納
int same2 = 0;
for (int l=k+1; l<board.length(); l++) {
if (name.charAt(1) == board.charAt(l)) {
same2 = l; //nameと2文字目が同じ添字を格納
break;
}
}
int diffe = same2 - same1; //文字間隔
for (int l=2; l<name.length();l++) {
if (same2 + diffe*(l-1) < board.length())
if (name.charAt(l) == board.charAt(same2 + diffe*(l-1))) {
if (l == name.length()-1)
cnt++;
}
else break;
}
}
}
}
System.out.println(cnt);
} | Main.java:32: error: reached end of file while parsing
}
^
1 error
|
s146948951 | p00501 | C | #include<stdio.h>
#include<string.h>
int main(void)
{
int len,n,i,j,k,l,flg,flg2,cnt;
char s[26],str[100][101];
scanf("%d",&n);
scanf("%d",s);
for(i=0;i<n;i++){
scanf("%s",str[i]);
}
for(i=0;i<n;i++){
len=strlen(str[i]);
flg=0;
for(j=0;j<len;j++){
for(k=1;k<len;k++){
flg2=1; cnt=0;
for(l=j;l<len;l+=k){
if(s[cnt]!=str[i][l]){
flg2=0;
break;
}
}
if(flg2==1 | main.c: In function 'main':
main.c:24:43: error: expected ')' at end of input
24 | if(flg2==1
| ~ ^
| )
main.c:24:33: error: expected declaration or statement at end of input
24 | if(flg2==1
| ^~
main.c:24:33: error: expected declaration or statement at end of input
main.c:24:33: error: expected declaration or statement at end of input
main.c:24:33: error: expected declaration or statement at end of input
|
s585992640 | p00501 | C | #include<stdio.h>
#include<string.h>
#define rep(i,X) for(i=0;i<X;i++)
n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A); | main.c:4:1: warning: data definition has no type or storage class
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:4:3: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:9: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:16: error: type defaults to 'int' in declaration of 'C' [-Wimplicit-int]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:18: error: type defaults to 'int' in declaration of 'S' [-Wimplicit-int]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:20: error: type defaults to 'int' in declaration of 'A' [-Wimplicit-int]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:22: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:24: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:26: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:28: error: type defaults to 'int' in declaration of 'l' [-Wimplicit-int]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:30: error: return type defaults to 'int' [-Wimplicit-int]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^~~~
main.c: In function 'main':
main.c:4:30: error: type of 'tab' defaults to 'int' [-Wimplicit-int]
main.c:4:68: error: passing argument 1 of 'strlen' from incompatible pointer type [-Wincompatible-pointer-types]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
| |
| int *
In file included from main.c:2:
/usr/include/string.h:407:35: note: expected 'const char *' but argument is of type 'int *'
407 | extern size_t strlen (const char *__s)
| ~~~~~~~~~~~~^~~
main.c:4:103: error: passing argument 1 of 'strlen' from incompatible pointer type [-Wincompatible-pointer-types]
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
| |
| int *
/usr/include/string.h:407:35: note: expected 'const char *' but argument is of type 'int *'
407 | extern size_t strlen (const char *__s)
| ~~~~~~~~~~~~^~~
main.c:4:1: error: expected declaration or statement at end of input
4 | n,c[27],s[102],C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
|
s086166595 | p00501 | C | #include<stdio.h>
#include<string.h>
#define rep(i,X) for(i=0;i<X;i++)
char s[102],c[27];n,C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A); | main.c:4:19: warning: data definition has no type or storage class
4 | char s[102],c[27];n,C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:19: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:4:21: error: type defaults to 'int' in declaration of 'C' [-Wimplicit-int]
4 | char s[102],c[27];n,C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:23: error: type defaults to 'int' in declaration of 'S' [-Wimplicit-int]
4 | char s[102],c[27];n,C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:25: error: type defaults to 'int' in declaration of 'A' [-Wimplicit-int]
4 | char s[102],c[27];n,C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:27: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
4 | char s[102],c[27];n,C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:29: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
4 | char s[102],c[27];n,C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:31: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
4 | char s[102],c[27];n,C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:33: error: type defaults to 'int' in declaration of 'l' [-Wimplicit-int]
4 | char s[102],c[27];n,C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^
main.c:4:35: error: return type defaults to 'int' [-Wimplicit-int]
4 | char s[102],c[27];n,C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^~~~
main.c: In function 'main':
main.c:4:35: error: type of 'tab' defaults to 'int' [-Wimplicit-int]
main.c:4:1: error: expected declaration or statement at end of input
4 | char s[102],c[27];n,C,S,A,i,j,k,l;main(tab){scanf("%d%s",&n,c);C=strlen(c);rep(i,n){scanf("%s",s);S=strlen(s);rep(j,S){if(s[j]-c[0])continue;rep(k,199){tab=k+1;rep(l,199){if(l>=C){l=1;break;}if(j+tab*l>=S || s[j+tab*l]-c[l]){l=0;break;}}if(l){A++;goto E;}}}E:;}C=!printf("%d\n",A);
| ^~~~
|
s801313003 | p00501 | C++ | #include "stdafx.h"
int n,size_n;
int size_b[100];
char name[26];
char board[100][101];
int check(int a, int start, int interval,int i) {//a目的のなんもじめかstartボードの何文字目か
if (start > size_b[i]) {
return 0;
}
if (name[a] == board[i][start]) {
if (a == size_n-1) {
printf("numis_%dlastis_%d\n", interval,start);
return 1;
}
return check(a+1, start + interval, interval,i);
}
return 0;
}
int main()
{
int end=0;
int a;
int c = 0;
scanf("%d", &n);
scanf("%s", name,sizeof(name));
for (int i = 0; i < 26; i++) {
if (name[i] == '\0')size_n=i;
}
for (int i = 0; i < n; i++) {
scanf("%s", board[i], sizeof(board));
for (int j = 0; j < 100; j++) {
if (board[i][j] == '\0')size_b[i] = j;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < size_b[i]; j++) {//start
for (int k = 1; k < size_b[i]; k++) {//interval
a = 0;
if (check(a, j, k, i) == 1) {
c++;
end = 1;
}
if (end == 1) {
break;
}
}
if (end == 1) {
end = 0;
break;
}
}
}
printf("%d\n", c);
return 0;
}
| a.cc:1:10: fatal error: stdafx.h: No such file or directory
1 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s718062537 | p00501 | C++ | /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
| |
s095957765 | p00501 | C++ | #include <stdio.h>
#include <string.h>
int main(void) {
int N;
char shop_name[100];
char old_board[200];
int cut_i,cut_j,cut_k;
int count;
int board_num;
int len;
int mise_length;
int hantei1,hantei2;
scanf("%d",&N);
scanf("%s",shop_name);
shop_len=strlen(shop_name);
count=0;
for(board_num=0;board_num<N;board_num++) {
scanf("%s",old_board);
len=strlen(old_board);
hantei2=0;
for(cut_i=0;cut_i<len;cut_i++) {
for(cut_j=1;cut_j<leng;cut_j++) {
if(cut_i+cut_j*(shop_len-1)>=len)break;
hantei1=1;
for(cut_k=0;cut_k<shop_len && hantei1;cut_k++) {
if(old_board[cut_i+cut_j*cut_k]!=shop_name[cut_k])hantei1=0;
}
if(hantei2)hantei1=1;
}
}
if(hantei1)count++;
}
printf("%d\n",count);
return 0;
} | a.cc: In function 'int main()':
a.cc:17:5: error: 'shop_len' was not declared in this scope
17 | shop_len=strlen(shop_name);
| ^~~~~~~~
a.cc:28:31: error: 'leng' was not declared in this scope; did you mean 'len'?
28 | for(cut_j=1;cut_j<leng;cut_j++) {
| ^~~~
| len
|
s414044594 | p00501 | C++ | #include <stdio.h>
#include <string.h>
int main(void) {
int N;
char shop_name[100];
char old_board[200];
int cut_i,cut_j,cut_k;
int count;
int board_num;
int len;
int mise_length;
int hantei1,hantei2;
scanf("%d",&N);
scanf("%s",shop_name);
shop_len=strlen(shop_name);
count=0;
for(board_num=0;board_num<N;board_num++) {
scanf("%s",old_board);
len=strlen(old_board);
hantei2=0;
for(cut_i=0;cut_i<len;cut_i++) {
for(cut_j=1;cut_j<len;cut_j++) {
if(cut_i+cut_j*(shop_len-1)>=len)break;
hantei1=1;
for(cut_k=0;cut_k<shop_len && hantei1;cut_k++) {
if(old_board[cut_i+cut_j*cut_k]!=shop_name[cut_k])hantei1=0;
}
if(hantei2)hantei1=1;
}
}
if(hantei1)count++;
}
printf("%d\n",count);
return 0;
} | a.cc: In function 'int main()':
a.cc:17:5: error: 'shop_len' was not declared in this scope
17 | shop_len=strlen(shop_name);
| ^~~~~~~~
|
s534678525 | p00501 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
void main(){
int N, c = 0, ns;
string n, s;
cin >> N >> n;
ns = n.length();
while (N--){
string s;
cin >> s;
if ([&](){
for (int i = 0; i < s.length(); i++)
if (s[i] == n[0])
for (int p = 1;; p++){
if (i + p*(ns - 1) >= s.length()) break;
for (int h = 1; h < ns; h++)
if (s[i + p * h] != n[h]) break;
else if (h == ns - 1) return true;
}
return false;
}()
) c++;
}
printf("%d\n", c);
} | a.cc:6:1: error: '::main' must return 'int'
6 | void main(){
| ^~~~
|
s198418947 | p00501 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int N, c=0, ns;
string n, s;
cin>>N>>n;
ns = n.length();
while (N--){
string s;
cin>>s;
if ([&](){
for (int i=0;i<s.length();++i)
if(s[i] == n[0])
for(int p=1;;++p){
if(i+p*(ns-1)>= s.length())break;
for(int h=1;h<ns;h++)
if(s[i+p*h]!=n[h])break;
else if (h==ns-1return true;
}
return false;
}()
)c++;
}
cout << c << endl;
} | a.cc: In lambda function:
a.cc:21:16: error: unable to find numeric literal operator 'operator""return'
21 | else if (h==ns-1return true;
| ^~~~~~~
a.cc:22:1: error: expected primary-expression before '}' token
22 | }
| ^
a.cc:21:29: error: expected ')' before '}' token
21 | else if (h==ns-1return true;
| ~ ^
| )
22 | }
| ~
a.cc:22:1: error: expected primary-expression before '}' token
22 | }
| ^
|
s792778541 | p00501 | C++ | #include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
#define str to_string
#define rep(i, n) for (int i=0; i<int(n); i++)
#define all(c) (c).begin(), (c).end()
#define MAX_N 101
int N;
char name[30]; // .{3,25}
int len_name;
// buf??§`name`????????????????????????
bool solve(char *buf) {
int len_buf = strlen(buf);
if (len_buf < len_name) return false;
int t = len_buf;
for (int offset=0; offset<len_buf; offset++) {
if (buf[offset] != name[0]) continue;
for (int size=1; size<t; size++) {
rep(i, len_name) {
// if ((offset + i*size) < len_buf) goto PASS;
if (buf[offset+i*size] != name[i]) goto PASS;
}
return true;
PASS:
;
}
}
return false;
}
int main() {
cin >> N;
cin >> name;
len_name = strlen(name);
char buf[30];
int answer = 0;
rep(i, N) {
memset(buf, 0, 30);
cin >> buf;
if (solve(buf)) answer++;
}
cout << answer << '\n';
return 0;
} | a.cc: In function 'bool solve(char*)':
a.cc:21:17: error: 'strlen' was not declared in this scope
21 | int len_buf = strlen(buf);
| ^~~~~~
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: In function 'int main()':
a.cc:46:14: error: 'strlen' was not declared in this scope
46 | len_name = strlen(name);
| ^~~~~~
a.cc:46:14: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:52:5: error: 'memset' was not declared in this scope
52 | memset(buf, 0, 30);
| ^~~~~~
a.cc:52:5: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s632810812 | p00501 | C++ | #include <iostream>
#include <string>
using namespace std;
int main()
{
int n; cin >> n;
string S; cin >> S;
int cnt = 0;
for (int i = 0; i < n; ++i) {
string si; cin >> si;
int len = si.length();
for (int j = 0; j < len; ++j) {
int f = 0;
for (int k = 1; k < len; ++k) {
string s = "";
for (int l = j; l < len; l += k) {
s += si[l];
if (s == S) {
f = 1;
cnt++;
}
if (f) break;
if (s.length >= len) break;
}
if (f) break;
}
if (f) break;
}
}
cout << cnt << endl;
} | a.cc: In function 'int main()':
a.cc:27:27: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
27 | if (s.length >= len) break;
| ~~^~~~~~
| ()
|
s321640778 | p00501 | C++ | 100
jyg
isuuszxoybgcpzxyrzogjmnqyokphyyilxfiegrjybpwvkfriyoefqfyyfbsstflqkdgsgfihugybsdpgoczplbjoztohxbu
koguduuocgyzjgmlbxbndjpmsueaqhwinpwulnnpsnidiuajkhsftbxjinbkiwaushetxijjoclsaceykyacjbiyrrpp
psghghahtxsyrgwshrsniteqwhrelyebdlfkqlcqvgyzpjumhkwtujgmdicfxfgdiiipfpabgymgoyobrrbmgtgqnzlxfgjplyg
dujpzfehobjgdyvxupqaygmjlijubgieitttdsycgyyprepifbnsllvxljvmzbikxvnidovtghrsyatsigcdmnjidbt
vsxfrjkyiryndyjwlrwundagaqpqbmrcejerbeuvqzqxmomadpgeahkubhevydxccyoywvxayqamrpbdgjbgcqjpdbravrykzg
gajrjaqokjggeyjxdzguyfysstkyfganujnsltlsgpusjyjuxygspnrggjnywosyrtfhvhvsijmeayfpdgbuyfnbzcb
dcbihioeaqsujjywjbyrmagjcwkjjnsoayjkgixmtyamdglrpggfyxgpkbyjkynklxmjnygugtdzmugjwqgcbjnfxpt
kyyljnosmnqzpcgoggjqrfugpkyttfhnpfbbxtwrqosiwymjxhczqihawgggqrzszlvaihzbqcqkpoxnjavmmeeajublkyyf
muycqprofyzzfgxqzlqcepvfaxgiyjgyjcmnzpbfjbszdgolynqypejijwsawhaevbuiowlpglhtdyaceuqikqnnggjjmcpi
vgptelyeyyxfmmjjsbxpmyrqefdzlmjhjosrfynwpisfygsdogvyoyjkttgtgjqlpjzrrcrjbyogmnmyycatgamzguyojlovabs
gkjjkuqjdohfnjjaefaqqmvusmxhvlzvjjguzoqjguaujwqaycvyyhhyuvgswugerjwtejsmyfgplxdijawcgeggqngtlyygir
jjehmoaekvfykdjmkqdrzsjwudjhgagqtcygfhiwhklxtdprhqduylaultdeygyiygzlbywcojmidywckltxovmpcxpedynxb
drxkwtyqkylwvdlnobkcpyjqhpxtayfxfdxmmukmmpqlzerpuxekxyxgsjylwrgvjbcrqtdycjnaucfqgagqsxudyaaunilvbcku
jqihhjsglljkmakpbcsgriygwmapxowzanuwwegigcyjgamlikgeginywpthpjjalgtwjbqheibnruttuwnogayvjjjtxw
vjgsdyffljlykuppgariyadeyorhgbxbzjakogyidwpqjsvyjhaatzpcpreyrtbapmjpybggqmgguxjgjyohcfrsijd
zkynyegfjgpavqqejsjskqkjybdyrjykzpjmlxmcecgknjfhklyzxjzyozpgescnqmwnbajuwozvvazqiphnjkjgjltyrtxk
jkmxgmeojwjgexfhrjpcguxhbxwzyzzdltqxfazajjnopnctmwvyqtgxbjejmspagrvjraihelukpfxxybhojsqocrfot
eggnkkicajqgzzvrjsevbjyjhjrhwgnmonjgobyktvroqjlkclsqsvtsijyvdalcggewefkqxrayqoljhrxhpjbhoptpamrwyx
ojgmbmjdictwgpfhzrjafgfebpoulednvhbdznainiyyyhyyrbjhavedpnyysjkrmtnzggcvfwpxxiadywywyjgglqaz
rpnvlyejccogmlyxhaukrvyjjtwjleyvzrggymlgmtqpbjjrvqmnzqdjmmiyqbnzuluhrwzzfhvyyxztumgwwwaaqhdgknmfvkn
fienkzyguhvzeyshlwbqujjdmtouimnpeqpmyewvjogdablicimactogtypmnyiytexdvhvkatyjxyafqudxhyerwahfejhgeur
jstmaqnjdcjlefntaqbsoniinwfyebncrlvdeupfbwdukaywgrrpsftrpdvzjydksnpcldzrtjcubjowbzrqfwoszipjmjaayuym
cdfuetjmwcskovtyqtsiyojvufzyftkjqfuzvfycwjrjkqbghzjbuoydusgfpywosdzxptqldxmpdknqiaethzccoyygzbhorbzo
rpkjxgtdrflqkxrrdxmxxfjkqjhcnrurvyobgszifpygfnjnlhcjeefghorylytpyavfassgnaelbpsilllpyjsuwgely
zkpyttzvbpceemajnuyvayermkfaxyhubsktcuqgtefgcncaxdglkeiwvvrjsxdsgyoabdynvngqkrcgrgzzeafnvgnvr
raydfafjsditsjtpbqmrauggzthnnsmfkmhshhyuxsupuojceeqwrbioyyvhxlboqemkjbykexjhkjtpsqyjcbgtagcivjghay
msuattmpjgxqijnqtejqemegtlafcdytusagljjevkgfvwruldyjwrllydwicwxbyvbrrnlrvqpmtyxrlmtalwfjjzhof
ymzlwpyiyhhycwexommjkgpgslgcnxihuarvesrrgyppjzmobntoeyyuyjuphykjgncsyelfpetszukpmgvdggnqrygyngggh
fndelinlnexrjwpdtuylymzykqgotznoffwqsxxpgexqpkgyykouldtqvcxlvpggfjrpqihwjayfphwqsgykvtbjdpvzcpghw
fmghqxqodqsgdlqaqemrqyevyptibzbrviclikooirrjgclyphkhjgsekgkskcengzidoelwgaqjhfetkwbdejgfwiglslfcy
jbqsarcfrngtajbutqcuqbjdtspcvxgfwcszmuchpysxlddrxnohczujqyvwoisijqanjiolwpzxjoyhyjyfcaamgxcggla
glqfsnuxyxsaexmbrrbotsrjfmvqjccocgtcpgppxyxefmybdqddyxygqpggosoxloenbgypdyghgkwotddkjwyvdyb
ecbfgjgfdnptexytvcegbozjdjtejrffgyvmzxdwdvrcorkwaixefkaqmwugevvirgvbboiacvdcgyfgoolfbcwwcfyp
fviqgbrficcrmgakkyzdurhutitgfabrdcosadhefxsjjngpuuctwljvlvmapsrufzogtbpiuiyogyesuttcbcnmcmyqsefyy
rbukmwpjvcbnvyxtzxgwdlgnegzjymrrigvkyrgmxdcvmfptosdwsprebcpjjqtxxgyihsyigexkmlrlqgjcfqmlcwbnmvy
qoxzbzlvckfmdidfykqekmtiejfyywffujgjhxdnkgkaxjjbpzkoqpsqedtrcgelxpwjkhznqdfymyhlpkprdxarihjy
fxykyzapgqijtgrlszcxyujkijsxwehtryliyfylrkfrfjavclmponjvlzklpvjasqnijjyyaresemzndktgygxlffvk
qnjloughwwtaevgrnvszvrfqmjdnejxdecryzzlieleykqyugujyjegffwvyplqwpyyzjouwohfobzwtdvzxeixjaicjcjumkby
drjveouynxbxgnnejtugcjafjdjyfntpypyybnafytyhbcgjkekcurwfjscyyyjuhcgjyjgatnsfymgbdlguzlvtyagjghtv
rezgjgyqgmqsfjflibjkqjjcqafxfmgrubhsdwbqhxgvgyheckwfuyjjyomaqobyncpjnarcggdbwbmqcjpygtxhzlxgmggnktp
amjudpgmtdrbvjxpoojjaeyzqjzwsdwxtppgwwfyqityjjhhqdwgwimsyhvblxhqifpozgxzcjecrfjfqyydeglgigmpjgpuhlr
ydyjtzbjbtcyxtjhbqmyevhvcwnuqoxevishculrusdsvcpzqumjpoizujgmbjrukjjaypshqwqerjjqjhgjbpozowyydbjrcvu
njnfycxydblbdisxlhmdjtelhduifyntzjfzcmjaeeybbyjouxusjreavyxugvroymvengghsbrgmaamrngvabqwqinq
nyocjqjgnggotnpnypwvcwxvadztjuqikbnkxwkjizvyztbnfrwgjyexfycjrilqqnobkcrjduevskpkkxpsgpayjyjnssrxqanu
vwekjzggpuvhjgjhyrbmtwqeggkbbftsacodvjwfcgotusjlegxesjvegpvevhoykpahmklzibkeejtjemmmyizkzngigtyt
abmmboocjaagjezszawkayuwgqpmmjparrkmxunaikgkyqilbhlgaaagyxgayinslggnrcmqfhdrroorcfcyaawlkixblwzaxt
rfttoxmjmciujgxqmulgiiynfxjszyozboojyixlcgeexpwoanhuajihfyyzbygcvrqpszitijtjopsuwyexiycymwjs
jmucpscujpbgmgjytafejeyftfdbdatsczvijvhrjmynlewygwdjyggfbqjepdjjpvwogngjufxxajrftzblqgfcvimdavbyj
oflhnlxsigbfmjkdjkgrzexgsdxjqsilyymsfgjoybvygyjgwcekgnbklywyqdcjgzjikqldmhftpdctmqgyxuexhmzfswrypg
zxokwbdtjbympjltvuwpcjfaiepoikkdwcyblyaudyyorhjthpcvwafibmycgfavuzyoyowgrauqxzfrahwwojuivqysbfetf
kuiwfjgpgxblaxykkzxxmpdnuzisswszznrxfapebkjnzkyxokirjzkwrvaxgyyakwzjiduuppzwswawcszwrzcaaaqgfjnk
qgazycqcxjjcgfchcnaqnpmywjolylymlndjdjzompscbttcglfsfebocjylaypvajxzqhkipugjgxdgeoxadjjqici
daqbyowkmbglpmfxokqqgjooygvxigbqtiwjgcqrungfpgpjgbypiwqqeggvklkryqbjozvgwwzglnsmzuzysegezjna
potbdzerpxwoxyauyejybjucyorhndkoaszyaboctkwejpfoqrvxglsydkmnvkadccmjkvazxgwwxxjgshnhpvkkcjvtaxmbcobk
ehxjvcuajqhbwkgsfgigwxtwbortakmfiypykvrhgjaigygixgkxatfgrrgvhrpuifdmdomwtiedgwygwumyhgbdgyg
mjrvvsfdptaospzsgtsikykjpsyjnqzptivbsawyhihbdhydlgqbkdyvmwmpjtivcmvgvpispyvqsgncjngkvgjtolsggpn
pwkyafytjqyggbdtobjtagpyggngcsfuwxexdyswylzsyeonwsxjyjxcdvhwtmkxrzyoceatohipzkcgxjjyfwlitgjjkjzqnigb
yjoryjjjkdplgqtlghrwbyfkqizrprproxamysyefyexjuaulkayluexebygbgljvcqaputihujgcgfrwysvjgvcljkjtaann
xywaeexnunjusxjiiwyuolbajqzygjqnmdixglimrejsgentawsceypphppyacjjyposlpyqjaogkxeyeygrutlnoyglfict
itppwrszsgybigwmzuxqmgbvqljrzbmekorbgozvqbnvcpsonxpvgcfwvucaerygcithrgmopcjlrygwbcptxkkwmccambkypll
mdxjyysmjcxrhnzrcbzogldlinmensxfttozottgdsbtesqhwvlfcyenbjghagyqivxdwiwfcgjugtjmeqtpqymxritu
jbbryrvpnfjegydotgcqhjwrfmnjuftomjnvrkpzjcpinvaapvgzepqykwpyqtebvlsrsppmdmdxzpydfhpgliuzmxjg
jawcuuvigejgyjbeywigdxrujybyqssdkptgygejprljhfbobdehyodjfvieakocfmcgbdjdysvaiyqguxiqglcpninzymvscxh
jsujtyeesfgajpsnmiaezuaunjbxpaylijlrzzygjpihaymdyjzainjlnbgbsrnfbzvnfyagfzulbbqxnkjydkmsfrtwqwjixxf
ybgblqhtzxgageqiiuoitccnkglmzapdexfntmftjgpryythrvlrcigcpvkigssytrmjggwylhbfusywotxmwyiemzldwdp
nnjhmulxkpxzahsfcixlgwqwjehjvtlxqkvnbfnskjxaogyqkyssigdgembqkeqszphrxpowurgjfvybhnoswjcgvcfuaqtrg
uoangujwtweszyfgbqpknfggiixykjmfbokmybytsugjuqcajhllipmtdgygpwxsvubdxtazdhzmefwolbcsjzcggcpyc
yajudsitsqyqxpwsssvyceobngqztlvyjjimcsfmmicnxhqgiizhdbvfpdjsqiaicwjbptjuogdkvcgjxjfzlghyepnfzrshzz
vzgpdrvqdkrlypmfmibjqtxbgdylspjutpqpeawtdvzvtcqswogumvmcuogfenplpahiiaktzvfwgaexrjakmsrjycsdabvhoi
zmhsmznykaynyjmqetegrqcowrysxndwrhcfpiyovfaszkqkshkjzigqvtypevdpyfccnrogqlverxrlpexljtncvcuntcczorsg
rnusaijxbggwocpfgyyiabajvmnjkiubhjyovifonpgiyjjmtuenlgypceqocctwnizgnemryqlwufviebqxsxqzqxyczzgus
iednbxlbdfpzdacaybgrgdnqszmzduqjodyovmbywivmajsyqxsvykrmubsvrkrglyxspsphprxhnxqyhmftblqqdaixeypzkisw
paruyntojoyplsnhhdufgendvnbkhmghjqsrzfydgzdldfjvfqyzrhtuzucjhylsgxibgzyjwgjffbdodavrbgkgpvcabwv
yjrjrcyguroyzykbyynsbrmefnmsvbebzcgjnyfokcpwfkynayyazjhdoxwjcblehyqkllugijmxjjomjyskvdrcgqyoysv
ucimixqymzeelzloiqbmjslgcpfmujfsmoueytaoticqrigjvrunbudyvcyljttgqjyyjwbivdtuswilrgdvqwkugbjglthfc
zfscjyjqjgvyxmqjyryvgplgdlxbsgkygetgqeybqhqpjzmnyxyysomyqkwyhlpuyhwyxnymhwoufgxzzjgjldodrjgyoiayml
vkrbzvilnyydvwswmyigsaackjxelbtehiasykjrtnleogugihfgvjcvvgrazqsyxjuzgfbzypnuodeheogayvgxejqgbh
ubnjqbdtzkfymjdwqskaajrjxjggbbfoemzjxmeenmspqlvymajaqopaelcrpvuskoirlhfqgxfgulfjitvdykvvxgggurjyqwc
gnezzawbyshglnwenchwchufzkybdqddeaqxdkvayagnljnchyfacjsxrgtfhpoxfehwfegsnllcpjkuqdachhzfyxgbeyybvx
ztxhahheryofgjhomovthfzxyrifrdkllesbqgzjkjuutwekwnhwktmworyplzlvjrvovgdlfknnfmbaorjtnjhsnavdiiltnw
gwtilcswzdovszoogrgvnhczqbbabfscjclpgzygggkmmnyjysnsayrgjyvcykpnzqsrqjybxopiiaqyipsjchduiuoily
rrmytprvrtizxpgazohsfikushucygjygyaahksdliejdfgpjgjtjbajiqfcecyidsantjphljkzzuqlqpqoykeeggrzgn
gnvhdgipjznjscfyqivlsymngvosujbzgiuvkegzyeuvagrkdtyzvjerrfldiynlaupemjkxgvxtshdvwdbuyvoyqdgyifb
gsqgqytbkxjbzznjtyioxreomjtejqjyxigimqiphvqmvbqwyqwsguaokfhbbfbrqwmrgvdguysozweewgmqpjjuepeqwupyxpdc
lfjwsgifxwxxliofwyymvwainxdysboftkgngjjqrggqqmmcnwrhqswrgcssjyjjgeetamfztuoiaqpkgflxegwgsjgijgr
zzvojszsjjguvadfuzsmmqujspkvdhjpadqyhomgycaaidqjyhwpykxzbsdzfyuatemlamlnetalgocmcglbzrpieje
lnwopdsapyhnryjgwynxfgthwzatgqbrbtgpjjyugvhtrfjjjavkdxexdemdpzrwtysngjwgnhwwxklgtyfdngbjlczrzfx
llqkidwnjbhoyqkcpucujuvphkdxyqwqdpkgeakdypmqxjfjqjlhmbsnevwayrsemavfuyqgimxdqzpxcokwlfswngtx
ocprvumjcglqkbmbgybefgxfgsqbfhkwyjynpothxntvwvupikjlviyqwjuwgcifkhtakaiiinetwkyzqdnnsayyupqglwlyh
bogjnjvjnjouldakiworocrwgdayyssnofbcldypjbkhgckgsjjzajkjpwjmhrmuvgtutzmfchyhlrylzsdigjolgeuryutwfo
vflnlhemlanlyfryuebowmxsjobyhvicsxnhyjhqkgueggtqkfikivhvchenqfyjnmkdzwmybdhdjjyjzjvlyojgsxf
pkxgjcilxsnggxfvubxajwxiimucmwompkadfpkrnxvintyjfvpjcsxyfhgzazzplcfhulghhkvuvekpamohqbnyccj
oljwxvpfdhzawqtkndvsbgcguvjbqjcejzdwqgheyyykiliayslxemxbncynkihzgvpatmyphgeqoeypjnihszwxawogrmagfl
ykapjjkrqhpoepmmrunjzuvjipdclnxyjiojuzyjkjfygailrwwhzhrcnbjqmazdfxiogxsifiiaudokugayfbugqiy
aqjsuxfrljsxadpyjwupjbtrjaaypoldpeunvmqxducdhjupvwlavjmnmddhgdgrgltujtnuztyggxvtydnlsylfmbl
yjuzgimjegjhtgnvwhgfxwujjtchqbnmictgfqcebjahbtuygtnqnlsjcmjchjgnmjfryqgjoyebenvgczfzawggsehmgacok
gfilzddihqdncupqbyqiotczlowbwlwujdhzuboljcrbuecjaqtzzeyqdgjaxwadnqdjtvffyrvyagbgxfujysvxiiphsflajqyt
xboigogegizfytgfdtjscmbxeolpkygoeroealrfobqndtbroxxyriirtttjykwjyjtdukogseljfduwpsfvbeevctufdeyb
wwgyhfgnsqbcyezoaanbcdohpfhvhflyctlyigmnalthcjucydjsodkkwoxrgdjoiclehvgbqtjqyofuiphrdqcsqhjlb
yuapdbabgbypmwamygcvtsjcnwqgqowbklgnjojyhcyqwlperpqqakjsbyzyjyrygyyohdjkdrotfoyxejnzyxisgjijpm | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 100
| ^~~
|
s445811587 | p00501 | C++ | #include <stdio.h>
#include <string.h>
#include "mlib.h"
#define MAX_N 100
#define MAX_NN 26
int main()
{
int N, pos, start_pos, sign_length, dist = 1, make_cnt = 0, same_cnt = 0;
char sign_new[26], sign_old[101][101];
bool able_flg;
scanf("%d %s", &N, sign_new);
for(int i = 0; i < N; i++) scanf("%s", sign_old[i]);
sign_length = strlen(sign_new);
for(int i = 0; i < N; i++) {
while(dist * 2 < strlen(sign_old[i])) {
pos = 0;
same_cnt = 0;
start_pos = 0;
for(int j = 0; j < strlen(sign_old[i]); j++) {
if(sign_old[i][j] == sign_new[0]) { start_pos = j; break; }
}
for(int j = start_pos; j < strlen(sign_old[i]); j += dist) {
if(sign_old[i][j] == sign_new[pos++]) {
same_cnt++;
if(same_cnt == sign_length) {
able_flg = true;
make_cnt++;
break;
}
}
else {
pos = 0;
same_cnt = 0;
for(int k = 0; k < strlen(sign_old[i]); k++) {
if(sign_old[i][k] == sign_new[0]) { start_pos = k; break; }
}
}
}
dist++;
}
dist = 1;
}
printf("%d\n", make_cnt);
return 0;
} | a.cc:3:10: fatal error: mlib.h: No such file or directory
3 | #include "mlib.h"
| ^~~~~~~~
compilation terminated.
|
s997481851 | p00501 | C++ | #include<iostream>
#include<string>
using namespace std;
int n;string S,T;
int solve(string T){
for(int i=0;i<T.size();i++){
for(int j=1;j<T.size();j++){
string U="";int c=i;
while(c<T.size()){
U+=T[c];c+=j;
if(U==S)return 1;
}
if(U==S)return 1;
}
}
return 0;
}
int main(){
cin>>n>>S;int cnt=0;
for(int i=0;i<n;i++){
cin>>T;cnt+=solve(T);
}
cuot<<cnt<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:9: error: 'cuot' was not declared in this scope
23 | cuot<<cnt<<endl;
| ^~~~
|
s910211999 | p00501 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
string a,b;
int n,m;
int i,j,k,l;
int s=0,e=0;
cin>>n>>a;
for(i=0;i<n;i++){
cin>>b;
for(j=0;j<b.size();j++){
for(k=0;k<b.size();k++){
e=0;
for(l=0;l<a.size();l++){
if(j+k*l<b.size() || a[j+k*l]!=b[j]){
e=1;
break;
}
}
if(e==0){
e=2,s++;
break;
}
}
if(e==2){
e=0,break;
}
}
}
cout<<s<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:28:37: error: expected primary-expression before 'break'
28 | e=0,break;
| ^~~~~
|
s537497277 | p00501 | C++ | #include <cstdio>
using namespace std;
int main()
{
int n; cin >> n;
string S; cin >> S;
int ans = 0;
for (int i = 0; i < n; ++i) {
string s; cin >> s;
int len = s.length();
for (int j = 1; j < len; ++j) {
for (int k = 0; k < len; ++k) {
int cnt = 0;
int idx = 0;
int now;
for (now = k; now < len; now += j) {
if (s[now] == S[idx]) {
idx++;
cnt++;
} else {
idx = cnt = 0;
break;
}
if (cnt == S.length()) {
ans++;
goto next;
}
}
}
}
next:;
}
printf("%d\n", ans);
} | a.cc: In function 'int main()':
a.cc:5:12: error: 'cin' was not declared in this scope
5 | int n; cin >> n;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <cstdio>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:6:5: error: 'string' was not declared in this scope
6 | string S; cin >> S;
| ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
1 | #include <cstdio>
+++ |+#include <string>
2 | using namespace std;
a.cc:6:22: error: 'S' was not declared in this scope
6 | string S; cin >> S;
| ^
a.cc:9:15: error: expected ';' before 's'
9 | string s; cin >> s;
| ^~
| ;
a.cc:9:26: error: 's' was not declared in this scope
9 | string s; cin >> s;
| ^
|
s679398011 | p00501 | C++ | #include <cstdio>
#include <string>
using namespace std;
int main()
{
int n; cin >> n;
string S; cin >> S;
int ans = 0;
for (int i = 0; i < n; ++i) {
string s; cin >> s;
int len = s.length();
for (int j = 1; j < len; ++j) {
for (int k = 0; k < len; ++k) {
int cnt = 0;
int idx = 0;
int now;
for (now = k; now < len; now += j) {
if (s[now] == S[idx]) {
idx++;
cnt++;
} else {
idx = cnt = 0;
break;
}
if (cnt == S.length()) {
ans++;
goto next;
}
}
}
}
next:;
}
printf("%d\n", ans);
} | a.cc: In function 'int main()':
a.cc:6:12: error: 'cin' was not declared in this scope
6 | int n; cin >> n;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include <string>
+++ |+#include <iostream>
3 | using namespace std;
|
s946352198 | p00501 | C++ | #include"bits/stdc++.h"
using namespace std;
int main(){
int N,ans=0,in,i,sp,kan,st,tf;
char com[100],tem[100];
cin>>N;
cin>>tem;
for(in=0;in<N;in++){
cin>>com;
for(kan=0;kan<(strlen(com)/(strlen(com)-1);kan++){
for(sp=0;sp<=kan;sp++){
for(st=sp;st<N-((kan+1)*(strlen(tem)-1));st+=kan+1){
tf=1;
for(i=0;i<strlen(tem);i++){
if(com[st]!=tem[i]){
tf=0;
break;
}
}
if(tf==1){
ans++;
break;
}
}
if(tf==1)break;
}
if(tf==1)break;
}
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:51: error: expected ')' before ';' token
10 | for(kan=0;kan<(strlen(com)/(strlen(com)-1);kan++){
| ~ ^
| )
|
s350768402 | p00501 | C++ | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
int n, cnt=0, siz,siz_, on;
char c[26], l[101];
cin >> n;
scanf("%s", c);
siz = strlen(c);
for (int w = 0; w < n; w++)
{
scanf("%s", l);
siz_ = strlen(l);
bool gj = false;
for (int i = 0; i < siz_; i++)
{
for (int j = 1; i + j*(siz - 1) < siz_; j++)
{
on = i;
bool jg = true;
for (int k = 0; k < siz; k++)
{
if (c[k] != l[on])jg = false;
on += j;
}
if (jg==true)gj = true;
}
}
if (gj==true)cnt++;
}
cout << cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:15: error: 'strlen' was not declared in this scope
12 | siz = strlen(c);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<algorithm>
+++ |+#include <cstring>
4 | #include<string>
|
s599604581 | p00501 | C++ | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
int n, cnt=0, siz,siz_, on;
char c[26], l[101];
cin >> n;
scanf("%s", c);
siz = strlen(c);
for (int w = 0; w < n; w++)
{
scanf("%s", l);
siz_ = strlen(l);
bool gj = false;
for (int i = 0; i < siz_; i++)
{
for (int j = 1; i + j*(siz - 1) < siz_; j++)
{
on = i;
bool jg = true;
for (int k = 0; k < siz; k++)
{
if (c[k] != l[on])jg = false;
on += j;
}
if (jg)gj = true;
}
}
if (gj)cnt++;
}
cout << cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:15: error: 'strlen' was not declared in this scope
12 | siz = strlen(c);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<algorithm>
+++ |+#include <cstring>
4 | #include<string>
|
s289997994 | p00501 | C++ | 4
bar
abracadabra
bear
bar
baraxbara | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 4
| ^
|
s810383456 | p00501 | C++ | #include <iostream>
#include <stdio.h>
#include <string>
#include <string>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
int main (void)
{
int n;
string k,a[100],dd,cou;
cin >> n;
cin >> k;
dd = 0;
dd = k.length();
for (int i = 0; i < n; i++)
{
a[i] = 0;
cin >> a[i];
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 100; j++)
{
if (a[i].substr(j,dd) == k)
{
cou++;
}
}
}
cout << cou << endl;
} | a.cc: In function 'int main()':
a.cc:18:14: error: ambiguous overload for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
18 | dd = 0;
| ^
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
817 | operator=(const basic_string& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
828 | operator=(const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
840 | operator=(_CharT __c)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
858 | operator=(basic_string&& __str)
| ^~~~~~~~
a.cc:22:24: error: ambiguous overload for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
22 | a[i] = 0;
| ^
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
817 | operator=(const basic_string& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
828 | operator=(const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
840 | operator=(_CharT __c)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
858 | operator=(basic_string&& __str)
| ^~~~~~~~
a.cc:30:43: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
30 | if (a[i].substr(j,dd) == k)
| ^~
| |
| std::string {aka std::__cxx11::basic_string<char>}
/usr/include/c++/14/bits/basic_string.h:3208:45: note: initializing argument 2 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
3208 | substr(size_type __pos = 0, size_type __n = npos) const
| ~~~~~~~~~~^~~~~~~~~~
a.cc:32:36: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
32 | cou++;
| ~~~^~
|
s082957366 | p00501 | C++ | #include <iostream>
#include <stdio.h>
#include <string>
#include <string>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
int main (void)
{
int n;
string k,a[100],dd,cou;
k = 0;
cin >> n;
cin >> k;
dd = 0;
dd = k.length();
for (int i = 0; i < n; i++)
{
a[i] = 0;
cin >> a[i];
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 100; j++)
{
if (a[i].substr(j,dd) == k)
{
cou++;
break;
}
}
}
cout << cou << endl;
} | a.cc: In function 'int main()':
a.cc:15:13: error: ambiguous overload for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
15 | k = 0;
| ^
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
817 | operator=(const basic_string& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
828 | operator=(const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
840 | operator=(_CharT __c)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
858 | operator=(basic_string&& __str)
| ^~~~~~~~
a.cc:19:14: error: ambiguous overload for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
19 | dd = 0;
| ^
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
817 | operator=(const basic_string& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
828 | operator=(const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
840 | operator=(_CharT __c)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
858 | operator=(basic_string&& __str)
| ^~~~~~~~
a.cc:23:24: error: ambiguous overload for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
23 | a[i] = 0;
| ^
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
817 | operator=(const basic_string& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
828 | operator=(const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
840 | operator=(_CharT __c)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
858 | operator=(basic_string&& __str)
| ^~~~~~~~
a.cc:31:43: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
31 | if (a[i].substr(j,dd) == k)
| ^~
| |
| std::string {aka std::__cxx11::basic_string<char>}
/usr/include/c++/14/bits/basic_string.h:3208:45: note: initializing argument 2 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
3208 | substr(size_type __pos = 0, size_type __n = npos) const
| ~~~~~~~~~~^~~~~~~~~~
a.cc:33:36: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
33 | cou++;
| ~~~^~
|
s590844380 | p00501 | C++ | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
????????int n, cnt = 0, siz, siz_, on;
????????char c[26], l[101];
????????cin >> n;
????????scanf("%s", c);
????????siz = strlen(c);
????????for (int w = 0; w < n; w++)
????????{
????????????????scanf("%s", l);
????????????????siz_ = strlen(l);
????????????????bool gj = false;
????????????????for (int i = 0; i < siz_; i++)
????????????????{
????????????????????????for (int j = 1; i + j*(siz - 1) < siz_; j++)
????????????????????????{
????????????????????????????????on = i;
????????????????????????????????bool jg = true;
????????????????????????????????for (int k = 0; k < siz; k++)
????????????????????????????????{
????????????????????????????????????????if (c[k] != l[on])jg = false;
????????????????????????????????????????on += j;
????????????????????????????????}
????????????????????????????????if (jg)gj = true;
????????????????????????}
????????????????}
????????????????if (gj)cnt++;
????????}
????????cout << cnt << endl;
????????return 0;
} | a.cc: In function 'int main()':
a.cc:8:1: error: expected primary-expression before '?' token
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^
a.cc:8:2: error: expected primary-expression before '?' token
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^
a.cc:8:3: error: expected primary-expression before '?' token
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^
a.cc:8:4: error: expected primary-expression before '?' token
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^
a.cc:8:5: error: expected primary-expression before '?' token
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^
a.cc:8:6: error: expected primary-expression before '?' token
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^
a.cc:8:7: error: expected primary-expression before '?' token
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^
a.cc:8:8: error: expected primary-expression before '?' token
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^
a.cc:8:9: error: expected primary-expression before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
a.cc:8:9: error: expected ':' before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
a.cc:8:9: error: expected ':' before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
a.cc:8:9: error: expected ':' before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
a.cc:8:9: error: expected ':' before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
a.cc:8:9: error: expected ':' before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
a.cc:8:9: error: expected ':' before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
a.cc:8:9: error: expected ':' before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
a.cc:8:9: error: expected ':' before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'int'
8 | ????????int n, cnt = 0, siz, siz_, on;
| ^~~
a.cc:9:1: error: expected primary-expression before '?' token
9 | ????????char c[26], l[101];
| ^
a.cc:9:2: error: expected primary-expression before '?' token
9 | ????????char c[26], l[101];
| ^
a.cc:9:3: error: expected primary-expression before '?' token
9 | ????????char c[26], l[101];
| ^
a.cc:9:4: error: expected primary-expression before '?' token
9 | ????????char c[26], l[101];
| ^
a.cc:9:5: error: expected primary-expression before '?' token
9 | ????????char c[26], l[101];
| ^
a.cc:9:6: error: expected primary-expression before '?' token
9 | ????????char c[26], l[101];
| ^
a.cc:9:7: error: expected primary-expression before '?' token
9 | ????????char c[26], l[101];
| ^
a.cc:9:8: error: expected primary-expression before '?' token
9 | ????????char c[26], l[101];
| ^
a.cc:9:9: error: expected primary-expression before 'char'
9 | ????????char c[26], l[101];
| ^~~~
a.cc:9:9: error: expected ':' before 'char'
9 | ????????char c[26], l[101];
| ^~~~
| :
a.cc:9:9: error: expected primary-expression before 'char'
9 | ????????char c[26], l[101];
| ^~~~
a.cc:9:9: error: expected ':' before 'char'
9 | ????????char c[26], l[101];
| ^~~~
| :
a.cc:9:9: error: expected primary-expression before 'char'
9 | ????????char c[26], l[101];
| ^~~~
a.cc:9:9: error: expected ':' before 'char'
9 | ????????char c[26], l[101];
| ^~~~
| :
a.cc:9:9: error: expected primary-expression before 'char'
9 | ????????char c[26], l[101];
| ^~~~
a.cc:9:9: error: expected ':' before 'char'
9 | ????????char c[26], l[101];
| ^~~~
| :
a.cc:9:9: error: expected primary-expression before 'char'
9 | ????????char c[26], l[101];
| ^~~~
a.cc:9:9: error: expected ':' before 'char'
9 | ????????char c[26], l[101];
| ^~~~
| :
a.cc:9:9: error: expected primary-expression before 'char'
9 | ????????char c[26], l[101];
| ^~~~
a.cc:9:9: error: expected ':' before 'char'
9 | ????????char c[26], l[101];
| ^~~~
| :
a.cc:9:9: error: expected primary-expression before 'char'
9 | ????????char c[26], l[101];
| ^~~~
a.cc:9:9: error: expected ':' before 'char'
9 | ????????char c[26], l[101];
| ^~~~
| :
a.cc:9:9: error: expected primary-expression before 'char'
9 | ????????char c[26], l[101];
| ^~~~
a.cc:9:9: error: expected ':' before 'char'
9 | ????????char c[26], l[101];
| ^~~~
| :
a.cc:9:9: error: expected primary-expression before 'char'
9 | ????????char c[26], l[101];
| ^~~~
a.cc:10:1: error: expected primary-expression before '?' token
10 | ????????cin >> n;
| ^
a.cc:10:2: error: expected primary-expression before '?' token
10 | ????????cin >> n;
| ^
a.cc:10:3: error: expected primary-expression before '?' token
10 | ????????cin >> n;
| ^
a.cc:10:4: error: expected primary-expression before '?' token
10 | ????????cin >> n;
| ^
a.cc:10:5: error: expected primary-expression before '?' token
10 | ????????cin >> n;
| ^
a.cc:10:6: error: expected primary-expression before '?' token
10 | ????????cin >> n;
| ^
a.cc:10:7: error: expected primary-expression before '?' token
10 | ????????cin >> n;
| ^
a.cc:10:8: error: expected primary-expression before '?' token
10 | ????????cin >> n;
| ^
a.cc:10:16: error: 'n' was not declared in this scope
10 | ????????cin >> n;
| ^
a.cc:10:17: error: expected ':' before ';' token
10 | ????????cin >> n;
| ^
| :
a.cc:10:17: error: expected primary-expression before ';' token
a.cc:10:17: error: expected ':' before ';' token
10 | ????????cin >> n;
| ^
| :
a.cc:10:17: error: expected primary-expression before ';' token
a.cc:10:17: error: expected ':' before ';' token
10 | ????????cin >> n;
| ^
| :
a.cc:10:17: error: expected primary-expression before ';' token
a.cc:10:17: error: expected ':' before ';' token
10 | ????????cin >> n;
| ^
| :
a.cc:10:17: error: expected primary-expression before ';' token
a.cc:10:17: error: expected ':' before ';' token
10 | ????????cin >> n;
| ^
| :
a.cc:10:17: error: expected primary-expression before ';' token
a.cc:10:17: error: expected ':' before ';' token
10 | ????????cin >> n;
| ^
| :
a.cc:10:17: error: expected primary-expression before ';' token
a.cc:10:17: error: expected ':' before ';' token
10 | ????????cin >> n;
| ^
| :
a.cc:10:17: error: expected primary-expression before ';' token
a.cc:10:17: error: expected ':' before ';' token
10 | ????????cin >> n;
| ^
| :
a.cc:10:17: error: expected primary-expression before ';' token
a.cc:11:1: error: expected primary-expression before '?' token
11 | ????????scanf("%s", c);
| ^
a.cc:11:2: error: expected primary-expression before '?' token
11 | ????????scanf("%s", c);
| ^
a.cc:11:3: error: expected primary-expression before '?' token
11 | ????????scanf("%s", c);
| ^
a.cc:11:4: error: expected primary-expression before '?' token
11 | ????????scanf("%s", c);
| ^
a.cc:11:5: error: expected primary-expression before '?' token
11 | ????????scanf("%s", c);
| ^
a.cc:11:6: error: expected primary-expression before '?' token
11 | ????????scanf("%s", c);
| ^
a.cc:11:7: error: expected primary-expression before '?' token
11 | ????????scanf("%s", c);
| ^
a.cc:11:8: error: expected primary-expression before '?' token
11 | ????????scanf("%s", c);
| ^
a.cc:11:21: error: 'c' was not declared in this scope
11 | ????????scanf("%s", c);
| ^
a.cc:11:23: error: expected ':' before ';' token
11 | ????????scanf("%s", c);
| ^
| :
a.cc:11:23: error: expected primary-expression before ';' token
a.cc:11:23: error: expected ':' before ';' token
11 | ????????scanf("%s", c);
| ^
| :
a.cc:11:23: error: expected primary-expression before ';' token
a.cc:11:23: error: expected ':' before ';' token
11 | ????????scanf("%s", c);
| ^
| :
a.cc:11:23: error: expected primary-expression before ';' token
a.cc:11:23: error: expected ':' before ';' token
11 | ????????scanf("%s", c);
| ^
| |
s079832426 | p00501 | C++ | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
int n, cnt = 0, siz, siz_, on;
char c[26], l[101];
cin >> n;
scanf("%s", c);
siz = strlen(c);
for (int w = 0; w < n; w++)
{
scanf("%s", l);
siz_ = strlen(l);
bool gj = false;
for (int i = 0; i < siz_; i++) for (int j = 1; i + j*(siz - 1) < siz_; j++)
on = i;
bool jg = true;
for (int k = 0; k < siz; k++)
{
if (c[k] != l[on])jg = false;
on += j;
}
if (jg)gj = true;
}
?? }
if (gj)cnt++;
}
cout << cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:24:31: error: 'j' was not declared in this scope
24 | on += j;
| ^
a.cc:28:1: error: expected primary-expression before '?' token
28 | ?? }
| ^
a.cc:28:2: error: expected primary-expression before '?' token
28 | ?? }
| ^
a.cc:28:9: error: expected primary-expression before '}' token
28 | ?? }
| ^
a.cc:28:8: error: expected ':' before '}' token
28 | ?? }
| ^~~~~~~
| :
a.cc:28:9: error: expected primary-expression before '}' token
28 | ?? }
| ^
a.cc:28:8: error: expected ':' before '}' token
28 | ?? }
| ^~~~~~~
| :
a.cc:28:9: error: expected primary-expression before '}' token
28 | ?? }
| ^
a.cc: At global scope:
a.cc:29:9: error: expected unqualified-id before 'if'
29 | if (gj)cnt++;
| ^~
a.cc:30:9: error: expected declaration before '}' token
30 | }
| ^
a.cc:31:9: error: 'cout' does not name a type
31 | cout << cnt << endl;
| ^~~~
a.cc:32:9: error: expected unqualified-id before 'return'
32 | return 0;
| ^~~~~~
a.cc:33:1: error: expected declaration before '}' token
33 | }
| ^
|
s805084991 | p00501 | C++ | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
int n, cnt = 0, siz, siz_, on;
char c[26], l[101];
cin >> n;
scanf("%s", c);
siz = strlen(c);
for (int w = 0; w < n; w++)
{
scanf("%s", l);
siz_ = strlen(l);
bool gj = false;
for (int i = 0; i < siz_; i++) for (int j = 1; i + j*(siz - 1) < siz_; j++)
on = i;
bool jg = true;
for (int k = 0; k < siz; k++)
{
if (c[k] != l[on])jg = false;
on += j;
}
if (jg)gj = true;
}
?? }
if (gj)cnt++;
}
cout << cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:24:31: error: 'j' was not declared in this scope
24 | on += j;
| ^
a.cc:28:1: error: expected primary-expression before '?' token
28 | ?? }
| ^
a.cc:28:2: error: expected primary-expression before '?' token
28 | ?? }
| ^
a.cc:28:9: error: expected primary-expression before '}' token
28 | ?? }
| ^
a.cc:28:8: error: expected ':' before '}' token
28 | ?? }
| ^~~~~~~
| :
a.cc:28:9: error: expected primary-expression before '}' token
28 | ?? }
| ^
a.cc:28:8: error: expected ':' before '}' token
28 | ?? }
| ^~~~~~~
| :
a.cc:28:9: error: expected primary-expression before '}' token
28 | ?? }
| ^
a.cc: At global scope:
a.cc:29:9: error: expected unqualified-id before 'if'
29 | if (gj)cnt++;
| ^~
a.cc:30:9: error: expected declaration before '}' token
30 | }
| ^
a.cc:31:9: error: 'cout' does not name a type
31 | cout << cnt << endl;
| ^~~~
a.cc:32:9: error: expected unqualified-id before 'return'
32 | return 0;
| ^~~~~~
a.cc:33:1: error: expected declaration before '}' token
33 | }
| ^
|
s532602897 | p00501 | C++ | #include<cstdio>
#include<cctype>
#include<algorithm>
using namespace std;
int main(){
int n;
scanf("%d",&n);
char str[126];
scanf("%s",str);
char y[126];
int cnt = 0;
for(int i = 0; i < n; i++){
scanf("%s",y);
for(int k = 0; k < strlen(y); k++){
if(str[0] != y[k])continue;
for(int j = 1; j < strlen(y); j++){
int x = 0;
for(int l = k; l < strlen(y); l+=j){
//printf("%d\n",j);
if(str[x] == y[l]){
if(x == strlen(str)-1){
cnt++;
goto flg;
}
x++;
}
else if(str[x] != y[l]){
//printf("x=%d k=%d l=%d j=%d a\n",x,k,l,j);
break;
}
}
}
}
flg:;
}
printf("%d\n",cnt);
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:36: error: 'strlen' was not declared in this scope
18 | for(int k = 0; k < strlen(y); k++){
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<algorithm>
+++ |+#include <cstring>
4 | using namespace std;
|
s500441907 | p00501 | C++ | import java.io.*;
import java.util.*;
import java.util.regex.*;
public class Main {
BufferedReader br;
Main() {
br = new BufferedReader(new InputStreamReader(System.in));
}
public static void main(String[] args) {
new Main().run();
}
void debug(Object ... o) {
System.out.println(Arrays.deepToString(o));
}
int N;
String in;
String [] cand;
void init() {
try {
N = Integer.parseInt(br.readLine());
cand = new String[N];
in = br.readLine();
for (int i = 0; i < N; i++) cand[i] = br.readLine();
} catch (Exception e) {}
}
void run() {
init();
int c = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < 20; j++) {
StringBuilder sb = new StringBuilder();
sb.append(".*");
sb.append(in.charAt(0));
for (int k = 1; k < in.length(); k++) {
for (int l = 0; l < j; l++) sb.append('.');
sb.append(in.charAt(k));
}
sb.append(".*");
String pattern = sb.toString();
if (Pattern.matches(pattern, cand[i])) {
c++;
break;
}
}
}
System.out.println(c);
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.io.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.util.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.util.regex.*;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
5 | public class Main {
| ^~~~~~
|
s568544096 | p00501 | C++ | #include<iostream>
using namespace std;
int n;
string pattern;
int main(){
cin>>n;
cin >>pattern;
int ans = 0;
for(int i = 0;i <n;i++){
string mozi;
cin >>mozi;
int j = 0;
for(int i = 0;i <strlen(mozi);i++){
if(mozi(i) ==pattern[j]){
j++;
}
if(j==strlen(pattern)){
ans++;
break;
}
}
}
cout <<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:18: error: 'strlen' was not declared in this scope
16 | for(int i = 0;i <strlen(mozi);i++){
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 |
a.cc:17:8: error: no match for call to '(std::string {aka std::__cxx11::basic_string<char>}) (int&)'
17 | if(mozi(i) ==pattern[j]){
| ~~~~^~~
|
s868464022 | p00501 | C++ | #include<iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int n;
string pattern;
int main(){
cin>>n;
cin >>pattern;
int ans = 0;
for(int i = 0;i <n;i++){
string mozi;
cin >>mozi;
int j = 0;
for(int i = 0;i <strlen(mozi);i++){
if(mozi(i) ==pattern[j]){
j++;
}
if(j==strlen(pattern)){
ans++;
break;
}
}
}
cout <<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:25: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
17 | for(int i = 0;i <strlen(mozi);i++){
| ^~~~
| |
| std::string {aka std::__cxx11::basic_string<char>}
In file included from a.cc:3:
/usr/include/string.h:407:35: note: initializing argument 1 of 'size_t strlen(const char*)'
407 | extern size_t strlen (const char *__s)
| ~~~~~~~~~~~~^~~
a.cc:18:8: error: no match for call to '(std::string {aka std::__cxx11::basic_string<char>}) (int&)'
18 | if(mozi(i) ==pattern[j]){
| ~~~~^~~
a.cc:21:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
21 | if(j==strlen(pattern)){
| ^~~~~~~
| |
| std::string {aka std::__cxx11::basic_string<char>}
/usr/include/string.h:407:35: note: initializing argument 1 of 'size_t strlen(const char*)'
407 | extern size_t strlen (const char *__s)
| ~~~~~~~~~~~~^~~
|
s451240954 | p00501 | C++ | #include<iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int n;
string pattern;
int main(){
cin>>n;
cin >>pattern;
int ans = 0;
for(int i = 0;i <n;i++){
string mozi;
cin >>mozi;
int j = 0;
for(int i = 0;i <mozi.length();i++){
if(mozi(i) ==pattern[j]){
j++;
}
if(j==pattern.length()){
ans++;
break;
}
}
}
cout <<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:18:8: error: no match for call to '(std::string {aka std::__cxx11::basic_string<char>}) (int&)'
18 | if(mozi(i) ==pattern[j]){
| ~~~~^~~
|
s643750613 | p00501 | C++ | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static string[] boards;
static string name;
static int ans = 0;
static void Main()
{
int N = int.Parse(Console.ReadLine());
name = Console.ReadLine();
boards = new string[N];
for (int i = 0; i < N; i++)
{
boards[i] = Console.ReadLine();
}
for (int i = 0; i < N; i++)
{
bool corrected = false;
for (int haba = boards[i].Length; haba > 0; haba--)
{
for (int j = 0; j < boards[i].Length; j++)
{
int pre = -1;
int count = 1;
if (boards[i][j] == name[0])
{
pre = j;
}
if (pre == -1) continue;
for (int k = 1; pre + haba * k < boards[i].Length; k++)
{
if (boards[i][pre + haba * k] == name[count])
{
count++;
if (count == name.Length)
{
ans++;
corrected = true;
break;
}
}
}
if (corrected) break;
}
if (corrected) break;
}
}
Console.WriteLine(ans);
Console.ReadKey();
}
}
} | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Linq;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Text;
| ^~~~~~
a.cc:10:16: error: 'string' does not name a type
10 | static string[] boards;
| ^~~~~~
a.cc:11:16: error: 'string' does not name a type
11 | static string name;
| ^~~~~~
a.cc:12:20: error: ISO C++ forbids in-class initialization of non-const static member 'ConsoleApplication4::Program::ans'
12 | static int ans = 0;
| ^~~
a.cc:60:6: error: expected ';' after class definition
60 | }
| ^
| ;
a.cc: In static member function 'static void ConsoleApplication4::Program::Main()':
a.cc:16:21: error: expected primary-expression before 'int'
16 | int N = int.Parse(Console.ReadLine());
| ^~~
a.cc:17:13: error: 'name' was not declared in this scope
17 | name = Console.ReadLine();
| ^~~~
a.cc:17:20: error: 'Console' was not declared in this scope
17 | name = Console.ReadLine();
| ^~~~~~~
a.cc:18:13: error: 'boards' was not declared in this scope
18 | boards = new string[N];
| ^~~~~~
a.cc:18:26: error: 'string' does not name a type
18 | boards = new string[N];
| ^~~~~~
|
s352356043 | p00501 | C++ | include<iostream>
#include<string>
using namespace std;
string s,d;
int main(){
int n,cnt = 0;
cin >> n;
cin >> d;
while(n--){
cin >> s;
for(int i = 0 ; i < s.size() ; i++ ){
if(s[i] == d[0]){
for(int j = 1 ; j < s.size() ; j++ ){
if(s[i+j] == d[1]){
bool flg = true;
for(int k = 2 ; k < d.size() ; k++ ){
if(s[(j - i) * k] != d[k]){
flg = false;
break;
}
}
if(flg){
cnt++;
goto a;
}
}
}
}
}
a:;
}
cout << cnt << endl;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/char_traits.h:50:
/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:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:144:61: error: 'std::size_t' has not been declared
144 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:146:40: error: 'size_t' in namespace 'std' does not name a type
146 | static _GLIBCXX14_CONSTEXPR std::size_t
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:150:34: error: 'std::size_t' has not been declared
150 | find(const char_type* __s, std::size_t __n, const char_type& __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:153:52: error: 'std::size_t' has not been declared
153 | move(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:156:52: error: 'std::size_t' has not been declared
156 | copy(char_type* __s1, const char_type* __s2, std::size_t __n);
| ^~~
/usr/include/c++/14/bits/char_traits.h:159:30: error: 'std::size_t' has not been declared
159 | assign(char_type* __s, std::size_t __n, char_type __a);
| ^~~
/usr/include/c++/14/bits/char_traits.h:187:59: error: 'std::size_t' has not been declared
187 | compare(const char_type* __s1, const char_type* __s2, std::size_t __n)
| ^~~
/usr/include/c++/14/bits/char_traits.h: In static member function 'static constexpr int __gnu_cxx::char_traits<_CharT>::compare(const char_type*, const char_type*, int)':
/usr/include/c++/14/bits/char_traits.h:189:17: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/bits/char_traits.h:189:33: error: '__i' was not declared in this scope; did you mean '__n'?
189 | for (std::size_t __i = 0; __i < __n; ++__i)
| ^~~
| __n
/usr/include/c++/14/bits/char_traits.h: At global scope:
/usr/include/c++/14/bits/char_traits.h:198:31: error: 'size_t' in namespace 'std' does not name a type
198 | _GLIBCXX14_CONSTEXPR std::size_t
| |
s984900416 | p00501 | C++ | #include <stdio.h>
#include <string.h>
char or[50];
char ol[150];
int main(void)
{
int n, len, s, l, ind;
int i, j, k, c, ans;
scanf("%d", &n);
scanf("%s", or);
s = -1;
l = strlen(or);
ans = 0;
for (i = 0; i < n; i++){
scanf("%s", ol);
c = 0;
len = strlen(ol);
for (j = 0;j < len; j++){
if (or[0] == ol[j]){
for (k = j; k < len; k++){
if (or[1] == ol[k]){
s = k - j;
}
}
ind = 0;
for (k = j; k < len; k += s ){
if (or[ind] == ol[k]){
c++;
}
ind++;
}
}
if (c == l - 1){
ans++;
break;
}
c = 0;
}
}
printf("%d\n", ans);
return (0);
}
| a.cc:4:6: error: expected unqualified-id before 'or' token
4 | char or[50];
| ^~
a.cc: In function 'int main()':
a.cc:13:21: error: expected primary-expression before 'or' token
13 | scanf("%s", or);
| ^~
a.cc:13:23: error: expected primary-expression before ')' token
13 | scanf("%s", or);
| ^
a.cc:15:20: error: expected primary-expression before 'or' token
15 | l = strlen(or);
| ^~
a.cc:15:22: error: expected primary-expression before ')' token
15 | l = strlen(or);
| ^
a.cc:25:29: error: expected primary-expression before 'or' token
25 | if (or[0] == ol[j]){
| ^~
a.cc:25:32: error: expected identifier before numeric constant
25 | if (or[0] == ol[j]){
| ^
a.cc: In lambda function:
a.cc:25:35: error: expected '{' before '==' token
25 | if (or[0] == ol[j]){
| ^~
a.cc: In function 'int main()':
a.cc:25:35: error: no match for 'operator==' (operand types are 'main()::<lambda()>' and 'char')
25 | if (or[0] == ol[j]){
| ~~~ ^~ ~~~~~
| | |
| | char
| main()::<lambda()>
a.cc:27:45: error: expected primary-expression before 'or' token
27 | if (or[1] == ol[k]){
| ^~
a.cc:27:48: error: expected identifier before numeric constant
27 | if (or[1] == ol[k]){
| ^
a.cc: In lambda function:
a.cc:27:51: error: expected '{' before '==' token
27 | if (or[1] == ol[k]){
| ^~
a.cc: In function 'int main()':
a.cc:27:51: error: no match for 'operator==' (operand types are 'main()::<lambda()>' and 'char')
27 | if (or[1] == ol[k]){
| ~~~ ^~ ~~~~~
| | |
| | char
| main()::<lambda()>
a.cc:35:45: error: expected primary-expression before 'or' token
35 | if (or[ind] == ol[k]){
| ^~
a.cc: In lambda function:
a.cc:35:53: error: expected '{' before '==' token
35 | if (or[ind] == ol[k]){
| ^~
a.cc: In function 'int main()':
a.cc:35:53: error: no match for 'operator==' (operand types are 'main()::<lambda()>' and 'char')
35 | if (or[ind] == ol[k]){
| ~~~~~ ^~ ~~~~~
| | |
| | char
| main()::<lambda()>
|
s309261987 | p00502 | Java | import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.PriorityQueue;
import java.math.BigInteger;
public class Main{
static final InputStream in=System.in;
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static final long LINF=Long.MAX_VALUE/2;
static int N,D;
static int[] T,A,B,C,D;
static int[][] dp;
public static void main(String[] args) throws IOException{
InputReader ir=new InputReader(in);
N=ir.nextInt();
D=ir.nextInt();
T=ir.toIntArray(D);
A=new int[N];
B=new int[N];
C=new int[N];
for(int i=0;i<N;i++){
A[i]=ir.nextInt();
B[i]=ir.nextInt();
C[i]=ir.nextInt();
}
dp=new int[D+1][N];
for(int i=0;i<D;i++) Arrays.fill(d[i],Integer.MIN_VALUE);
for(int i=D-1;i>=0;i--){
for(int j=N-1;j>=0;j--){
if(T[i]>=A[j]&&T[i]<=B[j]){
for(int k=0;k<N;k++){
if(dp[i+1][k]!=Integer.MIN_VALUE) dp[i][j]=Math.max(dp[i][j],dp[i+1][k]+Math.abs(C[k]-C[j]));
}
}
}
}
int ans=0;
for(int i=0;i<N;i++) if(dp[0][i]>0) ans=Math.max(ans,dp[0][i]);
out.println(ans);
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in;}
public int readByte() {
if(lenbuf==-1) throw new InputMismatchException();
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}
catch (IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0)
return -1;
}
return buffer[curbuf++];
}
public boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;}
public String next() {
int b=skip();
StringBuilder sb=new StringBuilder();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public int[] toIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
}
} | Main.java:23: error: variable D is already defined in class Main
static int[] T,A,B,C,D;
^
Main.java:40: error: cannot find symbol
for(int i=0;i<D;i++) Arrays.fill(d[i],Integer.MIN_VALUE);
^
symbol: variable d
location: class Main
2 errors
|
s664228860 | p00502 | Java | import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.PriorityQueue;
import java.math.BigInteger;
public class Main{
static final InputStream in=System.in;
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static final long LINF=Long.MAX_VALUE/2;
static int N,D;
static int[] T,A,B,C,;
static int[][] dp;
public static void main(String[] args) throws IOException{
InputReader ir=new InputReader(in);
N=ir.nextInt();
D=ir.nextInt();
T=ir.toIntArray(D);
A=new int[N];
B=new int[N];
C=new int[N];
for(int i=0;i<N;i++){
A[i]=ir.nextInt();
B[i]=ir.nextInt();
C[i]=ir.nextInt();
}
dp=new int[D+1][N];
for(int i=0;i<D;i++) Arrays.fill(d[i],Integer.MIN_VALUE);
for(int i=D-1;i>=0;i--){
for(int j=N-1;j>=0;j--){
if(T[i]>=A[j]&&T[i]<=B[j]){
for(int k=0;k<N;k++){
if(dp[i+1][k]!=Integer.MIN_VALUE) dp[i][j]=Math.max(dp[i][j],dp[i+1][k]+Math.abs(C[k]-C[j]));
}
}
}
}
int ans=0;
for(int i=0;i<N;i++) if(dp[0][i]>0) ans=Math.max(ans,dp[0][i]);
out.println(ans);
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in;}
public int readByte() {
if(lenbuf==-1) throw new InputMismatchException();
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}
catch (IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0)
return -1;
}
return buffer[curbuf++];
}
public boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;}
public String next() {
int b=skip();
StringBuilder sb=new StringBuilder();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public int[] toIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
}
} | Main.java:23: error: <identifier> expected
static int[] T,A,B,C,;
^
1 error
|
s621370297 | p00502 | Java | import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.PriorityQueue;
import java.math.BigInteger;
public class Main{
static final InputStream in=System.in;
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static final long LINF=Long.MAX_VALUE/2;
static int N,D;
static int[] T,A,B,C;
static int[][] dp;
public static void main(String[] args) throws IOException{
InputReader ir=new InputReader(in);
N=ir.nextInt();
D=ir.nextInt();
T=ir.toIntArray(D);
A=new int[N];
B=new int[N];
C=new int[N];
for(int i=0;i<N;i++){
A[i]=ir.nextInt();
B[i]=ir.nextInt();
C[i]=ir.nextInt();
}
dp=new int[D+1][N];
for(int i=0;i<D;i++) Arrays.fill(d[i],Integer.MIN_VALUE);
for(int i=D-1;i>=0;i--){
for(int j=N-1;j>=0;j--){
if(T[i]>=A[j]&&T[i]<=B[j]){
for(int k=0;k<N;k++){
if(dp[i+1][k]!=Integer.MIN_VALUE) dp[i][j]=Math.max(dp[i][j],dp[i+1][k]+Math.abs(C[k]-C[j]));
}
}
}
}
int ans=0;
for(int i=0;i<N;i++) if(dp[0][i]>0) ans=Math.max(ans,dp[0][i]);
out.println(ans);
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in;}
public int readByte() {
if(lenbuf==-1) throw new InputMismatchException();
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}
catch (IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0)
return -1;
}
return buffer[curbuf++];
}
public boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;}
public String next() {
int b=skip();
StringBuilder sb=new StringBuilder();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public int[] toIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
}
} | Main.java:40: error: cannot find symbol
for(int i=0;i<D;i++) Arrays.fill(d[i],Integer.MIN_VALUE);
^
symbol: variable d
location: class Main
1 error
|
s333752593 | p00502 | Java | import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.PriorityQueue;
import java.math.BigInteger;
public class Main{
static final InputStream in=System.in;
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static final long LINF=Long.MAX_VALUE/2;
static int D,N;
static int[] T,A,B,C;
static int[][] dp;
public static void main(String[] args) throws IOException{
InputReader ir=new InputReader(in);
D=ir.nextInt();
N=ir.nextInt();
T=ir.toIntArray(D);
A=new int[N];
B=new int[N];
C=new int[N];
for(int i=0;i<N;i++){
A[i]=ir.nextInt();
B[i]=ir.nextInt();
C[i]=ir.nextInt();
}
dp=new int[D][N];
for(int i=0;i<D-1;i++) Arrays.fill(dp[i],Integer.MIN_VALUE);
for(int i=D-2;i>=0;i--){
for(int j=N-1;j>=0;j--){
if(T[i]>=A[j]&&T[i]<=B[j]){
for(int k=0;k<N;k++){
if(T[i+1]>=A[k]&&T[i+1]<=B[k]&&dp[i+1][k]=>0) dp[i][j]=Math.max(dp[i][j],dp[i+1][k]+Math.abs(C[k]-C[j]));
}
}
}
}
int ans=0;
for(int i=0;i<N;i++) ans=Math.max(ans,dp[0][i]);
out.println(ans);
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in;}
public int readByte() {
if(lenbuf==-1) throw new InputMismatchException();
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}
catch (IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0)
return -1;
}
return buffer[curbuf++];
}
public boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private int skip() {int b; while((b = readByte())!=-1&&isSpaceChar(b)); return b;}
public String next() {
int b=skip();
StringBuilder sb=new StringBuilder();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public int[] toIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
}
} | Main.java:45: error: illegal start of expression
if(T[i+1]>=A[k]&&T[i+1]<=B[k]&&dp[i+1][k]=>0) dp[i][j]=Math.max(dp[i][j],dp[i+1][k]+Math.abs(C[k]-C[j]));
^
1 error
|
s552726121 | p00502 | C++ | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
namespace AtTest.HCPC2019_15
{
class D
{
static void Main(string[] args)
{
Method(args);
}
static void Method(string[] args)
{
int[] nm = ReadInts();
int n = nm[0];
int m = nm[1];
int[] ts = new int[n];
for (int i = 0; i < n; i++) ts[i] = ReadInt();
int[][] abs = new int[m][];
for(int i = 0; i < m; i++) abs[i] = ReadInts();
int[,] dp = new int[n, m];
for(int i = 0; i < m; i++)
{
if (abs[i][0] <= ts[0] && ts[0] <= abs[i][1]) dp[0, i] = 0;
else dp[0, i] = -1;
}
for(int i = 1; i < n; i++)
{
for(int j = 0; j < m; j++)
{
if (ts[i] < abs[j][0] || abs[j][1] < ts[i]) dp[i, j] = -1;
else
{
int max = 0;
for(int k = 0; k < m; k++)
{
if (dp[i - 1, k] == -1) continue;
max = Max(max, dp[i - 1, k]
+ Abs(abs[j][2] - abs[k][2]));
}
dp[i, j] = max;
}
}
}
int res = 0;
for (int i = 0; i < m; i++) res = Max(res, dp[n - 1, i]);
WriteLine(res);
}
private static string Read() { return ReadLine(); }
private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
private static int ReadInt() { return int.Parse(Read()); }
private static long ReadLong() { return long.Parse(Read()); }
private static double ReadDouble() { return double.Parse(Read()); }
private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}
}
| a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Linq;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Text;
| ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'static'
5 | using static System.Console;
| ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'static'
6 | using static System.Math;
| ^~~~~~
a.cc:8:17: error: expected '{' before '.' token
8 | namespace AtTest.HCPC2019_15
| ^
a.cc:8:17: error: expected unqualified-id before '.' token
|
s708992139 | p00502 | C++ | #include <algorithm>
#include <iostream>
#include <array>
#include <vector>
#include <cmath>
using namespace std;
const int D=200;
const int N=200;
struct Clothes{
int max_t;
int min_t;
int c;
};
int main(){
int d,n;
array<array<int,N>,D> dp;
vector<Clothes> clt;
vector<int> tmp;
cin>>d>>n;
tmp.resize(d);
for( auto &t : tmp ) cin>>t;
clt.resize(n);
for( auto &t : clt ) cin>>t.min_t>>t.max_t>>t.c;
for( auto &x : dp ){
for( auto &y : x ){
y=0;
}
}
for( int i=1 ; i<d ; i++ ){
for( int j=0 ; j<n ; j++ ){
if( tmp[i] >= clt[j].min_t && tmp[i] <= clt[j].max_t ){
for( int k=0 ; k<n ; k++){
if( tmp[i-1] >= clt[k].min_t && tmp[i-1] <= clt[k].max_t ){
dp[i][j]=max(dp[i][j],abs(clt[j].c-clt[k].c)+dp[i-1][k]);
}
}
}
}
}
cout << accumulate(dp[d-1].begin(),dp[d-1].begin()+n,0,[](int a,int b){ return ( a>b ? a : b ); }) <<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:51:13: error: 'accumulate' was not declared in this scope
51 | cout << accumulate(dp[d-1].begin(),dp[d-1].begin()+n,0,[](int a,int b){ return ( a>b ? a : b ); }) <<endl;
| ^~~~~~~~~~
|
s773912483 | p00502 | C++ | #include<stdio.h>
int D,N;
int zettai;
int ans=0;
void search(int days,int list[][N],int goukei,int mae){
if(days==D){
if(ans<goukei){
ans=goukei;
}
return;
}
int i;
for(i=0;i<N;i++){
if(list[days][i]!=-1){
zettai=mae-list[days][i];
if(zettai<0){
zettai=zettai*(-1);
}
search(days+1,list,goukei+zettai,list[days][i]);
}
}
return;
}
int main(){
int i,j;
scanf("%d %d",&D,&N);
int temp[D];
for(i=0;i<D;i++){
scanf("%d",&temp[i]);
}
int list[D][N];
int min[N],max[N],hade[N];
for(i=0;i<N;i++){
scanf("%d %d %d",&min[i],&max[i],&hade[i]);
for(j=0;j<D;j++){
list[j][i]=-1;
}
}
for(i=0;i<D;i++){
for(j=0;j<N;j++){
if(min[j]<=temp[i]&&temp[i]<=max[j]){
list[i][j]=hade[j];
}
}
}
for(i=0;i<N;i++){
if(list[0][i]!=-1){
search(1,list,0,list[0][i]);
}
}
printf("%d",ans);
return 0;
} | a.cc:7:33: error: size of array 'list' is not an integral constant-expression
7 | void search(int days,int list[][N],int goukei,int mae){
| ^
a.cc: In function 'int main()':
a.cc:52:34: error: cannot convert 'int (*)[N]' to 'int (*)[1]'
52 | search(1,list,0,list[0][i]);
| ^~~~
| |
| int (*)[N]
a.cc:7:26: note: initializing argument 2 of 'void search(int, int (*)[1], int, int)'
7 | void search(int days,int list[][N],int goukei,int mae){
| ~~~~^~~~~~~~~
|
s710057509 | p00502 | C++ | #include<stdio.h>
#include<math.h>
//abs .. 絶対値を返す関数 がある。
int n,d;
int dp[205][205];
//dp[a][b] .. a日目にb番目の服を着るような状態のうち、得られる得点の最大値。着れなければ十分小さい数
int hukup[205];
int hukdw[205];
int hukha[205];
int ond[205];
int inf = -1000000;
int max(int p,int q){
if(p<q)return q;
return p;
}
int main(void){
memset(dp,-1,sizeof(dp));
scanf("%d%d",&d,&n);
for(int i=1;i<=d;i++){
scanf("%d",&ond[i]);
}
for(int i=1;i<=n;i++){
scanf("%d%d%d",&hukdw[i],&hukup[i],&hukha[i]);
}
//入力の受付ここまで
for(int j=1;j<=n;j++){
if(hukdw[j]<=ond[1] && ond[1]<=hukup[j]){
dp[1][j] = 0;
}
else{
dp[1][j] = inf;
}
}
//初日を初期化。
for(int i=2;i<=d;i++){
for(int j=1;j<=n;j++){
//i日目に、j番目の服を着るときの最大値
if(hukdw[j]<=ond[i] && ond[i]<=hukup[j]){
//着られる
dp[i][j]=0;
for(int k=1;k<=n;k++){
//現在の最大値と、(前日にkを着て、今日jを着るようなパターン) のうち、大きい方をとっていく
dp[i][j] = max(dp[i][j] , dp[i-1][k] + abs(hukha[j]-hukuha[k]) );
}
}
else{
//着られない
dp[i][j] = inf;
}
}
}
int ans = 0;
for(int j=1;j<=n;j++){
//最終日のうちの、最大値
ans = max(ans,dp[d][j]);
}
printf("%d\n",ans);
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:9: error: 'memset' was not declared in this scope
25 | memset(dp,-1,sizeof(dp));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<math.h>
+++ |+#include <cstring>
3 | //abs .. 絶対値を返す関数 がある。
a.cc:53:93: error: 'hukuha' was not declared in this scope; did you mean 'hukha'?
53 | dp[i][j] = max(dp[i][j] , dp[i-1][k] + abs(hukha[j]-hukuha[k]) );
| ^~~~~~
| hukha
|
s814658184 | p00502 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <complex>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef complex<double> Point;
typedef long long ll;
const int INF = 114514810;
const int MOD = 1000000007;
const double EPS = 1e-8;
const double PI = acos(-1.0);
struct edge
{
int from, to, cost;
bool operator < (const edge& e) const { return cost < e.cost; }
bool operator >(const edge& e) const { return cost > e.cost; }
};
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///
struct huku
{
int x,y,z;
};
int D,N;
int dp[205][205];
int d[205];
huku h[205];
int solve(int i, int j)
{
if(dp[i][j] >=0) return dp[i][j];
if(i==D) return 0;
int res = 0;
if(i==0)
{
REP(k,N)
{
if(d[i]>=h[k].x&&d[i]<=h[k].y) res = max(res,solve(i+1,k));
}
}
else
{
REP(k,N)
{
if(d[i]>=h[k].x&&d[i]<=h[k].y) res = max(res,solve(i+1,k)+abs(h[k].z-h[j].z));
}
}
return dp[i][j] = res;
}
int main()
{
MS(dp,-1);
cin>>D>>N;
REP(i,D) cin>>d[i];
REP(i,N)
{
int a,b,c;cin>>a>>b>>c;
huku t = {a,b,c};
h[i] = t;
}
cout<<solve(0,0)<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:17: error: 'memset' was not declared in this scope
12 | #define MS(m,v) memset(m,v,sizeof(m))
| ^~~~~~
a.cc:66:9: note: in expansion of macro 'MS'
66 | MS(dp,-1);
| ^~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
7 | #include <complex>
+++ |+#include <cstring>
8 | using namespace std;
|
s609858730 | p00502 | C++ | #include <cstdio>
#include <iostream>
using namespace std;
typedef struct{
int a; //下限
int b; //上限
int c; //派手さ
}clothes;
int d, n;
int t[200];
clothes p[200];
long dp[202][201];
long rec(int x, int y){ //x日目,前の日にきてた服y
if(dp[x][y]>=0) return dp[x][y];
long ret=0;
if(x==0){
for(int i=0; i<n; ++i){
if(p[i].a<=t[x] && t[x]<=p[i].b){
int tmp=rec(x+1, i);
if(ret<tmp) ret=tmp;
}
}
}
else if(x==d) return 0;
else{
for(int i=0; i<n; ++i){
if(p[i].a<=t[x] && t[x]<=p[i].b){
int cc=p[i].c-p[y].c;
if(cc<0) cc=-cc;
int tmp=rec(x+1, i)+cc;
if(ret<tmp) ret+=tmp;
}
}
}
return dp[x][y]=ret;
}
int main(){
scanf(" %d %d", &d, &n);
for(int i=0; i<d; ++i) scanf(" %d", &t[i]);
for(int i=0; i<n; ++i) scanf(" %d %d %d", &p[i].a, &p[i].b, &p[i].c);
memset(dp, -1, sizeof(dp));
printf("%ld\n", rec(0,0));
} | a.cc: In function 'int main()':
a.cc:50:9: error: 'memset' was not declared in this scope
50 | memset(dp, -1, sizeof(dp));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <iostream>
+++ |+#include <cstring>
3 | using namespace std;
|
s309855434 | p00502 | C++ | #include<iostream>
#include<camth>
using namespace std;
int d,n;
int tenki[202];
int saiko[101],saitei[101];
int hade[101];
int dp[201][101];
int hot(int d,int f){
if(dp[d][f]!=0)return dp[d][f];
if(d==0){
cout<<d<<"a "<<f<<" "<<endl;
return dp[d][f]=0;
}
int ans=0;
for(int i=1;i<=n;i++){
if(saitei[i]<=tenki[d]&&tenki[d]<=saiko[i]){
ans=max(ans,hot(d-1,i)+abs(hade[i]-hade[f]));
}
cout<<d<<"asi "<<f<<" "<<ans<<endl;
}
cout<<d<<"as "<<f<<" "<<ans<<endl;
return dp[d][f]=ans;
}
int main(){
cin>>d>>n;
for(int i=1;i<=d;i++){
cin>>tenki[i];
}
for(int i=1;i<=n;i++){
cin>>saitei[i]>>saiko[i]>>hade[i];
}
int ans=0;
for(int i=1;i<=n;i++){
if(saitei[i]<=tenki[d-1]&&tenki[d-1]<=saiko[i]){
ans=max(ans,hot(d-1,i));
}
}
cout<<ans<<endl;
return 0;
} | a.cc:2:9: fatal error: camth: No such file or directory
2 | #include<camth>
| ^~~~~~~
compilation terminated.
|
s850942827 | p00502 | C++ | #include<iostream>
using namespace std;
//dp[i][j]: i??\???j???????????????c_x_(i)-c_x_(i-1)????????§???
int dp[201][201];
int main(){
int d,n,ans=0;
cin>>d>>n;
int a[201],b[201],c[201],tem[201];
memset(dp,0,sizeof(dp));
for(int i=0;i<d;i++)
cin>>tem[i];
for(int i=0;i<n;i++)
cin>>a[i]>>b[i]>>c[i];
for(int m=1;m<d;m++)
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
if(a[i]<=tem[m]&&tem[m]<=b[i] && a[j]<=tem[m-1]&&tem[m-1]<=b[j])
dp[m][i]=max(dp[m][i],abs(c[i]-c[j])+dp[m-1][j]);
for(int i=0;i<n;i++)
ans=max(ans,dp[d-1][i]);
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:9:5: error: 'memset' was not declared in this scope
9 | 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;
|
s549801785 | p00502 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int dp[201][61], d, n, t[61], a[201], b[201], c[201], mx = 0;
int abs(int x, int y)
{
if (x >= y) return x - y;
else return y - x;
}
int main()
{
cin >> d >> n;
for (int i = 1; i <= d; i++){
cin >> t[i];
}
for (int i = 1; i <= n; i++){
cin >> a[i] >> b[i] >> c[i];
}
memset(dp, -1, sizeof dp);
for (int i = 1; i <= n; i++){
if (a[i] <= t[1] && t[1] <= b[i]){
dp[1][i] = 0;
}
}
//dp
for (int today = 2; today <= d; today++){
for (int n2 = 1; n2 <= n; n2++){
for (int n1 = 1; n1 <= n; n1++){
if (dp[today - 1][n1] == -1) continue;
if (a[n2] > t[today] || t[today] > b[n2]) continue;
dp[today][n2] = max(dp[today][n2], dp[today - 1][n1] + abs(c[n1], c[n2]));
}
}
}
for (int i = 1; i < n; i++){
mx = max(dp[d][i], mx);
}
cout << mx << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:22:9: error: 'memset' was not declared in this scope
22 | memset(dp, -1, sizeof dp);
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<algorithm>
+++ |+#include <cstring>
3 | using namespace std;
|
s745735601 | p00502 | C++ | #include<bits/stdc++.h>
using namespace std;
int dp[250][150],T[250],x[250][3],D,N,MAX;
memset(dp,-1000000,sizeof(dp));
main(){
cin>>D>>N;
for(int i=1;i<=D;i++){cin>>T[i];}
for(int i=1;i<=N;i++){
cin>>x[i][0]>>x[i][1]>>x[i][2];
if(T[1]>=x[i][0] && T[1]<=x[i][1]){dp[1][x[i][2]]=0;}
}
for(int i=2;i<=D;i++){
for(int j=1;j<=N;j++){
if(T[i]>=x[j][0] && T[i]<=x[j][1]){
for(int k=0;k<=100;k++){
dp[i][x[j][2]]=max(dp[i][x[j][2]],dp[i-1][k]+abs(x[j][2]-k));
}
}
}
}
for(int i=0;i<=100;i++){MAX=max(MAX,dp[D][i]);}
cout<<MAX<<endl;
return 0;
} | a.cc:4:7: error: expected constructor, destructor, or type conversion before '(' token
4 | memset(dp,-1000000,sizeof(dp));
| ^
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main(){
| ^~~~
|
s981944959 | p00502 | C++ | #include<bits/stdc++.h>
using namespace std;
int dp[250][150],T[250],x[250][3],D,N,MAX;
memset(dp,-1,sizeof(dp));
main(){
cin>>D>>N;
for(int i=1;i<=D;i++){cin>>T[i];}
for(int i=1;i<=N;i++){
cin>>x[i][0]>>x[i][1]>>x[i][2];
if(T[1]>=x[i][0] && T[1]<=x[i][1]){dp[1][x[i][2]]=0;}
}
for(int i=2;i<=D;i++){
for(int j=1;j<=N;j++){
if(T[i]>=x[j][0] && T[i]<=x[j][1]){
for(int k=0;k<=100;k++){
dp[i][x[j][2]]=max(dp[i][x[j][2]],dp[i-1][k]+abs(x[j][2]-k));
}
}
}
}
for(int i=0;i<=100;i++){MAX=max(MAX,dp[D][i]);}
cout<<MAX<<endl;
return 0;
} | a.cc:4:7: error: expected constructor, destructor, or type conversion before '(' token
4 | memset(dp,-1,sizeof(dp));
| ^
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main(){
| ^~~~
|
s536892111 | p00502 | C++ | #include<bits/stdc++.h>
int P[250][150],T[250],x[250][3],D,N,M,i;
main(){memset(P,-999999,sizeof(P));cin>>D>>N;
for(i=1;i<=D;i++){std::cin>>T[i];}
for(i=1;i<=N;i++){std::cin>>x[i][0]>>x[i][1]>>x[i][2];if(T[1]>=x[i][0] && T[1]<=x[i][1]){P[1][x[i][2]]=0;}}
for(i=2;i<=D;i++){for(int j=1;j<=N;j++){if(T[i]>=x[j][0] && T[i]<=x[j][1]){
for(k=0;k<=100;k++){P[i][x[j][2]]=max(P[i][x[j][2]],P[i-1][k]+abs(x[j][2]-k));}}}}
for(i=0;i<=100;i++){M=max(M,P[D][i]);}std::cout<<M<<"\n";} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){memset(P,-999999,sizeof(P));cin>>D>>N;
| ^~~~
a.cc: In function 'int main()':
a.cc:3:36: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
3 | main(){memset(P,-999999,sizeof(P));cin>>D>>N;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:7:5: error: 'k' was not declared in this scope
7 | for(k=0;k<=100;k++){P[i][x[j][2]]=max(P[i][x[j][2]],P[i-1][k]+abs(x[j][2]-k));}}}}
| ^
a.cc:7:35: error: 'max' was not declared in this scope; did you mean 'std::max'?
7 | for(k=0;k<=100;k++){P[i][x[j][2]]=max(P[i][x[j][2]],P[i-1][k]+abs(x[j][2]-k));}}}}
| ^~~
| std::max
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
a.cc:8:23: error: 'max' was not declared in this scope; did you mean 'std::max'?
8 | for(i=0;i<=100;i++){M=max(M,P[D][i]);}std::cout<<M<<"\n";}
| ^~~
| std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
|
s939526321 | p00502 | C++ | #include<bits/stdc++.h>
int P[250][150],T[250],x[250][3],D,N,M,i,j,k;
main(){memset(P,-999999,sizeof(P));std::cin>>D>>N;
for(i=1;i<=D;i++){std::cin>>T[i];}
for(i=1;i<=N;i++){std::cin>>x[i][0]>>x[i][1]>>x[i][2];if(T[1]>=x[i][0] && T[1]<=x[i][1]){P[1][x[i][2]]=0;}}
for(i=2;i<=D;i++){for(j=1;j<=N;j++){if(T[i]>=x[j][0] && T[i]<=x[j][1]){
for(k=0;k<=100;k++){P[i][x[j][2]]=max(P[i][x[j][2]],P[i-1][k]+abs(x[j][2]-k));}}}}
for(i=0;i<=100;i++){M=max(M,P[D][i]);}std::cout<<M<<"\n";} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){memset(P,-999999,sizeof(P));std::cin>>D>>N;
| ^~~~
a.cc: In function 'int main()':
a.cc:7:35: error: 'max' was not declared in this scope; did you mean 'std::max'?
7 | for(k=0;k<=100;k++){P[i][x[j][2]]=max(P[i][x[j][2]],P[i-1][k]+abs(x[j][2]-k));}}}}
| ^~~
| std::max
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
a.cc:8:23: error: 'max' was not declared in this scope; did you mean 'std::max'?
8 | for(i=0;i<=100;i++){M=max(M,P[D][i]);}std::cout<<M<<"\n";}
| ^~~
| std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
|
s695735937 | p00502 | C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<bits/stdc++.h>
#define LL long long
#define FOR(i,a,b) for(int i=a;i<=b;++i)
using namespace std;
static const LL MAX_N = 1e+5;
static const LL INF = 1 << 25;
struct clothes{
LL A[100],B[100],C[150];
};
int N,D;
LL res=-INF;
LL Day[300];
LL mem[300][150];
clothes T;
LL cal(LL day,LL p,LL pp,LL sum){
//cout<<res<<" "<<day<<endl;
if(day>2) mem[day][p]=res;
if(res<sum+abs(pp-p)&&day==N+1){
return res=sum+abs(pp-p);
}
else if(mem[day][p]!=0){
// cout<<"hoge"<<endl;
return mem[day][sum+abs(pp-p)];
}
else{
if(day==N+1)return 0;
else if(day==0){
FOR(i,1,D)
if(Day[1]>=T.A[i]&&Day[1]<=T.B[i])cal(day+1,T.C[i],p,sum);
}
FOR(i,1,D){
if(Day[day]>=T.A[i]&&Day[day]<=T.B[i]){
if(day>2)cal(day+1,T.C[i],p,sum+abs(pp-p));
else cal(day+1,T.C[i],p,sum);
}
}
}
return mem[day][p]=res;
}
int main(){
cin>>N>>D;
FOR(i,1,N)cin>>Day[i];
FOR(i,1,D)
cin>>T.A[i]>>T.B[i]>>T.C[i];
cout<<cal(0,0,0,0)<<endl;
} | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 1
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:54:
/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'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) 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:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) 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:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| |
s532683819 | p00502 | C++ |
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<bits/stdc++.h>
#define LL long long
#define FOR(i,a,b) for(int i=a;i<=b;++i)
using namespace std;
static const LL MAX_N = 1e+5;
static const LL INF = 1 << 25;
struct clothes{
LL A[MAX_N],B[MAX_N],C[MAX_N];
};
int N,D;
LL res=-INF;
LL Day[MAX_N];
clothes T;
LL cal(LL day,LL p,LL pp,LL sum){
//cout<<sum+abs(pp-p)<<" "<<day<<" "<<p<<" "<<pp<<endl;
if(res<sum+abs(pp-p))res=sum+abs(pp-p);
if(day==N+1)return 0;
if(day==0){
FOR(i,1,D)
if(Day[1]>=T.A[i]&&Day[1]<=T.B[i])cal(day+1,T.C[i],p,sum);
}
FOR(i,1,D){
if(Day[day]>=T.A[i]&&Day[day]<=T.B[i]){
if(day>2)cal(day+1,T.C[i],p,sum+abs(pp-p));
else cal(day+1,T.C[i],p,sum);
}
}
return res;
}
int main(){
cin>>N>>D;
FOR(i,1,N)cin>>Day[i];
FOR(i,1,D)
cin>>T.A[i]>>T.B[i]>>T.C[i];
cal(0,0,0,0);
cout<<res<<endl;
} | a.cc:2:1: error: expected unqualified-id before numeric constant
2 | 3
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:43:
/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'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) 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:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) 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:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/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:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| |
s093057875 | p00502 | C++ | #include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
static const int INF = 8931919114514810;
static const int MAX_N = 300;
using namespace std;
int A[300],B[300],C[300];
int mem[MAX_N][MAX_N];
int N,D;
int Day[MAX_N];
int cal(int day,int pp){
int res=0;
if(day==N+1){
return res=0;
}
if(mem[day][pp]!=-1){
return mem[day][pp];
}
if(day<=1){
FOR(i,1,D){
if(Day[day]>=A[i]&&Day[day]<=B[i]){
res=cal(day+1,i);
}
}
}
else{
FOR(i,1,D){
if(Day[day]>=A[i]&&Day[day]<=B[i]){
int temp=abs(C[pp]-C[i]);
res=max(cal(day+1,i)+temp,res);
mem[day][pp]=res;
}
}
}
return mem[day][pp]=res;
}
int main(){
cin>>N>>D;
memset(mem,-1,sizeof(mem));
FOR(i,1,N){
cin>>Day[i];
}
FOR(i,1,D){
cin>>A[i]>>B[i]>>C[i];
}
int ans=0
FOR(i,1,D){
if(Day[1]>=A[i]&&Day[1]<=B[i]){
ans=max(cal(1,i),ans)<<endl;
}
}
return 0;
} | a.cc:3:24: warning: overflow in conversion from 'long int' to 'int' changes value from '8931919114514810' to '2046538106' [-Woverflow]
3 | static const int INF = 8931919114514810;
| ^~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:2:20: error: expected ',' or ';' before 'for'
2 | #define FOR(i,a,b) for(int i=a;i<=b;i++)
| ^~~
a.cc:48:5: note: in expansion of macro 'FOR'
48 | FOR(i,1,D){
| ^~~
a.cc:48:9: error: 'i' was not declared in this scope
48 | FOR(i,1,D){
| ^
a.cc:2:32: note: in definition of macro 'FOR'
2 | #define FOR(i,a,b) for(int i=a;i<=b;i++)
| ^
|
s849108131 | p00502 | C++ | #include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
static const int INF = 8931919114514810;
static const int MAX_N = 300;
using namespace std;
int A[300],B[300],C[300];
int mem[MAX_N][MAX_N];
int N,D;
int Day[MAX_N];
int cal(int day,int pp){
int res=0;
if(day==N+1){
return res=0;
}
if(mem[day][pp]!=-1){
return mem[day][pp];
}
if(day<=1){
FOR(i,1,D){
if(Day[day]>=A[i]&&Day[day]<=B[i]){
res=cal(day+1,i);
}
}
}
else{
FOR(i,1,D){
if(Day[day]>=A[i]&&Day[day]<=B[i]){
int temp=abs(C[pp]-C[i]);
res=max(cal(day+1,i)+temp,res);
mem[day][pp]=res;
}
}
}
return mem[day][pp]=res;
}
int main(){
cin>>N>>D;
memset(mem,-1,sizeof(mem));
FOR(i,1,N){
cin>>Day[i];
}
FOR(i,1,D){
cin>>A[i]>>B[i]>>C[i];
}
int ans=0
FOR(i,1,D){
if(Day[1]>=A[i]&&Day[1]<=B[i]){
ans=max(cal(1,i),ans);
}
}
cout<<ans<<endl;
return 0;
} | a.cc:3:24: warning: overflow in conversion from 'long int' to 'int' changes value from '8931919114514810' to '2046538106' [-Woverflow]
3 | static const int INF = 8931919114514810;
| ^~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:2:20: error: expected ',' or ';' before 'for'
2 | #define FOR(i,a,b) for(int i=a;i<=b;i++)
| ^~~
a.cc:48:5: note: in expansion of macro 'FOR'
48 | FOR(i,1,D){
| ^~~
a.cc:48:9: error: 'i' was not declared in this scope
48 | FOR(i,1,D){
| ^
a.cc:2:32: note: in definition of macro 'FOR'
2 | #define FOR(i,a,b) for(int i=a;i<=b;i++)
| ^
|
s448165930 | p00502 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<algorithm>
struct str
{
int a, b, c;
};
int t[200];
str b[200];
str dp1[200];
str dp2[200];
int main(){
int d, n;
scanf("%d%d", &d, &n);
for (int i = 0; i < d; i++)
scanf("%d", &t[i]);
for (int i = 0; i < n; i++){
int a_, b_, c_;
scanf("%d%d%d", &a_, &b_, &c_);
b[i].a = a_;
b[i].b = b_;
b[i].c = c_;
}
int min = 101;
for (int i = 0; i < n; i++)
if (b[i].a <= t[0] && t[0] <= b[i].b&&min >=b[i].c)
min = b[i].c;
dp1[0].a = 0; dp1[0].b = min;
for (int i = 1; i < d; i++){
int max = 0;
for (int j = 0; j < n; j++){
if (b[j].a <= t[i] && t[i] <= b[j].b&&abs(dp1[i - 1].b - b[j].c) >= max){
max = abs(dp1[i - 1].b - b[j].c);
dp1[i].b = b[j].c;
}
}
dp1[i].a = dp1[i - 1].a + max;
}
int max = 0;
for (int i = 0; i < n; i++)
if (b[i].a <= t[0] && t[0] <= b[i].b&&min <= b[i].c)
max = b[i].c;
dp2[0].a = 0; dp2[0].b = min;
for (int i = 1; i < d; i++){
max = 0;
for (int j = 0; j < n; j++){
if (b[j].a <= t[i] && t[i] <= b[j].b&&abs(dp2[i - 1].b - b[j].c) >= max){
max = abs(dp2[i - 1].b - b[j].c);
dp2[i].b = b[j].c;
}
}
dp2[i].a = dp2[i - 1].a + max;
}
printf("%d\n",std::max(dp1[d - 1], dp2[d - 1]));
return 0;
} | In file included from /usr/include/c++/14/algorithm:60,
from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = str]':
a.cc:55:24: required from here
55 | printf("%d\n",std::max(dp1[d - 1], dp2[d - 1]));
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:262:15: error: no match for 'operator<' (operand types are 'const str' and 'const str')
262 | if (__a < __b)
| ~~~~^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algobase.h:262:15: note: 'const str' is not derived from 'const std::pair<_T1, _T2>'
262 | if (__a < __b)
| ~~~~^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algobase.h:262:15: note: 'const str' is not derived from 'const std::reverse_iterator<_Iterator>'
262 | if (__a < __b)
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algobase.h:262:15: note: 'const str' is not derived from 'const std::reverse_iterator<_Iterator>'
262 | if (__a < __b)
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algobase.h:262:15: note: 'const str' is not derived from 'const std::move_iterator<_IteratorL>'
262 | if (__a < __b)
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algobase.h:262:15: note: 'const str' is not derived from 'const std::move_iterator<_IteratorL>'
262 | if (__a < __b)
| ~~~~^~~~~
|
s344802589 | p00502 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
using namespace std;
struct str
{
int a, b, c;
void new_str(int a_, int b_, int c_){
a = a_; b = b_; c = c_;
}
};
int dp[200][200];
int t[200];
str cl[200];
int main(){
int d, n;
scanf("%d%d", &d, &n);
memset(dp, -1, sizeof(dp));
for (int i = 0; i < d; i++)
scanf("%d", &t[i]);
for (int i = 0; i < n; i++){
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
cl[i].new_str(a, b, c);
}
for (int i = 0; i < n; i++)
if (cl[i].a <= t[0] && t[0] <= cl[i].b)
dp[0][i] = 0;
for (int i = 1; i < d; i++){
for (int j = 0; j < n; j++){
if (cl[j].a <= t[i] && t[i] <= cl[j].b){
for (int l = 0; l < n; l++){
if (dp[i - 1][l] >= 0 && abs(cl[l].c - cl[j].c) + dp[i - 1][l]>dp[i][j])
dp[i][j] = abs(cl[l].c - cl[j].c) + dp[i - 1][l];
}
}
}
}
printf("%d\n", *max_element(dp[d - 1], dp[d - 1] + n));
return 0;
} | a.cc: In function 'int main()':
a.cc:20:9: error: 'memset' was not declared in this scope
20 | memset(dp, -1, sizeof(dp));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<algorithm>
+++ |+#include <cstring>
5 | using namespace std;
|
s000827530 | p00502 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int dp[110][110],l[110],r[110],p[110],n,m,a[110];
int main(){
cin>>n>>m;for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<m;i++)cin>>l[i]>>r[i]>>p[i];
for(int i=0;i<12100;i++)dp[i/110][i%110]=-1000000000;
for(int i=0;i<m;i++){if(l[i]<=a[0] && a[i]<=r[0]){dp[0][p[i]]=max(dp[0][p[i]],0);)}}
for(int i=1;i<n;i++){
for(int j=0;j<=100;j++){
for(int k=0;k<m;k++){
if(l[k]<=a[i] && a[i]<=r[k]){
dp[i][p[k]]=max(dp[i][p[k]],dp[i-1][j]+abs(j-p[k]));)
}
}
}
}
int maxn=0;for(int i=0;i<=100;i++)maxn=max(maxn,dp[n-1][i]);
cout<<maxn<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:90: error: expected primary-expression before ')' token
9 | for(int i=0;i<m;i++){if(l[i]<=a[0] && a[i]<=r[0]){dp[0][p[i]]=max(dp[0][p[i]],0);)}}
| ^
a.cc:14:93: error: expected primary-expression before ')' token
14 | dp[i][p[k]]=max(dp[i][p[k]],dp[i-1][j]+abs(j-p[k]));)
| ^
|
s078519165 | p00502 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int dp[110][110],l[110],r[110],p[110],n,m,a[110];
int main(){
cin>>n>>m;for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<m;i++)cin>>l[i]>>r[i]>>p[i];
for(int i=0;i<12100;i++)dp[i/110][i%110]=-1000000000;
for(int i=0;i<m;i++){
if(l[i]<=a[0] && a[i]<=r[0]){
dp[0][p[i]]=max(dp[0][p[i]],0);
}
}
for(int i=1;i<n;i++){
for(int j=0;j<=100;j++){
for(int k=0;k<m;k++){
if(l[k]<=a[i] && a[i]<=r[k]){
dp[i][p[k]]=max(dp[i][p[k]],dp[i-1][j]+abs(j-p[k]));)
}
}
}
}
int maxn=0;for(int i=0;i<=100;i++)maxn=max(maxn,dp[n-1][i]);
cout<<maxn<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:18:93: error: expected primary-expression before ')' token
18 | dp[i][p[k]]=max(dp[i][p[k]],dp[i-1][j]+abs(j-p[k]));)
| ^
|
s264071648 | p00502 | C++ | #include <iostream>
#include <limits>
#include <cmath>
constexpr int MAX = 200;
constexpr int MAX_C = 100;
int D, N, T[MAX], A[MAX], B[MAX], C[MAX];
int memo[MAX_C + 1][MAX + 1];
int solve(int tmp, int n = 1);
int main(){
std::ios::sync_with_stdio(false);
memset(memo, -1, sizeof(memo));
std::cin >> D >> N;
for(int i = 0; i < D; ++i){
std::cin >> T[i];
}
for(int i = 0; i < N; ++i){
std::cin >> A[i] >> B[i] >> C[i];
}
int ans = 0;
for(int i = 0; i < N; ++i){
if(A[i] <= T[0] && T[0] <= B[i]){
ans = std::max(ans, solve(C[i]));
}
}
std::cout << ans << std::endl;
return 0;
}
int solve(int tmp, int n){
if(n == D){
return 0;
}
if(memo[tmp][n] != -1){
return memo[tmp][n];
}
int res = 0;
for(int i = 0; i < N; ++i){
if(A[i] <= T[n] && T[n] <= B[i]){
res = std::max(res, solve(C[i], n + 1) + abs(tmp - C[i]));
}
}
//std::cout << "memo[" << tmp << "][" << n << "] = " << res << std::endl;
return memo[tmp][n] = res;
} | a.cc: In function 'int main()':
a.cc:16:9: error: 'memset' was not declared in this scope
16 | memset(memo, -1, sizeof(memo));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cmath>
+++ |+#include <cstring>
4 |
|
s813243896 | p00502 | C++ | #include <iostream>
#include <limits>
#include <cmath>
constexpr int MAX = 200;
constexpr int MAX_C = 100;
int D, N, T[MAX], A[MAX], B[MAX], C[MAX];
int memo[MAX_C + 1][MAX + 1];
int solve(int tmp, int n = 1);
int main(){
std::ios::sync_with_stdio(false);
memset(memo, -1, sizeof(memo));
std::cin >> D >> N;
for(int i = 0; i < D; ++i){
std::cin >> T[i];
}
for(int i = 0; i < N; ++i){
std::cin >> A[i] >> B[i] >> C[i];
}
int ans = 0;
for(int i = 0; i < N; ++i){
if(A[i] <= T[0] && T[0] <= B[i]){
ans = std::max(ans, solve(C[i]));
}
}
std::cout << ans << std::endl;
return 0;
}
int solve(int tmp, int n){
if(n == D){
return 0;
}
if(memo[tmp][n] != -1){
return memo[tmp][n];
}
int res = 0;
for(int i = 0; i < N; ++i){
if(A[i] <= T[n] && T[n] <= B[i]){
res = std::max(res, solve(C[i], n + 1) + abs(tmp - C[i]));
}
}
//std::cout << "memo[" << tmp << "][" << n << "] = " << res << std::endl;
return memo[tmp][n] = res;
} | a.cc: In function 'int main()':
a.cc:16:9: error: 'memset' was not declared in this scope
16 | memset(memo, -1, sizeof(memo));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cmath>
+++ |+#include <cstring>
4 |
|
s525211818 | p00502 | C++ | #include <iostream>
#include <limits>
#include <cmath>
constexpr int MAX = 200;
constexpr int MAX_C = 100;
int D, N, T[MAX], A[MAX], B[MAX], C[MAX];
int memo[MAX_C + 1][MAX + 1];
int solve(int tmp, int n = 1);
int main(){
std::ios::sync_with_stdio(false);
memset(memo, -1, sizeof(memo));
std::cin >> D >> N;
for(int i = 0; i < D; ++i){
std::cin >> T[i];
}
for(int i = 0; i < N; ++i){
std::cin >> A[i] >> B[i] >> C[i];
}
int ans = 0;
for(int i = 0; i < N; ++i){
if(A[i] <= T[0] && T[0] <= B[i]){
ans = std::max(ans, solve(C[i]));
}
}
std::cout << ans << std::endl;
return 0;
}
int solve(int tmp, int n){
if(n == D){
return 0;
}
if(memo[tmp][n] != -1){
return memo[tmp][n];
}
int res = 0;
for(int i = 0; i < N; ++i){
if(A[i] <= T[n] && T[n] <= B[i]){
res = std::max(res, solve(C[i], n + 1) + abs(tmp - C[i]));
}
}
//std::cout << "memo[" << tmp << "][" << n << "] = " << res << std::endl;
return memo[tmp][n] = res;
} | a.cc: In function 'int main()':
a.cc:16:9: error: 'memset' was not declared in this scope
16 | memset(memo, -1, sizeof(memo));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cmath>
+++ |+#include <cstring>
4 |
|
s643908068 | p00502 | C++ | #include <iostream>
#include <limits>
#include <cmath>
constexpr int MAX = 200;
constexpr int MAX_C = 100;
int D, N, T[MAX], A[MAX], B[MAX], C[MAX];
int memo[MAX_C + 1][MAX + 1];
int solve(int tmp, int n = 1);
int main(){
std::ios::sync_with_stdio(false);
memset(memo, -1, sizeof(memo));
std::cin >> D >> N;
for(int i = 0; i < D; ++i){
std::cin >> T[i];
}
for(int i = 0; i < N; ++i){
std::cin >> A[i] >> B[i] >> C[i];
}
int ans = 0;
for(int i = 0; i < N; ++i){
if(A[i] <= T[0] && T[0] <= B[i]){
ans = std::max(ans, solve(C[i]));
}
}
std::cout << ans << std::endl;
return 0;
}
int solve(int tmp, int n){
if(n == D){
return 0;
}
if(memo[tmp][n] != -1){
return memo[tmp][n];
}
int res = 0;
for(int i = 0; i < N; ++i){
if(A[i] <= T[n] && T[n] <= B[i]){
res = std::max(res, solve(C[i], n + 1) + abs(tmp - C[i]));
}
}
//std::cout << "memo[" << tmp << "][" << n << "] = " << res << std::endl;
return memo[tmp][n] = res;
} | a.cc: In function 'int main()':
a.cc:16:9: error: 'memset' was not declared in this scope
16 | memset(memo, -1, sizeof(memo));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cmath>
+++ |+#include <cstring>
4 |
|
s584666169 | p00502 | C++ | //
// main.cpp
#include <iostream>
#include <cmath.h>
using namespace std;
struct status{
int toptemp;
int bottomtemp;
int fancy;
};
status dress[201];
int dp[201][201];//i??\???????????????j????????????????????§????´???????
int temp[201];
int D,N;
int MAX(int i,int j){//i??\?????????j???????????????????????§???????????????
if(i == 0){//?????\????????????????????????
// return dress[j].fancy;
return 0;
}
// for(int i=0;i<N;i++){
for(int J=0;J<N;J++){//i-1??\?????????J(1<D)???????????????????????§???
if(temp[i-1] >= dress[J].bottomtemp && temp[i-1] <= dress[J].toptemp){
dp[i][j] = max(dp[i][j],MAX(i-1,J) + abs(dress[J].fancy - dress[j].fancy));
}
}
return dp[i][j];
// dp[i-1][j]
// }
}
int main(){
cin >> D >> N;
for(int i=0;i<D;i++){
cin >> temp[i];
}
for(int i=0;i<N;i++){
cin >> dress[i].bottomtemp >> dress[i].toptemp >> dress[i].fancy;
}
for(int i=0;i<201;i++){
for(int j=0;j<201;j++){
dp[i][j] = -1;
}
}
int answer=0;
for(int i=0;i<N;i++){
if(temp[D-1] >= dress[i].bottomtemp && temp[D-1] <= dress[i].toptemp){
answer = max(answer,MAX(D-1,i));
}
}
cout << answer << endl;
/*
for(int i=0;i<N;i++){//0??\?????????????¨???????
if(temp[0] >= dress[i].bottomtemp && temp[0] <= dress[i].toptemp){
dp[0][i] = dress[i].fancy;
}
}
for(int i=1;i<D;i++){
for(int j=0;j<N;j++){
if(temp[i] >= dress[j].bottomtemp && temp[i] <= dress[j].toptemp){//i??\??????j??????????????????
int Maxfancy=-1;
for(int k=0;k<N;k++){//i-1??\????????¨????????????????????´???????????????????´???????????????§???????????????????????????
if(dp[i-1][k] == -1)continue;
Maxfancy = max(Maxfancy,abs(dress[j].fancy - dress[k].fancy));
}
dp[i][j] = Maxfancy;
}
}
}
int answer = 0;
for(int i=1;i<D;i++){
int Max = -1;
for(int j=0;j<N;j++){
Max = max(Max,dp[i][j]);
}
answer += Max;
}
cout << answer << endl;
vector<int> dresses;
int matrix[201][2];
for(int i=0;i<D;i++){
for(int j=0;j<N;j++){
if(temp[i] >= dress[j].bottomtemp && temp[i] <= dress[j].toptemp){
dresses.push_back(dress[j].fancy);
}
}
sort(dresses.begin(),dresses.end());
matrix[i][0] = dresses[0];
matrix[i][1] = dresses[dresses.size() - 1];
}
int dp[201]={};
dp[0] = max(matrix[0][0],matrix[0][1]);
for(int i=1;i<D;i++){
dp[i] = max(abs(dp[i-1] - matrix[i][0]),abs(dp[i-1] - matrix[i][1]));
}
cout << dp[D-1] << endl;
*/
return 0;
} | a.cc:5:10: fatal error: cmath.h: No such file or directory
5 | #include <cmath.h>
| ^~~~~~~~~
compilation terminated.
|
s986829969 | p00502 | C++ | #include <iostream>
using namespace std;
int D, N;
int T[256], A[256], B[256], C[256];
int dp[256][256];
int rec(int day, int prev)
{
if(day == D) return 0;
}
int main()
{
memset(dp, 0, sizeof dp);
cin >> D >> N;
for(int i = 0; i < D; i++) {
cin >> T[i];
}
for(int i = 0; i < N; i++) {
cin >> A[i] >> B[i] >> C[i];
}
for(int day = 0; day < D-1; day++) {
for(int now = 0; now < N; now++) {
for(int next = 0; next < N; next++) {
if(A[now] <= T[day] && T[day] <= B[now] && A[next] <= T[day+1] && T[day+1] <= B[next]) {
dp[day+1][next] = max(dp[day+1][next], dp[day][now] + abs(C[now] - C[next]));
}
}
}
}
int ans = 0;
for(int i = 0; i < N; i++) {
ans = max(ans, dp[D-1][i]);
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:17:9: 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;
a.cc: In function 'int rec(int, int)':
a.cc:13:1: warning: control reaches end of non-void function [-Wreturn-type]
13 | }
| ^
|
s631248570 | p00502 | C++ | return 0;
}
return pointM;//自分の今までの派手さ絶対値の合計(今日ー昨日まで)
}
int main(void){
cin >> days;
cin >> clothes;
for(int i=0;i<days;i++){
cin >> temple[i];
}
for(int i=0;i<clothes;i++){
cin >> clothD[i][0];
cin >> clothD[i][1];
cin >> clothD[i][2];
}
for(int i=0;i<days;i++){
dayCanW[i]=0;
for(int j=0;j<clothes;j++){
dayM[i][j]=0;
}
}
/*
for(int i=0;i<days;i++){
for(int j=0;j<clothes;j++){
if(temple[i]>clothD[j][0] && temple[i]<clothD[j][1]){
dayM[i][j]=1;
dayCanW[i]+=1;
}
}
}
*/
cout << bestCloth(0,0) << endl;
} | a.cc:1:5: error: expected unqualified-id before 'return'
1 | return 0;
| ^~~~~~
a.cc:2:3: error: expected declaration before '}' token
2 | }
| ^
a.cc:3:3: error: expected unqualified-id before 'return'
3 | return pointM;//自分の今までの派手さ絶対値の合計(今日ー昨日まで)
| ^~~~~~
a.cc:4:1: error: expected declaration before '}' token
4 | }
| ^
a.cc: In function 'int main()':
a.cc:10:3: error: 'cin' was not declared in this scope
10 | cin >> days;
| ^~~
a.cc:10:10: error: 'days' was not declared in this scope
10 | cin >> days;
| ^~~~
a.cc:11:10: error: 'clothes' was not declared in this scope
11 | cin >> clothes;
| ^~~~~~~
a.cc:13:12: error: 'temple' was not declared in this scope
13 | cin >> temple[i];
| ^~~~~~
a.cc:16:12: error: 'clothD' was not declared in this scope
16 | cin >> clothD[i][0];
| ^~~~~~
a.cc:21:9: error: 'dayCanW' was not declared in this scope
21 | dayCanW[i]=0;
| ^~~~~~~
a.cc:23:9: error: 'dayM' was not declared in this scope
23 | dayM[i][j]=0;
| ^~~~
a.cc:36:3: error: 'cout' was not declared in this scope
36 | cout << bestCloth(0,0) << endl;
| ^~~~
a.cc:36:11: error: 'bestCloth' was not declared in this scope
36 | cout << bestCloth(0,0) << endl;
| ^~~~~~~~~
a.cc:36:29: error: 'endl' was not declared in this scope
36 | cout << bestCloth(0,0) << endl;
| ^~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.