submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s762165595 | p00480 | C++ | #include
#include
#include
using namespace std;
int main(void)
{
long long hist[100][21];
int n;
int form[100];
scanf("%d", &n);
for (int i = 0; i < n; i++){
scanf("%d", &form[i]);
}
memset(hist, 0, sizeof(hist));
hist[0][form[0]] = 1;
for (int i = 1; i < n - 1; i++){
for (int j = 0; j < 21; j++){
if (hist[i - 1][j] > 0){
if (j - form[i] >= 0 && j - form[i] <= 20)
hist[i][j - form[i]] += hist[i - 1][j];
if (j + form[i] >= 0 && j + form[i] <= 20)
hist[i][j + form[i]] += hist[i - 1][j];
}
}
}
cout << hist[n - 2][form[n - 1]] << endl;
return (0);
} | a.cc:1:10: error: #include expects "FILENAME" or <FILENAME>
1 | #include
| ^
a.cc:2:10: error: #include expects "FILENAME" or <FILENAME>
2 | #include
| ^
a.cc:3:10: error: #include expects "FILENAME" or <FILENAME>
3 | #include
| ^
a.cc: In function 'int main()':
a.cc:13:5: error: 'scanf' was not declared in this scope
13 | scanf("%d", &n);
| ^~~~~
a.cc:18:5: error: 'memset' was not declared in this scope
18 | memset(hist, 0, sizeof(hist));
| ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
+++ |+#include <cstring>
1 | #include
a.cc:32:5: error: 'cout' was not declared in this scope
32 | cout << hist[n - 2][form[n - 1]] << endl;
| ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #include
a.cc:32:41: error: 'endl' was not declared in this scope
32 | cout << hist[n - 2][form[n - 1]] << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #include
|
s086756802 | p00480 | C++ | a,d;int main(b){long long int t[21][2];for(scanf("%d%d",&a,&b);d<21;d++)t[d][a&1]=!(b-d);for(;--a-1&&scanf("%d",&b);)for(d=0;d<21;t[d++][a&1]=((b>d?0:t[d-b][!(a&1)])+((b<(21-d))?t[b+d][!(a&1)]:0)));scanf("%d",&b),printf("%lld",t[b][0]);} | a.cc:1:1: error: 'a' does not name a type
1 | a,d;int main(b){long long int t[21][2];for(scanf("%d%d",&a,&b);d<21;d++)t[d][a&1]=!(b-d);for(;--a-1&&scanf("%d",&b);)for(d=0;d<21;t[d++][a&1]=((b>d?0:t[d-b][!(a&1)])+((b<(21-d))?t[b+d][!(a&1)]:0)));scanf("%d",&b),printf("%lld",t[b][0]);}
| ^
a.cc:1:9: error: cannot declare '::main' to be a global variable
1 | a,d;int main(b){long long int t[21][2];for(scanf("%d%d",&a,&b);d<21;d++)t[d][a&1]=!(b-d);for(;--a-1&&scanf("%d",&b);)for(d=0;d<21;t[d++][a&1]=((b>d?0:t[d-b][!(a&1)])+((b<(21-d))?t[b+d][!(a&1)]:0)));scanf("%d",&b),printf("%lld",t[b][0]);}
| ^~~~
a.cc:1:14: error: 'b' was not declared in this scope
1 | a,d;int main(b){long long int t[21][2];for(scanf("%d%d",&a,&b);d<21;d++)t[d][a&1]=!(b-d);for(;--a-1&&scanf("%d",&b);)for(d=0;d<21;t[d++][a&1]=((b>d?0:t[d-b][!(a&1)])+((b<(21-d))?t[b+d][!(a&1)]:0)));scanf("%d",&b),printf("%lld",t[b][0]);}
| ^
|
s184783885 | p00480 | C++ |
#include<cstdio>
#include<cstring>
int main(){
int table[100][21],N,a;
memset(table,0,sizeof(table));
scanf("%d",&N);
scanf("%d",&a);
table[0][a]=1;
for(int i=1;i<N-1;i++){
scanf("%d",&a);
for(int j=0;j<=21;j++){
if(j+i<=21)table[i][j]+=table[j+i];
if(j-i<=21)table[i][j]+=table[j-i];
}
}
scanf("%d",&a);
printf("%d\n",table[N-2][a]);
} | a.cc: In function 'int main()':
a.cc:13:47: error: invalid conversion from 'int*' to 'int' [-fpermissive]
13 | if(j+i<=21)table[i][j]+=table[j+i];
| ~~~~~~~~~~~^~~~~~~~~~~~
| |
| int*
a.cc:14:47: error: invalid conversion from 'int*' to 'int' [-fpermissive]
14 | if(j-i<=21)table[i][j]+=table[j-i];
| ~~~~~~~~~~~^~~~~~~~~~~~
| |
| int*
|
s419421505 | p00480 | C++ | vector<int> nums;
ll dp[110][25];
ll dfs(int n, int sum){
ll result = 0;
if(sum < 0 || sum > 20) return 0;
if(dp[n][sum] >= 0) return dp[n][sum];
if(n == nums.size() - 1) {
if(nums[n] == sum) return 1;
}
result = dfs(n+1,sum + nums[n]) + dfs(n+1,sum - nums[n]);
return dp[n][sum] = result;
}
int main(){
int N;
rep(i,110)rep(j,25){
dp[i][j] = -1;
}
cin >> N;
rep(i,N){
int a;
cin >> a;
nums.pb(a);
}
cout << dfs(0,0);
return 0;
} | a.cc:1:1: error: 'vector' does not name a type
1 | vector<int> nums;
| ^~~~~~
a.cc:2:1: error: 'll' does not name a type
2 | ll dp[110][25];
| ^~
a.cc:3:1: error: 'll' does not name a type
3 | ll dfs(int n, int sum){
| ^~
a.cc: In function 'int main()':
a.cc:15:13: error: 'i' was not declared in this scope
15 | rep(i,110)rep(j,25){
| ^
a.cc:15:9: error: 'rep' was not declared in this scope
15 | rep(i,110)rep(j,25){
| ^~~
a.cc:18:9: error: 'cin' was not declared in this scope
18 | cin >> N;
| ^~~
a.cc:24:9: error: 'cout' was not declared in this scope
24 | cout << dfs(0,0);
| ^~~~
a.cc:24:17: error: 'dfs' was not declared in this scope
24 | cout << dfs(0,0);
| ^~~
|
s611402668 | p00480 | C++ | //情報オリンピック2010予選問4「一年生」#include<stdio.h> long long c[21]; void ck(int, int[], int); int main(void){ int n, f1, j[100]; long long out; scanf("%d",&n); for(f1 = 0; f1 < n; f1++) scanf("%d",&j[f1]); for(f1 = 0; f1 < 21; f1++) c[f1] = 0; c[ j[0] ] = 1; ck(n, j, 1); out = c[ j[n-1] ]; printf("%lld",out); return 0;}void ck(int s1, int l[100], int cnt){ int fs1, wa, sa; long long cl2[21]; if(cnt < s1-2){ for(fs1 = 0; fs1 < 21; fs1++) cl2[fs1] = 0; for(fs1 = 0; fs1 < 21; fs1++){ if(c[fs1] > 0){ wa = fs1 + l[cnt]; sa = fs1 - l[cnt]; if(wa <= 20) cl2[wa] += c[fs1]; if(sa >= 0) cl2[sa] += c[fs1]; } } for(fs1 = 0; fs1 < 21; fs1++) c[fs1] = cl2[fs1]; ck(s1,l,cnt+1); }} | /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
|
s327225961 | p00480 | C++ | #include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>
typedef long long ll;
using namespace std;
unsigned long long int dp[101][21];
int main(){
int n, a[101];
cin >> n;
for(int i=1; i<=n; ++i){
cin >> a[i];
}
dp[0][0] = 1;
for(int i=1; i<n; ++i){
for(int j=0; j<21; ++j){
if(j-a[i] >= 0){
dp[i][j] += dp[i-1][j-a[i]];
if(j+a[i] <= 20){
dp[i][j] += dp[i-1][j+a[i]];
}
if(i == 0 && a[i] == 0) dp[i][j] = dp[i-1][j];
}
}
cout << dp[n-1][a[n]] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:56:2: error: expected '}' at end of input
56 | }
| ^
a.cc:31:11: note: to match this '{'
31 | int main(){
| ^
|
s443417676 | p00480 | C++ | #include <iostream>
using namespace std;
typedef long long ll;
int main(){
int n, s, r;
cin >> n;
ll dp[101][40];
memset(dp, 0, sizeof(dp));
dp[0][9] = 1;
for(int i = 1; i < n; i++){
cin >> s;
for(int j = 9; j <= 29; j++){
if(dp[i-1][j] != 0){
dp[i][j+s] += dp[i-1][j];
dp[i][j-s] += dp[i-1][j];
}
}
}
cin >> r;
cout << dp[n-1][r+9] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:3: error: 'memset' was not declared in this scope
12 | 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 |
|
s266632268 | p00480 | C++ | #include <iostream>
using namespace std;
int dp[101][21];
int main(void){
int n;
cin >> n;
int num[101];
for( int i = 0 ; i < n ; i++ ){
cin >> num[i];
}
dp[0][num[0]] = 1;
for( int j = 1 ; j < n ; j++ ){
for( int i = 0 ; i < 21 ; i++ ){
if( i + num[j] <= 20 )
dp[j][i + num[j]] += dp[j][i];
if( i - num[j] >= 0 )
dp[j][i - num[j]] += dp[j][[i];
}
}
cout << dp[n - 2][num[n - 1]] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:35: error: two consecutive '[' shall only introduce an attribute before '[' token
23 | dp[j][i - num[j]] += dp[j][[i];
| ^
|
s939249283 | p00480 | C++ | //線形探索やら範囲探索?やらすると、計算量が半端ない。正解の解の数自体が多すぎるので、限定もしづらい。
//N回目に符号をつける数は、どのパターンでも一緒であるので、
//N-1回目までに演算して出てきた値が同じのものは、N回目の演算における結果が一致する。
//結果のバリエーションが少なく、結果が同じものはその前に依存せず、次の結果も同じになる。
//よって、結果によって処理をまとめておこなう、動的計画法とやらが使えそう。
#include<stdio.h>
int main(){
FILE *fp1,*fp2;
int num;
int i,j,d,ans;
long long data[99][21] = {0}; //data[i][j]には、i回目の演算でjという値がでる場合の数を保存.
fp1 = fopen("input.txt","r");
fp2 = fopen("output.txt","w");
fscanf(fp1,"%d",&num);
fscanf(fp1,"%d",&d); //最初の数字は0以上20以下である。
data[0][d] = 1;
for(i = 1;i < num-1;i++){
fscanf("%d",&d);
for(j = 0;j < 21;j++){
if(j+d <= 20)
data[i][j+d] = data[i-1][j]
if(j-d >= 0)
data[i][j-d] = data[i-1][j]
}
}
fscanf(fp1,"%d",&ans);
fprintf(fp2,"%I64d",data[98][ans]);
fclose(fp1);
fclose(fp2);
return 0;
} | a.cc: In function 'int main()':
a.cc:20:24: error: cannot convert 'const char*' to 'FILE*'
20 | fscanf("%d",&d);
| ^~~~
| |
| const char*
In file included from a.cc:6:
/usr/include/stdio.h:422:37: note: initializing argument 1 of 'int fscanf(FILE*, const char*, ...)'
422 | extern int fscanf (FILE *__restrict __stream,
| ~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:23:60: error: expected ';' before 'if'
23 | data[i][j+d] = data[i-1][j]
| ^
| ;
24 | if(j-d >= 0)
| ~~
|
s606494034 | p00480 | C++ | #include<iostream>
#include<math.h>
using namespace std;
long number[101];
long numbers[101][21][50];
int N;
int last;
long canNumber(long numbers[],int value,int time ){
int n=value;
long sum=0;
if(time==N-1){
if(value==last ){
return 1;
}
return 0;
}
if(value>=0 && value<=20 ){
sum+=canNumber(numbers,n+numbers[time+1],time+1);
sum+=canNumber(numbers,n-numbers[time+1],time+1);
}
cout << sum << endl;
return sum;
}
int main(void){
cin >> N;
N-=1;
for (int i=0;i<N;i++){
cin >> number[i];
}
cin >> last;
numbers[0][number[0]][0]=1;
for(int k=0;k<50;k++){
for(int i=1;i<N;i++){
for(int j=0;j<=20;j++){
if(j+number[i]>=0 && j+number[i] <=20 && numbers[i-1][j][k]!=0){
numbers[i][j+number[i]][k]+=numbers[i-1][j][k]%1000000;
numbers[i][j+number[i]][k+1]+=numbers[i-1][j][k]/1000000;
// cout << i <<" " << j+number[i]<<" "<< j << " " <<numbers[i-1][j][k]<< endl;
}
if(j-number[i]>=0 && j-number[i] <=20 && numbers[i-1][j][k]!=0){
numbers[i][j-number[i]][k]+=numbers[i-1][j][k]%1000000;
numbers[i][j-number[i]][k+1]+=numbers[i-1][j][k]/1000000;
// cout << i <<" " << j-number[i]<<" "<< j << " " <<numbers[i-1][j][k]<< endl;
}
}
}
}
for(int k=50;k>=0;k--){
if(numbers[N-1][last][k]!=0){
cout << (numbers[N-1][last][k]%1000000)+(numbers[N-1][last][k-1]/1000000);
if(numbers[N-1][last][k-1]%1000000<pow(10,5) && k!=0)// && k-1==0)
{
cout << 0 ;
}
}
}
cout<<endl;
return 0;
}
} | a.cc:72:1: error: expected declaration before '}' token
72 | }
| ^
|
s242754429 | p00480 | C++ | #include<iostream>
using namespace std;
long number[101];
long numbers[101][21][50];
int N;
int last;
long canNumber(long numbers[],int value,int time ){
int n=value;
long sum=0;
if(time==N-1){
if(value==last ){
return 1;
}
return 0;
}
if(value>=0 && value<=20 ){
sum+=canNumber(numbers,n+numbers[time+1],time+1);
sum+=canNumber(numbers,n-numbers[time+1],time+1);
}
cout << sum << endl;
return sum;
}
int main(void){
cin >> N;
N-=1;
for (int i=0;i<N;i++){
cin >> number[i];
}
cin >> last;
numbers[0][number[0]][0]=1;
for(int k=0;k<50;k++){
for(int i=1;i<N;i++){
for(int j=0;j<=20;j++){
if(j+number[i]>=0 && j+number[i] <=20 && numbers[i-1][j][k]!=0){
numbers[i][j+number[i]][k]+=numbers[i-1][j][k]%1000000;
numbers[i][j+number[i]][k+1]+=numbers[i-1][j][k]/1000000;
// cout << i <<" " << j+number[i]<<" "<< j << " " <<numbers[i-1][j][k]<< endl;
}
if(j-number[i]>=0 && j-number[i] <=20 && numbers[i-1][j][k]!=0){
numbers[i][j-number[i]][k]+=numbers[i-1][j][k]%1000000;
numbers[i][j-number[i]][k+1]+=numbers[i-1][j][k]/1000000;
// cout << i <<" " << j-number[i]<<" "<< j << " " <<numbers[i-1][j][k]<< endl;
}
}
}
}
for(int k=50;k>=0;k--){
if(numbers[N-1][last][k]!=0){
cout << (numbers[N-1][last][k]%1000000)+(numbers[N-1][last][k-1]/1000000);
if(numbers[N-1][last][k-1]%1000000<10000 && k!=0)// && k-1==0)
{
cout << 0 ;
}
}
}
cout<<endl;
return 0;
}
} | a.cc:72:1: error: expected declaration before '}' token
72 | }
| ^
|
s405456545 | p00480 | C++ | #include<iostream>
using namespace std;
long number[101];
long numbers[101][21][50];
int N;
int last;
long canNumber(long numbers[],int value,int time ){
int n=value;
long sum=0;
if(time==N-1){
if(value==last ){
return 1;
}
return 0;
}
if(value>=0 && value<=20 ){
sum+=canNumber(numbers,n+numbers[time+1],time+1);
sum+=canNumber(numbers,n-numbers[time+1],time+1);
}
cout << sum << endl;
return sum;
}
int main(void){
cin >> N;
N-=1;
for (int i=0;i<N;i++){
cin >> number[i];
}
cin >> last;
numbers[0][number[0]][0]=1;
for(int k=0;k<50;k++){
for(int i=1;i<N;i++){
for(int j=0;j<=20;j++){
if(j+number[i]>=0 && j+number[i] <=20 && numbers[i-1][j][k]!=0){
numbers[i][j+number[i]][k]+=numbers[i-1][j][k]%1000000;
numbers[i][j+number[i]][k+1]+=numbers[i-1][j][k]/1000000;
// cout << i <<" " << j+number[i]<<" "<< j << " " <<numbers[i-1][j][k]<< endl;
}
if(j-number[i]>=0 && j-number[i] <=20 && numbers[i-1][j][k]!=0){
numbers[i][j-number[i]][k]+=numbers[i-1][j][k]%1000000;
numbers[i][j-number[i]][k+1]+=numbers[i-1][j][k]/1000000;
// cout << i <<" " << j-number[i]<<" "<< j << " " <<numbers[i-1][j][k]<< endl;
}
}
}
}
for(int k=50;k>=0;k--){
if(numbers[N-1][last][k]!=0){
cout << (numbers[N-1][last][k]%1000000)+(numbers[N-1][last][k-1]/1000000);
if(numbers[N-1][last][k-1]%1000000<10000 && k!=0)// && k-1==0)
{
cout << 0 ;
}
}
}
cout<<endl;
return 0;
}
} | a.cc:72:1: error: expected declaration before '}' token
72 | }
| ^
|
s093976535 | p00480 | C++ | #include <stdio.h>
long long int main(){
long long int resultcalc, result;
long long int dp[101][21] = {0};
int plus[100] = {0};
int number, i, j, k;
scanf("%d", &number);
for(i = 1;i <= number - 1;i++){
scanf("%d ", &plus[i]);
}
scanf("%d", &resultcalc);
dp[0][0] = 1;
for(j = 1;j < number;j++){
for(k = 0;k <= 20;k++){
if(dp[j - 1][k] > 0){
if(k + plus[j] <= 20)dp[j][k + plus[j]] += dp[j - 1][k];
if(k - plus[j] >= 0)dp[j][k - plus[j]] += dp[j - 1][k];
}
}
}
result = dp[number - 1][resultcalc];
printf("%lld\n", result);
return 0;
} | a.cc:3:11: error: '::main' must return 'int'
3 | long long int main(){
| ^~~
|
s634297859 | p00480 | C++ | #include<iostream>
int n;
int v[101];
long long dp[101][21];
long long calc(int i,int j){
if(j>20||j<0)return 0;
if(dp[i][j]!=-1)return dp[i][j];
if(i==n-1&&j==v[n-1])return 1;
else if(i==n-1&&j!=v[n-1])return 0;
long long ans=0;
ans+=calc(i+1,j+v[i]);
ans+=calc(i+1,j-v[i]);
return dp[i][j]=ans;
}
int main(){
memset(dp,-1,sizeof(dp));
std::cin>>n;
for(int i=0;i<n;i++)std::cin>>v[i];
std::cout<<calc(1,v[0])<<std::endl;;
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:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 |
|
s651010731 | p00480 | C++ | #include <iostream>
#include <vector>
using namespace std;
#define rep(i, n) for( int i = 0; i < n; i++ )
typedef vector<int> vec;
int main(){
int n;
cin >> n;
vec fml(n);
rep(i, n){
cin >> fml[i];
}
long long int dp[101][21];
memset( dp, 0, sizeof(dp) );
dp[1][fml[0]] = 1;
rep(i, n-1){
rep(j, 21){
if( dp[i][j] > 0 ){
int plus = j + fml[i];
int minus = j - fml[i];
if( plus <= 20 ) dp[i+1][plus] += dp[i][j];
if( minus >= 0 ) dp[i+1][minus] += dp[i][j];
}
}
}
cout << dp[n-1][fml[n-1]] << endl;
} | a.cc: In function 'int main()':
a.cc:15:5: error: 'memset' was not declared in this scope
15 | memset( dp, 0, sizeof(dp) );
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 | using namespace std;
|
s700849587 | p00480 | C++ | #include <iostream>
#include <vector>
#include <string>
using namespace std;
#define rep(i, n) for( int i = 0; i < n; i++ )
typedef vector<int> vec;
int main(){
int n;
cin >> n;
vec fml(n);
rep(i, n){
cin >> fml[i];
}
long long int dp[101][21];
memset( dp, 0, sizeof(dp) );
dp[1][fml[0]] = 1;
rep(i, n-1){
rep(j, 21){
if( dp[i][j] > 0 ){
int plus = j + fml[i];
int minus = j - fml[i];
if( plus <= 20 ) dp[i+1][plus] += dp[i][j];
if( minus >= 0 ) dp[i+1][minus] += dp[i][j];
}
}
}
cout << dp[n-1][fml[n-1]] << endl;
} | a.cc: In function 'int main()':
a.cc:16:5: error: 'memset' was not declared in this scope
16 | memset( dp, 0, sizeof(dp) );
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 | #include <string>
|
s596975386 | p00480 | C++ | #include <iostream>
#include <vector>
#include <string>
using namespace std;
#define rep(i, n) for( int i = 0; i < n; i++ )
typedef vector<int> vec;
int main(){
int n;
cin >> n;
vec fml(n);
rep(i, n){
int num;
cin >> num;
fml[i] = num;
}
long long int dp[101][21];
memset( dp, 0, sizeof(dp) );
dp[1][fml[0]] = 1;
rep(i, n-1){
rep(j, 21){
if( dp[i][j] > 0 ){
int plus = j + fml[i];
int minus = j - fml[i];
if( plus <= 20 ) dp[i+1][plus] += dp[i][j];
if( minus >= 0 ) dp[i+1][minus] += dp[i][j];
}
}
}
cout << dp[n-1][fml[n-1]] << endl;
} | a.cc: In function 'int main()':
a.cc:18:5: error: 'memset' was not declared in this scope
18 | memset( dp, 0, sizeof(dp) );
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 | #include <string>
|
s755730472 | p00480 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <cstdio>
using namespace std;
#define rep(i, n) for( int i = 0; i < n; i++ )
typedef vector<int> vec;
int main(){
int n;
cin >> n;
vec fml(n);
rep(i, n){
cin >> fml[i];
}
long long int dp[101][21];
memset( dp, 0, sizeof(dp) );
dp[1][fml[0]] = 1;
rep(i, n-1){
rep(j, 21){
if( dp[i][j] > 0 ){
int plus = j + fml[i];
int minus = j - fml[i];
if( plus <= 20 ) dp[i+1][plus] += dp[i][j];
if( minus >= 0 ) dp[i+1][minus] += dp[i][j];
}
}
}
cout << dp[n-1][fml[n-1]] << endl;
} | a.cc: In function 'int main()':
a.cc:17:5: error: 'memset' was not declared in this scope
17 | memset( dp, 0, sizeof(dp) );
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <cstdio>
+++ |+#include <cstring>
5 | using namespace std;
|
s342176847 | p00480 | C++ | #include <iostream>
#include <vector>
#include <string>
using namespace std;
#define rep(i, n) for( int i = 0; i < n; i++ )
typedef vector<int> vec;
int main(){
int n;
cin >> n;
vec fml(n);
rep(i, n){
cin >> fml[i];
}
long long int dp[101][21];
memset( dp, 0, sizeof(dp) );
dp[1][fml[0]] = 1;
rep(i, n-1){
rep(j, 21){
if( dp[i][j] > 0 ){
int plus = j + fml[i];
int minus = j - fml[i];
if( plus <= 20 ) dp[i+1][plus] += dp[i][j];
if( minus >= 0 ) dp[i+1][minus] += dp[i][j];
}
}
}
cout << dp[n-1][fml[n-1]] << endl;
} | a.cc: In function 'int main()':
a.cc:16:5: error: 'memset' was not declared in this scope
16 | memset( dp, 0, sizeof(dp) );
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 | #include <string>
|
s377618341 | p00480 | C++ | #include<iostream>
using namespace std;
#define MAX 110
long long int DP[MAX][MAX];
int target;
int input[MAX];
int n;
int dfs_end;
long long int dfs(int now , int sum)
{
if (now == dfs_end)
{
if (sum == target)
{
return 1;
}
return 0;
}
if (sum > 20 || 0 > sum)
{
return 0;
}
if (DP[now][sum] != 0)
{
return DP[now][sum];
}
DP[now][sum] += dfs(now + 1 , sum + input[now]);
DP[now][sum] += dfs(now + 1 , sum - input[now]);
}
int main()
{
cin >> n;
memset(DP , 0 , sizeof(DP));
for (int i = 0; i < n; i++)
{
cin >> input[i];
}
target = input[n - 1];
dfs_end = n - 1;
dfs(0 , 0);
cout << DP[0][0] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:42:9: error: 'memset' was not declared in this scope
42 | 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 |
a.cc: In function 'long long int dfs(int, int)':
a.cc:33:22: warning: control reaches end of non-void function [-Wreturn-type]
33 | DP[now][sum] += dfs(now + 1 , sum - input[now]);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s093433704 | p00480 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
typedef long long Int;
Int dp[105][25];
int main(){
cin >> n;
for(int i = 0;i < n - 1;i++)cin >> num[i];
cin >> ans;
dp[0][num[0]] = 1;
for(int i = 1;i < n - 1;i++){
for(int j = 0;j < 20;j++){
if(j - num[i] >= 0)dp[i][j] += dp[i - 1][j - num[i]];
if(j + num[i] <= 20)dp[i][j] += dp[i - 1][j + num[i]];
}
}
cout << dp[n - 1][ans] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:9: error: 'n' was not declared in this scope
10 | cin >> n;
| ^
a.cc:11:37: error: 'num' was not declared in this scope; did you mean 'enum'?
11 | for(int i = 0;i < n - 1;i++)cin >> num[i];
| ^~~
| enum
a.cc:12:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
12 | cin >> ans;
| ^~~
| abs
a.cc:13:8: error: 'num' was not declared in this scope; did you mean 'enum'?
13 | dp[0][num[0]] = 1;
| ^~~
| enum
|
s559376163 | p00480 | C++ | #include<iostream>#include<string>using namespace std;long long dp[100][21];int N, num[100];long long dfs(int i, int v){ if(dp[i][v] != -1) return dp[i][v]; if(i == N - 1) return v == num[N - 1] ? 1 : 0; int plus = v num[i]; int minus = v - num[i]; long long n = 0; if(plus >= 0 | a.cc:1:19: warning: extra tokens at end of #include directive
1 | #include<iostream>#include<string>using namespace std;long long dp[100][21];int N, num[100];long long dfs(int i, int v){ if(dp[i][v] != -1) return dp[i][v]; if(i == N - 1) return v == num[N - 1] ? 1 : 0; int plus = v num[i]; int minus = v - num[i]; long long n = 0; if(plus >= 0
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s009843407 | p00480 | C++ |
#include<iostream>
#include<string>
using namespace std;
long long dp[100][21];
int N, num[100];
long long dfs(int i, int v)
{
if(dp[i][v] != -1)
return dp[i][v];
if(i == N - 1)
return v == num[N - 1] ? 1 : 0;
int plus = v num[i];
int minus = v - num[i];
long long n = 0;
if(plus >= 0 | a.cc: In function 'long long int dfs(int, int)':
a.cc:15:18: error: expected ',' or ';' before 'num'
15 | int plus = v num[i];
| ^~~
a.cc:18:15: error: expected ')' at end of input
18 | if(plus >= 0
| ~ ^
| )
a.cc:18:15: error: expected statement at end of input
a.cc:18:15: error: expected '}' at end of input
a.cc:10:1: note: to match this '{'
10 | {
| ^
a.cc:18:15: warning: control reaches end of non-void function [-Wreturn-type]
18 | if(plus >= 0
| ^
|
s473969440 | p00480 | C++ |
#include<iostream>
#include<string>
using namespace std;
long long dp[100][21];
int N, num[100];
long long dfs(int i, int v)
{
if(dp[i][v] != -1)
return dp[i][v];
if(i == N - 1)
return v == num[N - 1] ? 1 : 0;
int plus = v num[i];
int minus = v - num[i];
long long n = 0;
if(plus >= 0 | a.cc: In function 'long long int dfs(int, int)':
a.cc:15:18: error: expected ',' or ';' before 'num'
15 | int plus = v num[i];
| ^~~
a.cc:18:15: error: expected ')' at end of input
18 | if(plus >= 0
| ~ ^
| )
a.cc:18:15: error: expected statement at end of input
a.cc:18:15: error: expected '}' at end of input
a.cc:10:1: note: to match this '{'
10 | {
| ^
a.cc:18:15: warning: control reaches end of non-void function [-Wreturn-type]
18 | if(plus >= 0
| ^
|
s625119909 | p00480 | C++ |
#include<iostream>
#include<string>
using namespace std;
long long dp[100][21];
int N, num[100];
long long dfs(int i, int v)
{
if(dp[i][v] != -1)
return dp[i][v];
if(i == N - 1)
return v == num[N - 1] ? 1 : 0;
int plus = v num[i];
int minus = v - num[i];
long long n = 0;
if(plus >= 0 | a.cc: In function 'long long int dfs(int, int)':
a.cc:15:18: error: expected ',' or ';' before 'num'
15 | int plus = v num[i];
| ^~~
a.cc:18:15: error: expected ')' at end of input
18 | if(plus >= 0
| ~ ^
| )
a.cc:18:15: error: expected statement at end of input
a.cc:18:15: error: expected '}' at end of input
a.cc:10:1: note: to match this '{'
10 | {
| ^
a.cc:18:15: warning: control reaches end of non-void function [-Wreturn-type]
18 | if(plus >= 0
| ^
|
s999800464 | p00480 | C++ |
#include<iostream>
#include<string>
using namespace std;
long long dp[100][21];
int N, num[100];
long long dfs(int i, int v)
{
if(dp[i][v] != -1)
return dp[i][v];
if(i == N - 1)
return v == num[N - 1] ? 1 : 0;
int plus = v num[i];
int minus = v - num[i];
long long n = 0;
if(plus >= 0 \ | a.cc:18:16: error: stray '\' in program
18 | if(plus >= 0 \
| ^
a.cc: In function 'long long int dfs(int, int)':
a.cc:15:18: error: expected ',' or ';' before 'num'
15 | int plus = v num[i];
| ^~~
a.cc:18:15: error: expected ')' at end of input
18 | if(plus >= 0 \
| ~ ^
| )
a.cc:18:15: error: expected statement at end of input
a.cc:18:15: error: expected '}' at end of input
a.cc:10:1: note: to match this '{'
10 | {
| ^
a.cc:18:15: warning: control reaches end of non-void function [-Wreturn-type]
18 | if(plus >= 0 \
| ^
|
s911343702 | p00480 | C++ |
#include<iostream>
#include<string>
using namespace std;
long long dp[100][21];
int N, num[100];
long long dfs(int i, int v)
{
if(dp[i][v] != -1)
return dp[i][v];
if(i == N - 1)
return v == num[N - 1] ? 1 : 0;
int plus = v num[i];
int minus = v - num[i];
long long n = 0;
if(plus >= 0 && plus <= 20)
n = dfs(i 1, plus);
if(minus >= 0 && minus <= 20)
n = dfs(i 1, minus);
dp[i][v] = n;
return n;
}
int main()
{
for(int i = 0; i < 100; i )
for(int j = 0; j < 21; j )
dp[i][j] = -1;
cin >> N;
for(int i = 0; i < N; i )
cin >> num[i];
cout << dfs(0, 0) << endl;
} | a.cc: In function 'long long int dfs(int, int)':
a.cc:15:18: error: expected ',' or ';' before 'num'
15 | int plus = v num[i];
| ^~~
a.cc:19:15: error: expected ')' before numeric constant
19 | n = dfs(i 1, plus);
| ~ ^ ~
| )
a.cc:21:15: error: expected ')' before numeric constant
21 | n = dfs(i 1, minus);
| ~ ^ ~
| )
|
s750706769 | p00480 | C++ |
=23include=3Ciostream=3E
=23include=3Cstring=3E
using=20namespace=20std=3B
long=20long=20dp=5B100=5D=5B21=5D=3B
int=20N=2C=20num=5B100=5D=3B
long=20long=20dfs=28int=20i=2C=20int=20v=29
=7B
=20=20if=28dp=5Bi=5D=5Bv=5D=20=21=3D=20=2D1=29
=20=20=20=20return=20dp=5Bi=5D=5Bv=5D=3B
=20=20if=28i=20=3D=3D=20N=20=2D=201=29
=20=20=20=20return=20v=20=3D=3D=20num=5BN=20=2D=201=5D=20=3F=201=20=3A=20=
0=3B
=20=20int=20plus=20=3D=20v=20=2B=20num=5Bi=5D=3B
=20=20int=20minus=20=3D=20v=20=2D=20num=5Bi=5D=3B
=20=20long=20long=20n=20=3D=200=3B
=20=20if=28plus=20=3E=3D=200=20=26=26=20plus=20=3C=3D=2020=29
=20=20=20=20n=20=2B=3D=20dfs=28i=20=2B=201=2C=20plus=29=3B
=20=20if=28minus=20=3E=3D=200=20=26=26=20minus=20=3C=3D=2020=29
=20=20=20=20n=20=2B=3D=20dfs=28i=20=2B=201=2C=20minus=29=3B
=20=20dp=5Bi=5D=5Bv=5D=20=3D=20n=3B
=20=20return=20n=3B
=7D
int=20main=28=29
=7B
=20=20for=28int=20i=20=3D=200=3B=20i=20=3C=20100=3B=20i=2B=2B=29
=20=20=20=20for=28int=20j=20=3D=200=3B=20j=20=3C=2021=3B=20j=2B=2B=29
=20=20=20=20=20=20dp=5Bi=5D=5Bj=5D=20=3D=20=2D1=3B
=20=20cin=20=3E=3E=20N=3B
=20=20for=28int=20i=20=3D=200=3B=20i=20=3C=20N=3B=20i=2B=2B=29
=20=20=20=20cin=20=3E=3E=20num=5Bi=5D=3B
=20=20cout=20=3C=3C=20dfs=280=2C=200=29=20=3C=3C=20endl=3B
=7D | a.cc:2:23: error: exponent has no digits
2 | =23include=3Ciostream=3E
| ^~
a.cc:3:21: error: exponent has no digits
3 | =23include=3Cstring=3E
| ^~
a.cc:19:20: error: exponent has no digits
19 | =20=20if=28plus=20=3E=3D=200=20=26=26=20plus=20=3C=3D=2020=29
| ^~
a.cc:21:21: error: exponent has no digits
21 | =20=20if=28minus=20=3E=3D=200=20=26=26=20minus=20=3C=3D=2020=29
| ^~
a.cc:32:14: error: exponent has no digits
32 | =20=20cin=20=3E=3E=20N=3B
| ^~
a.cc:32:17: error: exponent has no digits
32 | =20=20cin=20=3E=3E=20N=3B
| ^~
a.cc:34:20: error: exponent has no digits
34 | =20=20=20=20cin=20=3E=3E=20num=5Bi=5D=3B
| ^~
a.cc:34:23: error: exponent has no digits
34 | =20=20=20=20cin=20=3E=3E=20num=5Bi=5D=3B
| ^~
a.cc:35:50: error: exponent has no digits
35 | =20=20cout=20=3C=3C=20dfs=280=2C=200=29=20=3C=3C=20endl=3B
| ^~~~~~
a.cc:2:1: error: expected unqualified-id before '=' token
2 | =23include=3Ciostream=3E
| ^
|
s243325671 | p00480 | C++ | null | a.cc:1:1: error: 'null' does not name a type
1 | null
| ^~~~
|
s091281727 | p00480 | C++ | null | a.cc:1:1: error: 'null' does not name a type
1 | null
| ^~~~
|
s622542843 | p00480 | C++ | null | a.cc:1:1: error: 'null' does not name a type
1 | null
| ^~~~
|
s414060571 | p00480 | C++ |
#include<iostream>
#include<string>
using namespace std;
long long dp[100][21];
int N, num[100];
long long dfs(int i, int v)
{
if(dp[i][v] != -1)
return dp[i][v];
if(i == N - 1)
return v == num[N - 1] ? 1 : 0;
int plus = v \ num[i];
int minus = v - num[i];
long long n = 0;
if(plus >= 0 \ | a.cc:15:16: error: stray '\' in program
15 | int plus = v \ num[i];
| ^
a.cc:18:16: error: stray '\' in program
18 | if(plus >= 0 \
| ^
a.cc: In function 'long long int dfs(int, int)':
a.cc:15:19: error: expected ',' or ';' before 'num'
15 | int plus = v \ num[i];
| ^~~
a.cc:18:15: error: expected ')' at end of input
18 | if(plus >= 0 \
| ~ ^
| )
a.cc:18:15: error: expected statement at end of input
a.cc:18:15: error: expected '}' at end of input
a.cc:10:1: note: to match this '{'
10 | {
| ^
a.cc:18:15: warning: control reaches end of non-void function [-Wreturn-type]
18 | if(plus >= 0 \
| ^
|
s222823077 | p00480 | C++ | //まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>
//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;
//可読性を上げるためのdefineが仇となる典型的パターン
#define rep(i,x) for(int i = 0; i < x; i++)
//ローカル変数とグローバル変数は使い分けよう!
stack<short> x, y;
short h, m, a[100], n, i;
long long int ans;
//関数って楽しいよね!(魔王スマイル)
void solve(short i, short sum){
if(i == n - 1){
if(sum == a[n - 1]) ans++;
return;
}
if(sum < 0 || sum > 20) return;
solve(i + 1, sum + a[i]);
solve(i + 1, sum - a[i]);
}
int main(){
scanf("%d", &n);
ans = 0;
for(i = 0; i < n; i++) scanf("%d", a[i]);
solve(0, 0);
printf("%lld\n", ans);
return 0;
}
//まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>
//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;
//可読性を上げるためのdefineが仇となる典型的パターン
#define rep(i,x) for(int i = 0; i < x; i++)
//ローカル変数とグローバル変数は使い分けよう!
stack<short> x, y;
short h, m, a[100], n, i;
long long int ans;
//関数って楽しいよね!(魔王スマイル)
void solve(short i, short sum){
if(i == n - 1){
if(sum == a[n - 1]) ans++;
return;
}
if(sum < 0 || sum > 20) return;
solve(i + 1, sum + a[i]);
solve(i + 1, sum - a[i]);
}
int main(){
scanf("%d", &n);
ans = 0;
for(i = 0; i < n; i++) scanf("%d", a[i]);
solve(0, 0);
printf("%lld\n", ans);
return 0;
} | a.cc:72:14: error: redefinition of 'std::stack<short int> x'
72 | stack<short> x, y;
| ^
a.cc:25:14: note: 'std::stack<short int> x' previously declared here
25 | stack<short> x, y;
| ^
a.cc:72:17: error: redefinition of 'std::stack<short int> y'
72 | stack<short> x, y;
| ^
a.cc:25:17: note: 'std::stack<short int> y' previously declared here
25 | stack<short> x, y;
| ^
a.cc:73:7: error: redefinition of 'short int h'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:7: note: 'short int h' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:10: error: redefinition of 'short int m'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:10: note: 'short int m' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:13: error: redefinition of 'short int a [100]'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:13: note: 'short int a [100]' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:21: error: redefinition of 'short int n'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:21: note: 'short int n' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:24: error: redefinition of 'short int i'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:24: note: 'short int i' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:74:15: error: redefinition of 'long long int ans'
74 | long long int ans;
| ^~~
a.cc:27:15: note: 'long long int ans' previously declared here
27 | long long int ans;
| ^~~
a.cc:77:6: error: redefinition of 'void solve(short int, short int)'
77 | void solve(short i, short sum){
| ^~~~~
a.cc:30:6: note: 'void solve(short int, short int)' previously defined here
30 | void solve(short i, short sum){
| ^~~~~
a.cc:87:5: error: redefinition of 'int main()'
87 | int main(){
| ^~~~
a.cc:40:5: note: 'int main()' previously defined here
40 | int main(){
| ^~~~
|
s600531304 | p00480 | C++ | //まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>
//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;
//可読性を上げるためのdefineが仇となる典型的パターン
#define rep(i,x) for(int i = 0; i < x; i++)
//ローカル変数とグローバル変数は使い分けよう!
stack<short> x, y;
short h, m, a[100], n, i;
long long int ans;
//関数って楽しいよね!(魔王スマイル)
void solve(short i, short sum){
if(i == n - 1){
if(sum == a[n - 1]) ans++;
return;
}
if(sum < 0 || sum > 20) return;
solve(i + 1, sum + a[i]);
solve(i + 1, sum - a[i]);
}
int main(){
scanf("%d", &n);
ans = 0;
for(i = 0; i < n; i++) scanf("%d", a[i]);
solve(0, 0);
printf("%lld\n", ans);
return 0;
}
//まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>
//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;
//可読性を上げるためのdefineが仇となる典型的パターン
#define rep(i,x) for(int i = 0; i < x; i++)
//ローカル変数とグローバル変数は使い分けよう!
stack<short> x, y;
short h, m, a[100], n, i;
long long int ans;
//関数って楽しいよね!(魔王スマイル)
void solve(short i, short sum){
if(i == n - 1){
if(sum == a[n - 1]) ans++;
return;
}
if(sum < 0 || sum > 20) return;
solve(i + 1, sum + a[i]);
solve(i + 1, sum - a[i]);
return;
}
int main(){
scanf("%d", &n);
ans = 0;
for(i = 0; i < n; i++) scanf("%d", a[i]);
solve(0, 0);
printf("%lld\n", ans);
return 0;
} | a.cc:72:14: error: redefinition of 'std::stack<short int> x'
72 | stack<short> x, y;
| ^
a.cc:25:14: note: 'std::stack<short int> x' previously declared here
25 | stack<short> x, y;
| ^
a.cc:72:17: error: redefinition of 'std::stack<short int> y'
72 | stack<short> x, y;
| ^
a.cc:25:17: note: 'std::stack<short int> y' previously declared here
25 | stack<short> x, y;
| ^
a.cc:73:7: error: redefinition of 'short int h'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:7: note: 'short int h' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:10: error: redefinition of 'short int m'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:10: note: 'short int m' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:13: error: redefinition of 'short int a [100]'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:13: note: 'short int a [100]' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:21: error: redefinition of 'short int n'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:21: note: 'short int n' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:24: error: redefinition of 'short int i'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:24: note: 'short int i' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:74:15: error: redefinition of 'long long int ans'
74 | long long int ans;
| ^~~
a.cc:27:15: note: 'long long int ans' previously declared here
27 | long long int ans;
| ^~~
a.cc:77:6: error: redefinition of 'void solve(short int, short int)'
77 | void solve(short i, short sum){
| ^~~~~
a.cc:30:6: note: 'void solve(short int, short int)' previously defined here
30 | void solve(short i, short sum){
| ^~~~~
a.cc:88:5: error: redefinition of 'int main()'
88 | int main(){
| ^~~~
a.cc:40:5: note: 'int main()' previously defined here
40 | int main(){
| ^~~~
|
s105930519 | p00480 | C++ | //まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>
//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;
//可読性を上げるためのdefineが仇となる典型的パターン
#define rep(i,x) for(int i = 0; i < x; i++)
//ローカル変数とグローバル変数は使い分けよう!
stack<short> x, y;
short h, m, a[100], n, i;
long long int ans;
//関数って楽しいよね!(魔王スマイル)
void solve(short i, short sum){
if(i == n - 1){
if(sum == a[n - 1]) ans++;
return;
}
if(sum < 0 || sum > 20) return;
solve(i + 1, sum + a[i]);
solve(i + 1, sum - a[i]);
}
int main(){
scanf("%d", &n);
ans = 0;
for(i = 0; i < n; i++) scanf("%d", a[i]);
solve(0, 0);
printf("%lld\n", ans);
return 0;
}
//まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>
//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;
//可読性を上げるためのdefineが仇となる典型的パターン
#define rep(i,x) for(int i = 0; i < x; i++)
//ローカル変数とグローバル変数は使い分けよう!
stack<short> x, y;
short h, m, a[100], n, i;
long long int ans;
//関数って楽しいよね!(魔王スマイル)
void solve(short i, int sum){
if(i == n - 1){
if(sum == a[n - 1]) ans++;
return;
}
if(sum < 0 || sum > 20) return;
solve(i + 1, sum + a[i]);
solve(i + 1, sum - a[i]);
return;
}
int main(){
scanf("%d", &n);
ans = 0;
for(i = 0; i < n; i++) scanf("%d", a[i]);
solve(0, 0);
printf("%lld\n", ans);
return 0;
} | a.cc:72:14: error: redefinition of 'std::stack<short int> x'
72 | stack<short> x, y;
| ^
a.cc:25:14: note: 'std::stack<short int> x' previously declared here
25 | stack<short> x, y;
| ^
a.cc:72:17: error: redefinition of 'std::stack<short int> y'
72 | stack<short> x, y;
| ^
a.cc:25:17: note: 'std::stack<short int> y' previously declared here
25 | stack<short> x, y;
| ^
a.cc:73:7: error: redefinition of 'short int h'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:7: note: 'short int h' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:10: error: redefinition of 'short int m'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:10: note: 'short int m' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:13: error: redefinition of 'short int a [100]'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:13: note: 'short int a [100]' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:21: error: redefinition of 'short int n'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:21: note: 'short int n' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:24: error: redefinition of 'short int i'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:24: note: 'short int i' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:74:15: error: redefinition of 'long long int ans'
74 | long long int ans;
| ^~~
a.cc:27:15: note: 'long long int ans' previously declared here
27 | long long int ans;
| ^~~
a.cc:88:5: error: redefinition of 'int main()'
88 | int main(){
| ^~~~
a.cc:40:5: note: 'int main()' previously defined here
40 | int main(){
| ^~~~
|
s285264520 | p00480 | C++ | //まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>
//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;
//可読性を上げるためのdefineが仇となる典型的パターン
#define rep(i,x) for(int i = 0; i < x; i++)
//ローカル変数とグローバル変数は使い分けよう!
stack<short> x, y;
short h, m, a[100], n, i;
long long int ans;
//関数って楽しいよね!(魔王スマイル)
void solve(short i, short sum){
if(i == n - 1){
if(sum == a[n - 1]) ans++;
return;
}
if(sum < 0 || sum > 20) return;
solve(i + 1, sum + a[i]);
solve(i + 1, sum - a[i]);
}
int main(){
scanf("%d", &n);
ans = 0;
for(i = 0; i < n; i++) scanf("%d", a[i]);
solve(0, 0);
printf("%lld\n", ans);
return 0;
}
//まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>
//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;
//可読性を上げるためのdefineが仇となる典型的パターン
#define rep(i,x) for(int i = 0; i < x; i++)
//ローカル変数とグローバル変数は使い分けよう!
stack<short> x, y;
short h, m, a[100], n, i;
long long int ans;
//関数って楽しいよね!(魔王スマイル)
void solve(short i, int sum){
if(i == n
){
if(sum == a[n - 1]) ans++;
return;
}
if(sum < 0 || sum > 20) return;
solve(i + 1, sum + a[i]);
solve(i + 1, sum - a[i]);
return;
}
int main(){
scanf("%d", &n);
ans = 0;
for(i = 0; i < n; i++) scanf("%d", a[i]);
solve(0, 0);
printf("%lld\n", ans);
return 0;
} | a.cc:72:14: error: redefinition of 'std::stack<short int> x'
72 | stack<short> x, y;
| ^
a.cc:25:14: note: 'std::stack<short int> x' previously declared here
25 | stack<short> x, y;
| ^
a.cc:72:17: error: redefinition of 'std::stack<short int> y'
72 | stack<short> x, y;
| ^
a.cc:25:17: note: 'std::stack<short int> y' previously declared here
25 | stack<short> x, y;
| ^
a.cc:73:7: error: redefinition of 'short int h'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:7: note: 'short int h' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:10: error: redefinition of 'short int m'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:10: note: 'short int m' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:13: error: redefinition of 'short int a [100]'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:13: note: 'short int a [100]' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:21: error: redefinition of 'short int n'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:21: note: 'short int n' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:24: error: redefinition of 'short int i'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:24: note: 'short int i' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:74:15: error: redefinition of 'long long int ans'
74 | long long int ans;
| ^~~
a.cc:27:15: note: 'long long int ans' previously declared here
27 | long long int ans;
| ^~~
a.cc:89:5: error: redefinition of 'int main()'
89 | int main(){
| ^~~~
a.cc:40:5: note: 'int main()' previously defined here
40 | int main(){
| ^~~~
|
s000773309 | p00480 | C++ | //まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>
//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;
//可読性を上げるためのdefineが仇となる典型的パターン
#define rep(i,x) for(int i = 0; i < x; i++)
//ローカル変数とグローバル変数は使い分けよう!
stack<short> x, y;
short h, m, a[100], n, i;
long long int ans;
//関数って楽しいよね!(魔王スマイル)
void solve(short i, short sum){
if(i == n - 1){
if(sum == a[n - 1]) ans++;
return;
}
if(sum < 0 || sum > 20) return;
solve(i + 1, sum + a[i]);
solve(i + 1, sum - a[i]);
}
int main(){
scanf("%d", &n);
ans = 0;
for(i = 0; i < n; i++) scanf("%d", a[i]);
solve(0, 0);
printf("%lld\n", ans);
return 0;
}
//まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>
//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;
//可読性を上げるためのdefineが仇となる典型的パターン
#define rep(i,x) for(int i = 0; i < x; i++)
//ローカル変数とグローバル変数は使い分けよう!
stack<short> x, y;
short h, m, a[100], n, i;
unsigned long long int ans;
//関数って楽しいよね!(魔王スマイル)
void solve(short i, int sum){
if(i == n - 1){
if(sum == a[n - 1]) ans++;
return;
}
if(sum < 0 || sum > 20) return;
solve(i + 1, sum + a[i]);
solve(i + 1, sum - a[i]);
return;
}
int main(){
scanf("%d", &n);
ans = 0;
for(i = 0; i < n; i++) scanf("%d", a[i]);
solve(0, 0);
printf("%lld\n", ans);
return 0;
} | a.cc:72:14: error: redefinition of 'std::stack<short int> x'
72 | stack<short> x, y;
| ^
a.cc:25:14: note: 'std::stack<short int> x' previously declared here
25 | stack<short> x, y;
| ^
a.cc:72:17: error: redefinition of 'std::stack<short int> y'
72 | stack<short> x, y;
| ^
a.cc:25:17: note: 'std::stack<short int> y' previously declared here
25 | stack<short> x, y;
| ^
a.cc:73:7: error: redefinition of 'short int h'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:7: note: 'short int h' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:10: error: redefinition of 'short int m'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:10: note: 'short int m' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:13: error: redefinition of 'short int a [100]'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:13: note: 'short int a [100]' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:21: error: redefinition of 'short int n'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:21: note: 'short int n' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:73:24: error: redefinition of 'short int i'
73 | short h, m, a[100], n, i;
| ^
a.cc:26:24: note: 'short int i' previously declared here
26 | short h, m, a[100], n, i;
| ^
a.cc:74:24: error: conflicting declaration 'long long unsigned int ans'
74 | unsigned long long int ans;
| ^~~
a.cc:27:15: note: previous declaration as 'long long int ans'
27 | long long int ans;
| ^~~
a.cc:88:5: error: redefinition of 'int main()'
88 | int main(){
| ^~~~
a.cc:40:5: note: 'int main()' previously defined here
40 | int main(){
| ^~~~
|
s503270681 | p00480 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int n,d[101];
ll dp[101][21];
int main(){
cin >> n;
for(int i = 0;i < n;i++) cin >> d[i];
memset(dp,0,sizeof(dp)); dp[0][d[0]] = 1;
for(int i = 0;i < n - 1;i++){
for(int j = 0;j <= 20;j++){
if(j + d[i] <= 20) dp[i + 1][j + d[i]] += dp[i][j];
if(j - d[i] >= 0) dp[i + 1][j - d[i]] += dp[i][j];
}
}
cout << dp[n-2][d[n-1]] << endl;
} | a.cc: In function 'int main()':
a.cc:13:3: error: 'memset' was not declared in this scope
13 | memset(dp,0,sizeof(dp)); dp[0][d[0]] = 1;
| ^~~~~~
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;
|
s493598924 | p00480 | C++ | #include <iostream>
#include <vector>
using namespace std;
typedef vector<int> vi;
typedef unsigned long long ull;
#define rep(i,a) for(int i=0; i<int(a); i++)
int n;
int a[100];
int s;
ull dp[2][25];
ull solve(){
memset(dp, 0, sizeof(dp));
ull *cur = dp[0], *prev = dp[1];
prev[0] = 1;
rep(i, n){
memset(cur, 0, sizeof(dp)/2);
rep(j, 20 + 1){
int t1 = j + a[i];
int t2 = j - a[i];
if (0 <= t1 && t1 <= 20){
cur[t1] += prev[j];
}
if (0 <= t2 && t2 <= 20){
cur[t2] += prev[j];
}
}
//rep(i, 21) cout << cur[i] << " ";
//cout << endl;
swap(cur, prev);
}
return prev[s];
}
int main(){
while (cin >> n){
n--;
rep(i, n) cin >> a[i];
cin >> s;
cout << solve() << endl;
}
} | a.cc: In function 'ull solve()':
a.cc:16:5: error: 'memset' was not declared in this scope
16 | memset(dp, 0, sizeof(dp));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 |
|
s803098877 | p00480 | C++ | #include<iostream>
int num[101];
int n;
long long memo[21][101];
long long calc(int sum, int cnt){
long long res = 0;
if (sum < 0 || sum > 20)return 0;
if (cnt == n - 1){
if (sum == num[n - 1])return memo[sum][cnt] = 1;
return 0;
}
if (memo[sum][cnt])return memo[sum][cnt];
res += calc(sum + num[cnt], cnt + 1);
res += calc(sum - num[cnt], cnt + 1);
return memo[sum][cnt] = res;
}
int main(){
std::cin >> n;
for (int i = 0; i < n; i++)std::cin >> num[i];
memset(memo, 0, sizeof(memo));
std::cout << calc(0, 0) << std::endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:30:9: error: 'memset' was not declared in this scope
30 | memset(memo, 0, sizeof(memo));
| ^~~~~~
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 |
|
s020814014 | p00480 | C++ | #include <iostream>
#include <array>
#include <fstream>
int main(){
const int max_sum = 20;
const int min_sum = 0;
const int max_number = 100;
int N;
//std::ifstream ifs("517.txt");
//while(std::cin >> N){
std::cin >> N;
std::array<int, max_number> numbers;
std::array<std::array<long long int, max_sum + 1>, max_number> count;
for(int i = 0; i < max_number; ++i){
count[i].fill(0);
}
for(int i = 0; i < N; ++i){
syd::cin /*ifs*/ >> numbers[i];
}
count[0][numbers[0]] = 1;
for(int i = 1; i < N; ++i){
for(int j = 0; j <= max_sum; ++j){
if(j + numbers[i] <= max_sum){
count[i][j + numbers[i]] += count[i - 1][j];
}
if(j - numbers[i] >= min_sum){
count[i][j - numbers[i]] += count[i - 1][j];
}
}
}
std::cout << count[N - 2][numbers[N - 1]] << std::endl;
// }
//ifs.close();
return 0;
} | a.cc: In function 'int main()':
a.cc:20:13: error: 'syd' has not been declared
20 | syd::cin /*ifs*/ >> numbers[i];
| ^~~
|
s011581860 | p00480 | C++ | #include <iostream>
#include <array>
#include <fstream>
int main(){
const int max_sum = 20;
const int min_sum = 0;
const int max_number = 100;
int N;
//std::ifstream ifs("517.txt");
//while(std::cin >> N){
std::cin >> N;
std::array<int, max_number> numbers;
std::array<std::array<long long int, max_sum + 1>, max_number> count;
for(int i = 0; i < max_number; ++i){
count[i].fill(0);
}
for(int i = 0; i < N; ++i){
syd::cin /*ifs*/ >> numbers[i];
}
count[0][numbers[0]] = 1;
for(int i = 1; i < N; ++i){
for(int j = 0; j <= max_sum; ++j){
if(j + numbers[i] <= max_sum){
count[i][j + numbers[i]] += count[i - 1][j];
}
if(j - numbers[i] >= min_sum){
count[i][j - numbers[i]] += count[i - 1][j];
}
}
}
std::cout << count[N - 2][numbers[N - 1]] << std::endl;
// }
//ifs.close();
return 0;
} | a.cc: In function 'int main()':
a.cc:20:13: error: 'syd' has not been declared
20 | syd::cin /*ifs*/ >> numbers[i];
| ^~~
|
s729606141 | p00480 | C++ | #include <iostream>
#include <vector>
int main(){
int num;
std::vector< std::vector<int> > dp(num, std::vector<int>(21,0));
std::cin >> num;
std::vector<int> value(num);
for(int i = 0; i < n; ++i){
std::cin >> value[i];
}
dp[0][0] = 1;
for(int i = 0; i < (value.size() - 1); ++i){
for(int j = 0; j <= 20; ++j){
if((j + value.at(i)) <= 20){
dp[i + 1][j] += dp[i][j + value.at(i)];
}
if((j - value.at(i)) >= 0){
dp[i + 1][j] += dp[i][j - value.at(i)];
}
}
}
std::cout << dp[value.size() - 1][value.at(num - 1)] << std::endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:28: error: 'n' was not declared in this scope
9 | for(int i = 0; i < n; ++i){
| ^
|
s422874901 | p00480 | C++ | nclude <iostream>
#include <vector>
int main(){
const int MAX = 20;
const int MIN = 0;
int num;
std::cin >> num;
std::vector< std::vector<long int> > dp((num - 1), std::vector<long int>((MAX + 1), 0));
int value;
std::cin >> value;
dp[0][value] = 1;
for(int i = 0; i < (num - 2); ++i){
std::cin >> value;
for(int j = 0; j <= MAX; ++j){
if((j + value) <= MAX){
dp[i + 1][j] += dp[i][j + value];
}
if((j - value) >= MIN){
dp[i + 1][j] += dp[i][j - value];
}
}
}
std::cin >> value;
std::cout << dp[num - 2][value] << std::endl;
return 0;
} | a.cc:1:1: error: 'nclude' does not name a type
1 | nclude <iostream>
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/vector:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| |
s978729607 | p00481 | Java | import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;
/**
* Created by sotetsuk on 2015/07/14.
*/
public class AOJ0558 implements {
public static final int MAX_H = 1005;
public static final int MAX_W = 1005;
public static final int MAX_N = 15;
public static int H, W, N;
public static char[][] grid = new char[MAX_H][MAX_W];
public static int[][] d = new int[MAX_H][MAX_W];
public static Pair[] pos = new Pair[MAX_N];
public static int[] dx = {-1, 0, 1, 0};
public static int[] dy = {0, -1, 0, 1};
public static class Pair {
int first, second;
public Pair(int first, int second) {
this.first = first;
this.second = second;
}
}
public static void read() {
Scanner sc = new Scanner(System.in);
H = sc.nextInt(); W = sc.nextInt(); N = sc.nextInt();
for(int i = 0; i < H; i++) {
grid[i] = sc.next().toCharArray();
}
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
if(grid[i][j] == 'S') {
pos[0] = new Pair(i, j);
}
if('0' <= grid[i][j] && grid[i][j] <= '9') {
int k = Integer.valueOf(String.valueOf(grid[i][j]));
pos[k] = new Pair(i, j);
}
}
}
}
public static int bfs(Pair start, Pair goal) {
// fill 2-d array d by -1
for(int[] arr: d) Arrays.fill(arr, -1);
// This deque is used as queue for bfs
ArrayDeque<Pair> q = new ArrayDeque<Pair>();
q.add(start);
d[start.first][start.second] = 0;
while(!q.isEmpty()) {
Pair now = q.pop();
int nowX = now.first; int nowY = now.second;
// stopping condition
if(nowX == goal.first && nowY == goal.second) {
return d[nowX][nowY];
}
// search 4 destination
for(int i = 0; i < 4; i++) {
Pair next = new Pair(nowX + dx[i], nowY + dy[i]);
int nextX = next.first; int nextY = next.second;
if(0 <= nextX && nextX < H && 0 <= nextY && nextY < W
&& grid[nextX][nextY] != 'X' && d[nextX][nextY] == -1) {
q.add(next);
d[nextX][nextY] = d[nowX][nowY] + 1;
}
}
}
return -1; // something is wrong
}
public static void main(String[] args) {
int ans = 0;
read();
for(int i = 0; i < N; i++) {
ans += bfs(pos[i], pos[i + 1]);
}
System.out.println(ans);
}
} | Main.java:8: error: illegal start of type
public class AOJ0558 implements {
^
1 error
|
s031461031 | p00481 | Java | import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;
/**
* Created by sotetsuk on 2015/07/14.
*/
public class Main implements {
public static final int MAX_H = 1005;
public static final int MAX_W = 1005;
public static final int MAX_N = 15;
public static int H, W, N;
public static char[][] grid = new char[MAX_H][MAX_W];
public static int[][] d = new int[MAX_H][MAX_W];
public static Pair[] pos = new Pair[MAX_N];
public static int[] dx = {-1, 0, 1, 0};
public static int[] dy = {0, -1, 0, 1};
public static class Pair {
int first, second;
public Pair(int first, int second) {
this.first = first;
this.second = second;
}
}
public static void read() {
Scanner sc = new Scanner(System.in);
H = sc.nextInt(); W = sc.nextInt(); N = sc.nextInt();
for(int i = 0; i < H; i++) {
grid[i] = sc.next().toCharArray();
}
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
if(grid[i][j] == 'S') {
pos[0] = new Pair(i, j);
}
if('0' <= grid[i][j] && grid[i][j] <= '9') {
int k = Integer.valueOf(String.valueOf(grid[i][j]));
pos[k] = new Pair(i, j);
}
}
}
}
public static int bfs(Pair start, Pair goal) {
// fill 2-d array d by -1
for(int[] arr: d) Arrays.fill(arr, -1);
// This deque is used as queue for bfs
ArrayDeque<Pair> q = new ArrayDeque<Pair>();
q.add(start);
d[start.first][start.second] = 0;
while(!q.isEmpty()) {
Pair now = q.pop();
int nowX = now.first; int nowY = now.second;
// stopping condition
if(nowX == goal.first && nowY == goal.second) {
return d[nowX][nowY];
}
// search 4 destination
for(int i = 0; i < 4; i++) {
Pair next = new Pair(nowX + dx[i], nowY + dy[i]);
int nextX = next.first; int nextY = next.second;
if(0 <= nextX && nextX < H && 0 <= nextY && nextY < W
&& grid[nextX][nextY] != 'X' && d[nextX][nextY] == -1) {
q.add(next);
d[nextX][nextY] = d[nowX][nowY] + 1;
}
}
}
return -1; // something is wrong
}
public static void main(String[] args) {
int ans = 0;
read();
for(int i = 0; i < N; i++) {
ans += bfs(pos[i], pos[i + 1]);
}
System.out.println(ans);
}
} | Main.java:8: error: illegal start of type
public class Main implements {
^
1 error
|
s755484528 | p00481 | Java | import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;
/**
* Created by sotetsuk on 2015/07/14.
*/
public class AOJ0558 {
public static final int MAX_H = 1005;
public static final int MAX_W = 1005;
public static final int MAX_N = 15;
public static int H, W, N;
public static char[][] grid = new char[MAX_H][MAX_W];
public static int[][] d = new int[MAX_H][MAX_W];
public static Pair[] pos = new Pair[MAX_N];
public static int[] dx = {-1, 0, 1, 0};
public static int[] dy = {0, -1, 0, 1};
public static class Pair {
int first, second;
public Pair(int first, int second) {
this.first = first;
this.second = second;
}
}
public static void read() {
Scanner sc = new Scanner(System.in);
H = sc.nextInt(); W = sc.nextInt(); N = sc.nextInt();
for(int i = 0; i < H; i++) {
grid[i] = sc.next().toCharArray();
}
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
if(grid[i][j] == 'S') {
pos[0] = new Pair(i, j);
}
if('0' <= grid[i][j] && grid[i][j] <= '9') {
int k = Integer.valueOf(String.valueOf(grid[i][j]));
pos[k] = new Pair(i, j);
}
}
}
}
public static int bfs(Pair start, Pair goal) {
// fill 2-d array d by -1
for(int[] arr: d) Arrays.fill(arr, -1);
// This deque is used as queue for bfs
ArrayDeque<Pair> q = new ArrayDeque<Pair>();
q.add(start);
d[start.first][start.second] = 0;
while(!q.isEmpty()) {
Pair now = q.pop();
int nowX = now.first; int nowY = now.second;
// stopping condition
if(nowX == goal.first && nowY == goal.second) {
return d[nowX][nowY];
}
// search 4 destination
for(int i = 0; i < 4; i++) {
Pair next = new Pair(nowX + dx[i], nowY + dy[i]);
int nextX = next.first; int nextY = next.second;
if(0 <= nextX && nextX < H && 0 <= nextY && nextY < W
&& grid[nextX][nextY] != 'X' && d[nextX][nextY] == -1) {
q.add(next);
d[nextX][nextY] = d[nowX][nowY] + 1;
}
}
}
return -1; // something is wrong
}
public static void main(String[] args) {
int ans = 0;
read();
for(int i = 0; i < N; i++) {
ans += bfs(pos[i], pos[i + 1]);
}
System.out.println(ans);
}
} | Main.java:8: error: class AOJ0558 is public, should be declared in a file named AOJ0558.java
public class AOJ0558 {
^
1 error
|
s519736340 | p00481 | Java |
import java.util.*;
public class A {
public static class Point {
public int x;
public int y;
public int pre;
public Point(){
}
public Point(int x1,int y1) {
x = x1;
y = y1;
}
public Point(int x1,int y1 ,int pre1) {
x = x1;
y = y1;
pre= pre1;
}
public void setX(int x1){
x =x1;
}
};
final static int MAXN = 1000;
private static Point S = new Point() ,G = new Point() ; //表示起点和?点
private static int N,W,H;
private static char[][] graph = new char[MAXN][MAXN]; //存?
private static int[][] vis = new int[MAXN][MAXN]; //存距?
private static Point[] aim = new Point[10]; //存目?坐?
private static int dx[] = {1,-1,0,0},dy[]={0,0,-1,1};
public static void main(String[] args) {
Scanner fin = new Scanner(System.in);
//?入数据
H = fin.nextInt();
W = fin.nextInt();
N = fin.nextInt();
fin.nextLine();
for(int i=0; i<H; i++){
String line = fin.nextLine().replace(" ", "");
for(int j=0; j<W; j++){
graph[i][j] = line.charAt(j);
if(graph[i][j] == 'S'){
S.x = i;
S.y = j;
}
if(graph[i][j] >= '1' && graph[i][j] <= '9'){
int t = graph[i][j] -'0';
aim[t] = new Point(i,j);
}
}
}
int step = 0;
for(int i=1; i<=N; i++){
G.x = aim[i].x;
G.y = aim[i].y;
System.out.println(S.x + " " + S.y +" "+G.x + " " + G.y);
step += bfs(S,G);
S.x = G.x;
S.y = G.y;
}
System.out.printf("%d\n", step);
}
private static int bfs(Point S, Point G){
Queue<Point> sq = new LinkedList<Point>();
//?次遍?前,重置vis中存放的?
for(int i=0 ;i<MAXN; i++){
Arrays.fill(vis[i], -1);
}
sq.add(S);
vis[S.x][S.y] = 0;
while(!sq.isEmpty()){
Point qh = sq.poll(); //返回?列中第一个元素,并?除一个元素
if(qh.x == G.x && qh.y == G.y){
break;
}
for(int k =0; k<4; k++){
//*****因??里??的是引用,所以一定要新?建qe,然后添加到?列中,其?才不会?
Point qe = new Point(qh.x + dx[k], qh.y + dy[k]);
if(check(qe.x,qe.y) == 1){
System.out.println(" qe "+qe.x + " "+ qe.y +" "+ vis[qe.x][qe.y]);
sq.add(qe); //入?
vis[qe.x][qe.y] = vis[qh.x][qh.y] + 1;
}
}
}
return vis[G.x][G.y];
}
private static int check(int x, int y){
int flag=1;
if(x<0 || x>=H || y<0 || y>=W)
flag =0;
else if(graph[x][y] == 'X' || vis[x][y] != -1)
flag =0;
return flag;
}
} | Main.java:4: error: class A is public, should be declared in a file named A.java
public class A {
^
1 error
|
s890505569 | p00481 | Java | package cad.week2.a2;
import java.awt.Point;
import java.util.LinkedList;
import java.util.Scanner;
import cad.week2.a.Main.P;
public class Main{
public static class P{
int x;
int y;
public P(){
}
public P(int x, int y) {
super();
this.x = x;
this.y = y;
}
}
static P s = new P();
static P g = new P();
static int[][] graph = new int[1000][1000];
static int[][] vis = new int[1000][1000];
static int[] dx = {1,0,-1,0};
static int[] dy = {0,1,0,-1};
static int n,w,h;
static int step;
static P[] aim = new P[10];
public static int bfs(P s, P g){
LinkedList<P> que = new LinkedList<>();
for (int i = 0; i < 1000; i++) {
for (int j = 0; j < 1000; j++) {
vis[i][j] = -1;
}
}
que.add(s);
vis[s.x][s.y] = 0;
while(!que.isEmpty()){
P p = que.poll();
//que.pop();
if (p.x == g.x && p.y == g.y) {
break;
}
for (int i = 0; i < 4; i++) {
P n = new P();
n.x = p.x + dx[i];
n.y = p.y + dy[i];
if(0<=n.x&&n.x<h&&0<=n.y&&n.y<w&&graph[n.x][n.y]!='X'&&vis[n.x][n.y]==-1){
que.add(n);
vis[n.x][n.y] = vis[p.x][p.y]+1;
}
}
}
return vis[g.x][g.y];
}
public static void main(String[] args) {
Scanner fin = new Scanner(System.in);
//?入数据
h = fin.nextInt();
w = fin.nextInt();
n = fin.nextInt();
fin.nextLine();
for(int i=0; i<h; i++){
String line = fin.nextLine().replace(" ", "");
for(int j=0; j<w; j++){
graph[i][j] = line.charAt(j);
if(graph[i][j] == 'S'){
s.x = i;
s.y = j;
}
if(graph[i][j] >= '1' && graph[i][j] <= '9'){
int t = graph[i][j] -'0';
aim[t] = new P(i,j);
}
}
}
int step = 0;
for(int i=1; i<=n; i++){
g.x = aim[i].x;
g.y = aim[i].y;
step += bfs(s,g);
s.x = g.x;
s.y = g.y;
}
System.out.printf("%d\n", step);
}
} | Main.java:7: error: package cad.week2.a.Main does not exist
import cad.week2.a.Main.P;
^
1 error
|
s576067553 | p00481 | Java | import com.sun.xml.internal.xsom.impl.scd.Iterators;
import java.util.*;
public class Main {
private static class Point {
int x;
int y;
Point(int x, int y) {
this.x = x;
this.y = y;
}
public boolean equals(Point p) {
return p.x == x && p.y == y;
}
public String toString() {
return "point: " + x + "," + y;
}
}
private static char[][] room;
private static LinkedList<Point> queue;
private static int[][] directions = {{0,1}, {1,0}, {0,-1}, {-1,0}};
private static Point[] points;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int w, h, n;
int count = 0;
String lineOfInput;
h = sc.nextInt();
w = sc.nextInt();
n = sc.nextInt();
room = new char[h][w];
points = new Point[n+1];
sc.nextLine(); // for empty line
for (int i = 0; i < h; i++) {
lineOfInput = sc.nextLine();
for (int j = 0; j < w; j++) {
room[i][j] = lineOfInput.charAt(j);
if (room[i][j] == 'S') {
points[0] = new Point(j, i);
}
if (room[i][j] != '.' && room[i][j] != 'X' && room[i][j] != 'S') {
points[Integer.parseInt(Character.toString(room[i][j]))] = new Point(j, i);
}
}
}
// System.out.println(Arrays.toString(points));
// System.out.println(points[1].equals(new Point(2,2)));
for (int i = 1; i <= n; i++) {
count += bfs(i);
}
System.out.println(count);
}
private static int bfs(int next) {
int count = 0;
Point temp;
int nx, ny;
boolean[][] visited = new boolean[room.length][room[0].length];
queue = new LinkedList<>();
queue.add(points[next-1]);
queue.add(null);
visited[points[next-1].y][points[next-1].x] = true;
while ((queue.peek() != null && !queue.peek().equals(points[next])) || queue.peek() == null) {
// System.out.println(queue.peek());
temp = queue.poll();
if (temp == null) {
count++;
queue.add(null);
}
else {
for (int[] direction: directions) {
nx = temp.x + direction[0];
ny = temp.y + direction[1];
if (nx >= 0 && ny >= 0 && nx < room[0].length && ny < room.length) {
if (room[ny][nx] != 'X' && !visited[ny][nx]) {
queue.add(new Point(nx, ny));
visited[ny][nx] = true;
}
}
}
}
}
return count;
}
} | Main.java:1: error: package com.sun.xml.internal.xsom.impl.scd does not exist
import com.sun.xml.internal.xsom.impl.scd.Iterators;
^
1 error
|
s429221619 | p00481 | Java | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.InputMismatchException;
import java.util.List;
import java.util.NoSuchElementException;
public class q0558 {
static IO io = new IO();
public static void main(String[] args) {
int ys = io.nextInt();
int xs = io.nextInt();
int n = io.nextInt();
List<Character> numcheck = new ArrayList<Character>();
for (int i=1; i<=n; i++) numcheck.add(String.valueOf(i).charAt(0));
List<int[]> l = new ArrayList<int[]>();//?????????????????? ?????????????????????x??§?¨????y??§?¨???????
char map[][] = new char[xs][ys];
int dis[][] = new int[xs][ys];//?????????????????§?§?????????????????????¢ ??????????????????????????????????????????
Deque<int[]> que = new ArrayDeque<int[]>();
for (int j=0; j<ys; j++) {
for (int i=0; i<xs; i++) {
map[i][j] = io.nextChar();
dis[i][j] = -1;
if (map[i][j]=='S') {
que.offer(new int[] {i,j});
map[i][j] = '.';
dis[i][j] = 0;
} else if (numcheck.contains(map[i][j])) {
l.add(new int[] {Character.getNumericValue(map[i][j]), i, j});
map[i][j] = '.';
}
}
}
Collections.sort(l, new Comparator<int[]>() {
public int compare (int[] a, int[] b) {
return a[0]-b[0];// ?¬¬1????????§???????????????
}
});
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int goal[] = {l.get(0)[1], l.get(0)[2]};
l.remove(0);
int ans = 0;
while (!que.isEmpty()) {
int poll[] = que.pollFirst();
int x = poll[0];
int y = poll[1];
if (x==goal[0] && y==goal[1]) {//??´??????????????????
ans += dis[x][y];
que.clear();
if (!l.isEmpty()) {//???????????????????????£????????´???
goal[0] = l.get(0)[1];
goal[1] = l.get(0)[2];
l.remove(0);
for (int j=0; j<ys; j++) Arrays.fill(dis[j], -1);
dis[x][y] = 0;
que.offer(new int[] {x, y});
}
}
for (int i=0; i<4; i++) {
// ?????????????????????????????????????????§?????????????£???§???????????´???????????????
if (0<=x+dx[i] && x+dx[i]<xs && 0<=y+dy[i] && y+dy[i]<ys
&& dis[x+dx[i]][y+dy[i]]==-1
&& map[x+dx[i]][y+dy[i]]=='.') {
dis[x+dx[i]][y+dy[i]] = dis[x][y] + 1;
que.offer(new int[] {x+dx[i], y+dy[i]});
}
}
}
System.out.println(ans);
}
static class IO extends PrintWriter {
private final InputStream in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
public IO() { this(System.in);}
public IO(InputStream source) { super(System.out); this.in = source;}
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
}else{
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
private static boolean isNewLine(int c) { return c == '\n' || c == '\r';}
private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
private void skipNewLine() { while(hasNextByte() && isNewLine(buffer[ptr])) ptr++;}
public boolean hasNext() { skipUnprintable(); return hasNextByte();}
public boolean hasNextLine() { skipNewLine(); return hasNextByte();}
public String next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
StringBuilder sb = new StringBuilder();
int b = readByte();
while(isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public char[] nextCharArray(int len) {
if (!hasNext()) {
throw new NoSuchElementException();
}
char[] s = new char[len];
int i = 0;
int b = readByte();
while(isPrintableChar(b)) {
if (i == len) {
throw new InputMismatchException();
}
s[i++] = (char) b;
b = readByte();
}
return s;
}
public String nextLine() {
if (!hasNextLine()) {
throw new NoSuchElementException();
}
StringBuilder sb = new StringBuilder();
int b = readByte();
while(!isNewLine(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) {
throw new NoSuchElementException();
}
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while(true){
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
}else if(b == -1 || !isPrintableChar(b)){
return minus ? -n : n;
}else{
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
throw new NumberFormatException();
}
return (int) nl;
}
public char nextChar() {
if (!hasNext()) {
throw new NoSuchElementException();
}
return (char) readByte();
}
public double nextDouble() { return Double.parseDouble(next());}
public int[] arrayInt(int n) { int[] a = new int[n]; for(int i=0;i<n;i++) a[i] = nextInt(); return a;}
public long[] arrayLong(int n) { long[] a = new long[n]; for(int i=0;i<n;i++) a[i] = nextLong(); return a;}
public double[] arrayDouble(int n) { double[] a = new double[n]; for(int i=0;i<n;i++) a[i] = nextDouble(); return a;}
public void arrayInt(int[]... a) {for(int i=0;i<a[0].length;i++) for(int j=0;j<a.length;j++) a[j][i] = nextInt();}
public int[][] matrixInt(int n,int m) { int[][] a = new int[n][]; for(int i=0;i<n;i++) a[i] = arrayInt(m); return a;}
public char[][] charMap(int n,int m) { char[][] a = new char[n][]; for(int i=0;i<n;i++) a[i] = nextCharArray(m); return a;}
public void close() {
super.close();
try {
in.close();
} catch (IOException e) {}
}
}
} | Main.java:14: error: class q0558 is public, should be declared in a file named q0558.java
public class q0558 {
^
1 error
|
s216274432 | p00481 | Java | package nofill_nosubmit;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;
public class AOJ_0558
{
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
while(in.hasNext())
{
int H=in.nextInt(),W=in.nextInt();
int N=in.nextInt();
int sh=0,sw=0,gh=0,gw=0;
int ans=0,cnt=0;
int visit[][]=new int[H][W];
char map[][]=new char[H][W];
LinkedList<String>que=new LinkedList<String>();
for(int i=0;i<H;i++)
{
String st=in.next();
for(int j=0;j<W;j++)
{
map[i][j]=st.charAt(j);
if(map[i][j]=='S')
{
sh=i;
sw=j;
}
else if(map[i][j]=='1')
{
gh=i;
gw=j;
}
}
}
que.add(sh+" "+sw);
while(!que.isEmpty())
{
int size=que.size();
for(int i=0;i<size;i++)
{
String now[]=que.poll().split(" ");
int nh=Integer.valueOf(now[0]);
int nw=Integer.valueOf(now[1]);
visit[nh][nw]=1;
if(nh==gh&&nw==gw)
{
i=size-1;
while(!que.isEmpty())
que.poll();
cnt++;
if(cnt==N)
break;
else
for(int j=0;j<H;j++)
for(int k=0;k<W;k++)
{
if(cnt==1)
if(map[j][k]=='2')
{
gh=j;
gw=k;
}
if(cnt==2)
if(map[j][k]=='3')
{
gh=j;
gw=k;
}
if(cnt==3)
if(map[j][k]=='4')
{
gh=j;
gw=k;
}
if(cnt==4)
if(map[j][k]=='5')
{
gh=j;
gw=k;
}
if(cnt==5)
if(map[j][k]=='6')
{
gh=j;
gw=k;
}
if(cnt==6)
if(map[j][k]=='7')
{
gh=j;
gw=k;
}
if(cnt==7)
if(map[j][k]=='8')
{
gh=j;
gw=k;
}
if(cnt==8)
if(map[j][k]=='9')
{
gh=j;
gw=k;
}
}
visit =new int[H][W];
}
for(int j=0;j<4;j++)
{
int h=dy[j]+nh;
int w=dx[j]+nw;
if(h>=0&&h<H&&w>=0&&w<W&&map[h][w]!='X'&&visit[h][w]==0)
que.add(h+" "+w);
}
}
if(cnt==N)
break;
ans++;
}
System.out.println(ans);
}
}
} | Main.java:5: error: class AOJ_0558 is public, should be declared in a file named AOJ_0558.java
public class AOJ_0558
^
1 error
|
s339161376 | p00481 | C | #include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char a[1001][1001];
int v[1001][1001],n,h,w,sx,sy,ans,s;
int dir[4][2]={-1,0,1,0,0,1,0,-1};
char b[1001];
int check(int x,int y)
{
if(x>=0&&x<h&&y>=0&&y<w)
return 1;
return 0;
}
void dfs(int x,int y,char c,int cnt)
{
int t1,t2;
if(cnt>=1000)
return;
for(int i=0;i<4;i++)
{
// printf("%d\n",cnt);
t1=x+dir[i][0];
t2=y+dir[i][1];
if(check(t1,t2)&&v[t1][t2]==0&&a[t1][t2]!='X')
{
v[t1][t2]=1;
dfs(t1,t2,c,cnt+1);
v[t1][t2]=0;
}
if(a[t1][t2]==c&&check(t1,t2))
{
ans=min(ans,cnt+1);
sx=t1;
sy=t2;
//printf("%d, ",ans);
}
}
}
int main()
{
int i,j,k,m,l;
while(~scanf("%d %d %d",&h,&w,&n))
{
s=0;
memset(v,0,sizeof(v));
for(i=0;i<h;i++)
{
scanf("%s",&a[i]);
}
for(i=0;i<n;i++)
{
b[i]=i+1+'0';
}
for(i=0;i<h;i++)
{
for(j=0;j<w;j++)
{
if(a[i][j]=='S')
{
sx=i;
sy=j;
}
}
}
//printf("%d %d\n",sx,sy);
for(i=0;i<n;i++)
{
ans=100000;
//printf("%d %d %c\n",sx,sy,b[i]);
dfs(sx,sy,b[i],0);
s+=ans;
}
printf("%d\n",s);
}
return 0;
} | main.c:3:9: fatal error: algorithm: No such file or directory
3 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s866465748 | p00481 | C | #include<stdio.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;
char a[1001][1001];
int v[1001][1001],n,h,w,sx,sy,ans;
int dir[4][2]={-1,0,1,0,0,1,0,-1};
char b[1001];
int s[101][101];
struct st
{
int x,y;
}st1,st2,fl;
queue<st>qq;
int check(st kk)
{
int x=kk.x;
int y=kk.y;
if(x>=0&&x<h&&y>=0&&y<w)
return 1;
return 0;
}
int bfs(char c,int cnt)
{
memset(v,0,sizeof(v));
memset(s,0,sizeof(s));
while(!qq.empty())
{
st1=qq.front();
qq.pop();
if(a[st1.x][st2.y]==c)
break;
for(int i=0;i<4;i++)
{
st2.x=st1.x+dir[i][0];
st2.y=st1.y+dir[i][1];
if(check(st2)&&v[st2.x][st2.y]==0&&a[st2.x][st2.y]!='X')
{
v[st2.x][st2.y]=1;
s[st2.x][st2.y]=s[st1.x][st1.y]+1;
qq.push(st2);
}
}
}
return s[st1.x][st1.y];
}
int main()
{
int i,j,k,m,l;
while(~scanf("%d %d %d",&h,&w,&n))
{
getchar();
memset(v,0,sizeof(v));
memset(s,0,sizeof(s));
for(i=0;i<h;i++)
{
scanf("%s",&a[i]);
}
for(i=0;i<n;i++)
{
b[i]=i+1+'0';
}
for(i=0;i<h;i++)
{
for(j=0;j<w;j++)
{
if(a[i][j]=='S')
{
sx=i;
sy=j;
}
}
}
//printf("%d %d\n",sx,sy);
fl.x=sx;
fl.y=sy;
int sum=0;
for(i=0;i<n;i++)
{
qq.push(fl);
sum+=bfs(b[i],0);
printf("[%d]\n",sum);
}
printf("%d\n",sum);
}
return 0;
} | main.c:3:9: fatal error: algorithm: No such file or directory
3 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s202670367 | p00481 | C | #include <cstdio>
#include <map>
#include <queue>
#include <string>
using namespace std;
const int INF = 100000000;
const int MAX_H = 1000;
const int MAX_W = 1000;
const int MAX_N = 9;
int H, W, N;
char field[MAX_H][MAX_W];
int d[MAX_H][MAX_W]; // ?????????????????\??´?????§??????????????°, 1~N??§?????????????????§????????°??????+1
int step[MAX_N+1]; // ?????????????????\??´?????§??????????????°, 1~N??§?????????????????§????????°??????+1
int sx, sy, gx, gy;
int power = 1; // ??????????????????
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
typedef pair<int, int> P;
void reset_d() {
for (int i = 0; i < H; i++)
for(int j = 0; j < W; j++) d[i][j] = INF;
}
int bfs(int sx, int sy, int c) {
queue<P> que;
reset_d();
d[sx][sy] = c;
que.push(P(sx, sy));
while(que.size()) {
P p = que.front(); que.pop();
if (field[p.first][p.second] - '0' == N && step[N] != 0) break;
for (int i = 0; i < 4; i++) {
int nx = p.first + dx[i], ny = p.second + dy[i];
if ( 0 <= nx && nx <= H && 0 <= ny && ny <= W && field[nx][ny] != 'X' && d[nx][ny] == INF) {
d[nx][ny] = d[p.first][p.second] + 1;
que.push(P(nx, ny));
if (field[nx][ny] - '0' == power) {
step[power] = d[nx][ny];
power++;
return bfs(nx, ny, d[nx][ny]);
}
}
}
}
return step[N];
}
void solve(int sx, int sy) {
int res = bfs(sx, sy, 0);
printf("%d\n", res);
}
int main() {
scanf("%d %d %d", &H, &W, &N);
for (int i = 0; i < H; i++) {
scanf("%s", field[i]);
}
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (field[i][j] == 'S') {
sx = i;
sy = j;
}
if (field[i][j] == 'G') {
gx = i;
gy = j;
}
}
}
solve(sx, sy);
return 0;
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s925966769 | p00481 | C | #include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
struct node
{
int x, y, step;
};
int a, b, ans, n;
int book[1010][1010];
char on[1010][1010];
void bfs(int x, int y, int k)
{
memset(book, 0, sizeof(book));
int dir[4][2] = {{0,1},{0,-1},{1,0},{-1,0}};
node s, e;
int f = 0;
s.step = 0;
s.x = x;
s.y = y;
book[x][y] = 1;
queue<node>q;
q.push(s);
while(!q.empty())
{
s = q.front();
q.pop();
for(int i = 0; i < 4; i++)
{
e.x = s.x + dir[i][0];
e.y = s.y + dir[i][1];
e.step = s.step+1;
if(e.x < 0 || e.y < 0 || e.x >= a || e.y >= b || book[e.x][e.y] || on[e.x][e.y] == 'X')
continue;
if(on[e.x][e.y] == '0'+k)
{
ans += e.step;
f = 1;
break;
}
book[e.x][e.y] = 1;
q.push(e);
}
if(f)
break;
}
if(f && k == n)
return;
bfs(e.x, e.y, k+1);
}
int main ()
{
while(~scanf("%d %d %d", &a, &b, &n))
{
int i, j;
for(i = 0; i < a; i++)
scanf("%s", on[i]);
ans = 0;
for(i = 0; i < a; i++)
for(j = 0; j < b; j++)
if(on[i][j] == 'S')
{
bfs(i, j, 1);
break;
}
printf("%d\n", ans);
}
return 0;
} | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s936653399 | p00481 | C | #include<iostream>
#include<algorithm>
#include<map>
using namespace std;
#define MAX 1001
int h, w, n;
char city[MAX][MAX];
int step[10];
int direc1[4] = { -1,0,1,0 }, direc2[4] = { 0,1,0,-1 };
void dfs(char (&nowcity)[MAX][MAX], int nowstep, bool find, int nowi, int nowj, int nowpower, map<int, int> visited) {
if (find) {
if (step[nowpower-1] == -1) {
step[nowpower-1] = nowstep;
}
else
{
step[nowpower-1] = min(step[nowpower-1], nowstep);
}
return;
}
if (step[nowpower] != -1) {
if (nowstep >= step[nowpower]) {
return;
}
}
for (int i = 0; i < 4; i++) {
if (nowi + direc1[i] >= 0 && nowi + direc1[i] < h&&nowj + direc2[i] >= 0 && nowj + direc2[i] < w) {
if (nowcity[nowi + direc1[i]][nowj + direc2[i]] == '.') {
if (!visited[(nowi + direc1[i]) * w + nowj + direc2[i]]) {
visited[(nowi + direc1[i]) * w + nowj + direc2[i]]=1;
dfs(nowcity, nowstep + 1, false, nowi + direc1[i], nowj + direc2[i], nowpower, visited);
}
}
else if (nowcity[nowi + direc1[i]][nowj + direc2[i]] >= '0'&&nowcity[nowi + direc1[i]][nowj + direc2[i]] <= '9')
{
int num = nowcity[nowi + direc1[i]][nowj + direc2[i]] - '0';
if (nowpower == num) {
//nowcity[nowi + direc1[i]][nowj + direc2[i]] = '.';
/*visited.clear();
visited[(nowi + direc1[i]) * w + nowj + direc2[i]] =1;*/
dfs(nowcity, nowstep + 1, true, nowi + direc1[i], nowj + direc2[i], nowpower,visited);
}
else {
if (!visited[(nowi + direc1[i]) * w + nowj + direc2[i]]) {
visited[(nowi + direc1[i]) * w + nowj + direc2[i]] =1;
dfs(nowcity, nowstep + 1, false, nowi + direc1[i], nowj + direc2[i], nowpower,visited);
}
}
}
}
}
}
int main() {
cin >> h >> w >> n;
int nowi[10], nowj[10];
for (int i = 0; i < h; i++)
{
for (int j = 0; j < w; j++)
{
cin >> city[i][j];
if (city[i][j] == 'S') {
nowi[0] = i;
nowj[0] = j;
city[i][j] = '.';
}
if (city[i][j] >= '0'&&city[i][j] <= '9') {
nowi[city[i][j] - '0'] = i;
nowj[city[i][j] - '0'] = j;
}
}
}
for (int i = 0; i < 10; i++) {
step[i] = -1;
}
map<int, int>visited;
for (int i = 0; i < n; i++) {
visited.clear();
visited[nowi[i] * w + nowj[i]] = 1;
dfs(city, 0, false, nowi[i], nowj[i], i+1, visited);
}
int sum=0;
for (int i = 0; i < n; i++) {
sum += step[i];
}
cout << sum << endl;
//system("pause");
return 0;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s140840042 | p00481 | C | #include<stdio.h>
#include<stdlib.h>
struct TQueue{
int x,y;
struct TQueue* next;
};
void allfree(struct TQueue* q){
struct TQueue* r[2];
r[0]=q;
if(q==0)return;
r[1]=q->next;
while(r[1]){
free(r[0]);
r[0]=r[1];
r[1]=r[1]->next;
}
free(r[0]);
}
struct TQueue* push(struct TQueue* ed,int y,int x,int d){
if(ed==0){
return 0;
}
ed->next=(struct TQueue*)malloc(sizeof(struct TQueue));
ed->next->next=0;
ed->next->dep=d;
ed->next->x=x;
ed->next->y=y;
return ed->next;
}
struct TQueue* Queue(int y,int x,int d){
struct TQueue* ret;
ret=(struct TQueue*)malloc(sizeof(struct TQueue));
ret->next=0;
ret->x=x;
ret->y=y;
return ret;
}
struct TQueue* delhead(struct TQueue* st){
struct TQueue* ret;
if(!st)return 0;
ret=st->next;
free(st);
return ret;
}
int main(){
int w,h,n;
int i,j,k;
char* s;
int mp[1000][1000];
int ts[1002][1002];
int ret,ls,pt;
int gy[10],gx[10];
struct TQueue *st,*ed;
s=(char*)malloc(sizeof(char)*1001);
gets(s);
sscanf(s,"%d %d %d",&h,&w,&n);
for(i=0;i<h;i++){
gets(s);
for(j=0;j<w;j++){
mp[i][j]=s[j]=='X'?1:0;
if(s[j]>='1'&&s[j]<='9'){
gy[s[j]-'0']=i+1;
gx[s[j]-'0']=j+1;
}
if(s[j]=='S'){
gy[0]=i+1;
gx[0]=j+1;
}
}
}
for(i=0;i<h+2;i++){
ts[i][0]=1;
ts[i][w+1]=1;
}
for(j=0;j<w+2;j++){
ts[0][j]=1;
ts[h+1][j]=1;
}
ls;
ret=0;
for(k=0;k<n;k++){
st=Queue(gy[k],gx[k],ret);
ed=st;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
ts[i+1][j+1]=mp[i][j];
}
}
while(st){
if(((st->y+1==gy[k+1]||st->y-1==gy[k+1])&&st->x==gx[k+1])
||((st->x+1==gx[k+1]||st->x-1==gx[k+1])&&st->y==gy[k+1])){
break;
}
if(ts[st->y+1][st->x]==0){
ts[st->y+1][st->x]=1;
ed=push(ed,st->y+1,st->x,st->dep+1);
}
if(!ts[st->y-1][st->x]){
ts[st->y-1][st->x]=1;
ed=push(ed,st->y-1,st->x,st->dep+1);
}
if(!ts[st->y][st->x-1]){
ts[st->y][st->x-1]=1;
ed=push(ed,st->y,st->x-1,st->dep+1);
}
if(!ts[st->y][st->x+1]){
ts[st->y][st->x+1]=1;
ed=push(ed,st->y,st->x+1,st->dep+1);
}
st=delhead(st);
ls--;
}
if(st){
ret=st->dep+1;
allfree(st);
}else{
printf("Incorrect Data\n");
return 0;
}
}
printf("%d\n",ret);
return 0;
} | main.c: In function 'push':
main.c:28:11: error: 'struct TQueue' has no member named 'dep'
28 | ed->next->dep=d;
| ^~
main.c: In function 'main':
main.c:66:3: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
66 | gets(s);
| ^~~~
| fgets
main.c:109:36: error: 'struct TQueue' has no member named 'dep'
109 | ed=push(ed,st->y+1,st->x,st->dep+1);
| ^~
main.c:113:36: error: 'struct TQueue' has no member named 'dep'
113 | ed=push(ed,st->y-1,st->x,st->dep+1);
| ^~
main.c:117:36: error: 'struct TQueue' has no member named 'dep'
117 | ed=push(ed,st->y,st->x-1,st->dep+1);
| ^~
main.c:121:36: error: 'struct TQueue' has no member named 'dep'
121 | ed=push(ed,st->y,st->x+1,st->dep+1);
| ^~
main.c:127:13: error: 'struct TQueue' has no member named 'dep'
127 | ret=st->dep+1;
| ^~
|
s280768074 | p00481 | C | #include<stdio.h>
#include<stdlib.h>
struct TQueue{
int x,y,d;
struct TQueue* next;
};
void allfree(struct TQueue* q){
struct TQueue* r[2];
r[0]=q;
if(q==0)return;
r[1]=q->next;
while(r[1]){
free(r[0]);
r[0]=r[1];
r[1]=r[1]->next;
}
free(r[0]);
}
struct TQueue* push(struct TQueue* ed,int y,int x,int d){
if(ed==0){
return 0;
}
ed->next=(struct TQueue*)malloc(sizeof(struct TQueue));
ed->next->next=0;
ed->next->dep=d;
ed->next->x=x;
ed->next->y=y;
return ed->next;
}
struct TQueue* Queue(int y,int x,int d){
struct TQueue* ret;
ret=(struct TQueue*)malloc(sizeof(struct TQueue));
ret->next=0;
ret->x=x;
ret->y=y;
return ret;
}
struct TQueue* delhead(struct TQueue* st){
struct TQueue* ret;
if(!st)return 0;
ret=st->next;
free(st);
return ret;
}
int main(){
int w,h,n;
int i,j,k;
char* s;
int mp[1000][1000];
int ts[1002][1002];
int ret,ls,pt;
int gy[10],gx[10];
struct TQueue *st,*ed;
s=(char*)malloc(sizeof(char)*1001);
gets(s);
sscanf(s,"%d %d %d",&h,&w,&n);
for(i=0;i<h;i++){
gets(s);
for(j=0;j<w;j++){
mp[i][j]=s[j]=='X'?1:0;
if(s[j]>='1'&&s[j]<='9'){
gy[s[j]-'0']=i+1;
gx[s[j]-'0']=j+1;
}
if(s[j]=='S'){
gy[0]=i+1;
gx[0]=j+1;
}
}
}
for(i=0;i<h+2;i++){
ts[i][0]=1;
ts[i][w+1]=1;
}
for(j=0;j<w+2;j++){
ts[0][j]=1;
ts[h+1][j]=1;
}
ls;
ret=0;
for(k=0;k<n;k++){
st=Queue(gy[k],gx[k],ret);
ed=st;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
ts[i+1][j+1]=mp[i][j];
}
}
while(st){
if(((st->y+1==gy[k+1]||st->y-1==gy[k+1])&&st->x==gx[k+1])
||((st->x+1==gx[k+1]||st->x-1==gx[k+1])&&st->y==gy[k+1])){
break;
}
if(ts[st->y+1][st->x]==0){
ts[st->y+1][st->x]=1;
ed=push(ed,st->y+1,st->x,st->dep+1);
}
if(!ts[st->y-1][st->x]){
ts[st->y-1][st->x]=1;
ed=push(ed,st->y-1,st->x,st->dep+1);
}
if(!ts[st->y][st->x-1]){
ts[st->y][st->x-1]=1;
ed=push(ed,st->y,st->x-1,st->dep+1);
}
if(!ts[st->y][st->x+1]){
ts[st->y][st->x+1]=1;
ed=push(ed,st->y,st->x+1,st->dep+1);
}
st=delhead(st);
ls--;
}
if(st){
ret=st->dep+1;
allfree(st);
}else{
printf("Incorrect Data\n");
return 0;
}
}
printf("%d\n",ret);
return 0;
} | main.c: In function 'push':
main.c:28:11: error: 'struct TQueue' has no member named 'dep'
28 | ed->next->dep=d;
| ^~
main.c: In function 'main':
main.c:66:3: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
66 | gets(s);
| ^~~~
| fgets
main.c:109:36: error: 'struct TQueue' has no member named 'dep'
109 | ed=push(ed,st->y+1,st->x,st->dep+1);
| ^~
main.c:113:36: error: 'struct TQueue' has no member named 'dep'
113 | ed=push(ed,st->y-1,st->x,st->dep+1);
| ^~
main.c:117:36: error: 'struct TQueue' has no member named 'dep'
117 | ed=push(ed,st->y,st->x-1,st->dep+1);
| ^~
main.c:121:36: error: 'struct TQueue' has no member named 'dep'
121 | ed=push(ed,st->y,st->x+1,st->dep+1);
| ^~
main.c:127:13: error: 'struct TQueue' has no member named 'dep'
127 | ret=st->dep+1;
| ^~
|
s551519350 | p00481 | C | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
#define MAXN 1005
using namespace std;
struct node {
int i;
int j;
char val;
};
int H, W, N;//H(1 <= H <= 1000)、W(1 <= W <=1000)、N(1 <= N <= 9)
char m[MAXN][MAXN];
queue<node> q;
bool flag = 0;
int t1 = 0;
char flag_m[MAXN][MAXN];
void search(int i, int j, char val)
{
if (flag_m[i][j]<val) {
if (m[i][j] == 'X')
{
return;
}
if (m[i][j] == '.' || m[i][j] != val)
{
q.push({ i, j, val });
//flag_m[i][j] = true;
t1++;
}
if (m[i][j] == val)
{
if (val ==(char)('0' + N))
{
flag = 1;
}
else
{
q.push({ i, j, val + 1 });
//flag_m[i][j] = true;
m[i][j] = '.';
t1++;
}
}
}
return;
}
int main()
{
int si, sj;
scanf("%d %d %d", &H, &W, &N);
for (int i = 1; i <= H; i++)
{
getchar();
for (int j = 1; j <= W; j++)
{
scanf("%c", &(m[i][j]));
if (m[i][j] == 'S')
{
si = i;
sj = j;
}
}
}
//
q.push({ si, sj, '1' });
memset(flag_m, '0', sizeof(flag_m));
int t = 1;
int time = 0;
while (!q.empty() && (!flag))
{
time++;
t1 = 0;
while (t-- && (!flag))
{
node n1 = q.front(); q.pop();
si = n1.i; sj = n1.j;
flag_m[si][sj] = n1.val;
if (si > 1)
{
search(si - 1, sj, n1.val);
}
if (si < H)
{
search(si + 1, sj, n1.val);
}
if (sj > 1)
{
search(si, sj - 1, n1.val);
}
if (sj < W)
{
search(si, sj + 1, n1.val);
}
}
t = t1;
}
printf("%d\n", time);
return 0;
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s890992739 | p00481 | C |
import java.util.*;
public class Main {
public static class Point {
public int x;
public int y;
public int pre;
public Point(){
}
public Point(int x1,int y1) {
x = x1;
y = y1;
}
public Point(int x1,int y1 ,int pre1) {
x = x1;
y = y1;
pre= pre1;
}
public void setX(int x1){
x =x1;
}
};
final static int MAXN = 1000;
private static Point S = new Point() ,G = new Point() ; //表示起点和?点
private static int N,W,H;
private static char[][] graph = new char[MAXN][MAXN]; //存?
private static int[][] vis = new int[MAXN][MAXN]; //存距?
private static Point[] aim = new Point[10]; //存目?坐?
private static int dx[] = {1,-1,0,0},dy[]={0,0,-1,1};
public static void main(String[] args) {
Scanner fin = new Scanner(System.in);
//?入数据
H = fin.nextInt();
W = fin.nextInt();
N = fin.nextInt();
fin.nextLine();
for(int i=0; i<H; i++){
String line = fin.nextLine().replace(" ", "");
for(int j=0; j<W; j++){
graph[i][j] = line.charAt(j);
if(graph[i][j] == 'S'){
S.x = i;
S.y = j;
}
if(graph[i][j] >= '1' && graph[i][j] <= '9'){
int t = graph[i][j] -'0';
aim[t] = new Point(i,j);
}
}
}
int step = 0;
for(int i=1; i<=N; i++){
G.x = aim[i].x;
G.y = aim[i].y;
step += bfs(S,G);
S.x = G.x;
S.y = G.y;
}
System.out.printf("%d\n", step);
}
private static int bfs(Point S, Point G){
Queue<Point> sq = new LinkedList<Point>();
//?次遍?前,重置vis中存放的?
for(int i=0 ;i<MAXN; i++){
Arrays.fill(vis[i], -1);
}
sq.add(S);
vis[S.x][S.y] = 0;
while(!sq.isEmpty()){
Point qh = sq.poll(); //返回?列中第一个元素,并?除一个元素
if(qh.x == G.x && qh.y == G.y){
break;
}
for(int k =0; k<4; k++){
//*****因??里??的是引用,所以一定要新?建qe,然后添加到?列中,其?才不会?
Point qe = new Point(qh.x + dx[k], qh.y + dy[k]);
if(check(qe.x,qe.y) == 1){
sq.add(qe); //入?
vis[qe.x][qe.y] = vis[qh.x][qh.y] + 1;
}
}
}
return vis[G.x][G.y];
}
private static int check(int x, int y){
int flag=1;
if(x<0 || x>=H || y<0 || y>=W)
flag =0;
else if(graph[x][y] == 'X' || vis[x][y] != -1)
flag =0;
return flag;
}
} | main.c:2:1: error: unknown type name 'import'
2 | import java.util.*;
| ^~~~~~
main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
2 | import java.util.*;
| ^
main.c:4:1: error: unknown type name 'public'
4 | public class Main {
| ^~~~~~
main.c:4:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
4 | public class Main {
| ^~~~
|
s351686522 | p00481 | C | #include<stdio.h>
#include<iostream>
#include<queue>
#include<string.h>
using namespace std;
struct PP{
int x;
int y;
int Z;
int c;
};
char s[1000][1000],C[11]={"0123456789"};
int D[1000][1000];
int A[1000][1000],d;
int main(){
PP S;
queue<PP> P;
int w,h;
int d=0,i=0,j=0,l=-1;
int x[4]={ 1, 0,-1,0};
int y[4]={ 0 ,1,0,-1};
scanf("%d %d %d",&h,&w,&d);
memset(A,0,sizeof(A));
memset(D,0,sizeof(D));
for(i=0;i<h;i++){
scanf("%s",s[i]);
}
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if(s[i][j]=='S'){
S.x=j;
S.y=i;
S.Z=0;
S.c=1;
P.push(S);
}
}
}
while(1){
l++;
if(l==4) {
l=0;
P.pop();
}
S=P.front();
A[S.y][S.x]=1;
S.x+=x[l];
S.y+=y[l];
S.Z++;
if(A[S.y][S.x]==1) continue;
if(s[S.y][S.x]=='X'||S.y==h||S.x==w||S.x==-1||S.y==-1){
S.x-=x[l];
S.y-=y[l];
}
else if(s[S.y][S.x]=='.'){}
else{
if(C[S.c]==s[S.y][S.x]){
S.c++;
if(S.c==d+1){
break;
}
while(!P.empty()){
P.pop();
}
memset(A,0,sizeof(A));
l=-1;
}
}
P.push(S);
}
printf("%d\n",S.Z);
return 0;
} | main.c:2:9: fatal error: iostream: No such file or directory
2 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s454213105 | p00481 | C | #include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
using namespace std;
int H,W,N;
typedef pair<int,int> P;
#define INF 1e-9
const int MAX_N=1001;
char maze[MAX_N][MAX_N];
bool vis[MAX_N][MAX_N];
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int d[MAX_N][MAX_N];
bool right(int x,int y)
{
if(x>=0&&x<H&&y>=0&&y<W&&maze[x][y]!='X'&&!vis[x][y])
return true;
return false;
}
int bfs(int sx,int sy,int gx,int gy)
{
queue<P> que;
for(int i=0;i<H;i++)
{
for(int j=0;j<W;j++)
d[i][j]=INF;
}
que.push(P(sx,sy));
d[sx][sy]=0;
while(que.size())
{
P p=que.front();que.pop();
if(p.first==gx&&p.second==gy)
break;
for(int i=0;i<4;i++)
{
int nx=p.first+dx[i],ny=p.second+dy[i];
if(right(nx,ny))
{
que.push(P(nx,ny));
d[nx][ny]=d[p.first][p.second]+1;
}
}
}
return d[gx][gy];
}
int main()
{
while(scanf("%d%d%d",&H,&W,&N)!=EOF)
{
getchar();
for(int i=0;i<H;i++)
scanf("%s",maze[i]);
int ans=0;
int sx=-1,sy=-1;
for(int i=0;i<H;i++)
{
for(int j=0;j<W;j++)
if(maze[i][j]=='S')
{
sx=i;sy=j;
}
if(sx!=-1&&sy!=-1)
break;
}
for(int i=1;i<=N;i++)
{
memset(vis,false,sizeof(vis));
int nx=-1,ny=-1;
for(int j=0;j<H;j++)
{
for(int k=0;k<W;k++)
{
if(maze[j][k]=='0'+i)
{
nx=j;ny=k;
break;
}
}
if(nx!=-1&&ny!=-1)
break;
}
ans+=bfs(sx,sy,nx,ny);
sx=nx;
sy=ny;
}
printf("%d\n",ans);
}
return 0;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s525971078 | p00481 | C | /* AOJ0558 Cheese */
#include<bits/stdc++.h>
using namespace std;
const int DIRECTSIZE = 4;
struct _direct {
int drow;
int dcol;
} direct[DIRECTSIZE] = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}};
const int N = 1000;
const int N2 = 10;
char grid[N][N], visited[N][N];
int h, w, n;
struct _factory {
int row;
int col;
} factory[N2];
struct _node {
int row;
int col;
int level;
};
int bfs(int n, char goal) {
memset(visited, 0, sizeof(visited));
_node start={factory[n-1].row, factory[n-1].col, 0}, temp;
visited[start.row][start.col] = 1;
queue<_node> q;
q.push(start);
while(!q.empty()) {
_node front = q.front();
q.pop();
for(int i=0; i<DIRECTSIZE; i++) {
int nextrow = front.row + direct[i].drow;
int nextcol = front.col + direct[i].dcol;
if( 0 <= nextrow && nextrow < h && 0 <= nextcol && nextcol < w) {
if(grid[nextrow][nextcol] == goal) {
return front.level + 1;
}
else if(visited[nextrow][nextcol] == 0 && grid[nextrow][nextcol] != 'X') {
visited[nextrow][nextcol] = 1;
temp.row = nextrow;
temp.col = nextcol;
temp.level = front.level + 1;
q.push(temp);
}
}
}
}
return 0;
}
int main() {
while (~scanf("%d %d %d", &h, &w, &n)){
for(int i = 0; i < h; i++) {
scanf("%s", grid[i]);
for(int j = 0; j < w; j++) {
if(grid[i][j] == 'S') {
factory[0].row = i;
factory[0].col = j;
}
else if(isdigit(grid[i][j])) {
factory[grid[i][j] - '0'].row = i;
factory[grid[i][j] - '0'].col = j;
}
}
}
int minstep = 0;
char goal = '1';
for(int i=1; i<=n; i++) {
minstep += bfs(i, goal);
goal++;
}
printf("%d\n", minstep);
}
return 0;
} | main.c:2:9: fatal error: bits/stdc++.h: No such file or directory
2 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s416509457 | p00481 | C | //AOJ-0558
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;
char map[1010][1010];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int vis[1010][1010];
int m, n, N;
struct node{
int x, y, t;
};
node bfs(int x, int y, int k)
{
memset(vis, 0, sizeof(vis));
queue<node> q;
vis[x][y] = 1;
node s; s.x = x; s.y = y; s.t = 0;
q.push(s);
while(!q.empty())
{
node p = q.front(); q.pop();
vis[p.x][p.y] = 1;
node e;
if(map[p.x][p.y] == k + '0') return p;
for(int i = 0; i < 4; i++)
{
e.x = p.x + dx[i];
e.y = p.y + dy[i];
if(map[e.x][e.y] == 'X' || vis[e.x][e.y] == 1) continue;
e.t = p.t + 1;
q.push(e);
}
}
s.x = s.y = s.t = -1;
return s;
}
void clear(){
for(int i = 0; i < 1010; i++)
for(int j = 0; j < 1010; j++)
map[i][j] = 'X';
}
int main()
{
while(scanf("%d %d %d", &n, &m, &N) != EOF)
{
clear();
node s;
for(int i = 1; i <= n; i++){
getchar();
for(int j = 1; j <= m; j++){
map[i][j] = getchar();
if(map[i][j] == 'S'){
map[i][j] = '.';
s.x = i; s.y = j; s.t = 0;
}
}
}
int ans = 0;
for(int i = 1; i <= N; i++)
{
s = bfs(s.x, s.y, i);
map[s.x][s.y] = '.';
ans += s.t;
}
printf("%d\n", ans);
}
return 0;
}
| main.c:2:10: fatal error: cstdio: No such file or directory
2 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s746420675 | p00481 | C | #include<stdio.h>
#include<string.h>
#include<queue>
using namespace std;
const int maxn=1005;
int n,m,k,dx[]={-1,1,0,0},dy[]={0,0,1,-1},vis[maxn][maxn];
char map[maxn][maxn];
struct maze
{
int x,y,time;
};
maze bfs(int bx,int by,char ch)
{
memset(vis,0,sizeof(vis));
queue<maze> q;
maze st={bx,by,0};
q.push(st);vis[bx][by]=1;
while(!q.empty())
{
st=q.front();q.pop();
if(map[st.x][st.y]==ch)
{
return st;
}
for(int i=0;i<4;++i)
{
int tx=st.x+dx[i],ty=st.y+dy[i];
if(tx<0||tx>=n||ty<0||ty>=m||map[tx][ty]=='X')
{
continue;
}
maze tp={tx,ty,st.time+1};
if(!vis[tx][ty])
{
vis[tx][ty]=1;
q.push(tp);
}
}
}
}
int main()
{
while(~scanf("%d%d%d",&n,&m,&k))
{
int bx,by;
for(int i=0;i<n;++i)
{
scanf("%s",map[i]);
for(int j=0;j<m;++j)
{
if(map[i][j]=='S')
{
bx=i;by=j;
map[i][j]='0';
}
}
}
int ans=0;
for(int i=0;i<k;i++)
{
maze tp=bfs(bx,by,map[bx][by]+1);
ans+=tp.time;
bx=tp.x;by=tp.y;
}
printf("%d\n",ans);
}
return 0;
}
| main.c:3:9: fatal error: queue: No such file or directory
3 | #include<queue>
| ^~~~~~~
compilation terminated.
|
s999288778 | p00481 | C | #include <iostream>
#include <cstring>
#include <queue>
#include <algorithm>
#include <cstdio>
#define INF 1 << 29
using namespace std;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,-1,0,1};
char f[1003][1003];
int visited[1003][1003][10];
class S{
public:
int x;
int y;
int lvl;
int step;
S(int x, int y, int lvl, int step):x(x),y(y),lvl(lvl),step(step){}
};
int main(){
int h,w,lvl,sx,sy,gx,gy;
cin >> h >> w >> lvl;
fill((char *)f, (char *)f+1003*1003, 'X');
fill((int *)visited, (int *)visited+1003*1003*10, INF);
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
cin >> f[i][j];
if(f[i][j] == 'S'){
sx = j;
sy = i;
}else if(f[i][j] == lvl + '0'){
gx = j;
gy = i;
}
}
}
deque<S> q;
q.push_back(S(sx,sy,1,0));
visited[sy][sx][1] = 0;
int px,py,tmplvl,tmpstep;
while(!q.empty()){
px = q.front().x;
py = q.front().y;
tmplvl = q.front().lvl;
tmpstep = q.front().step;
q.pop_front();
//printf("current:(y = %d, x = %d, lvl = %d, step = %d)\n", py,px,tmplvl,tmpstep);
if(py == gy && px == gx && tmplvl == lvl+1){
break;
}
visited[py][px][tmplvl] = tmpstep;
for(int i=0;i<4;i++){
int nx = px + dx[i];
int ny = py + dy[i];
if(f[ny][nx] != 'X'){
if(f[ny][nx] == tmplvl +'0'){
q.push_back(S(nx,ny,tmplvl+1,tmpstep+1));
}else{
if(tmpstep + 1 < visited[ny][nx][tmplvl]){
q.push_back(S(nx,ny,tmplvl,tmpstep+1));
visited[ny][nx][tmplvl] = tmpstep+1;
}
}
}
}
}
cout << tmpstep << endl;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s128501309 | p00481 | C | #include <iostream>
#include <cstring>
#include <queue>
#include <algorithm>
#include <cstdio>
#define INF 1 << 29
using namespace std;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,-1,0,1};
char f[1003][1003];
bool visited[1003][1003][10];
class S{
public:
int x;
int y;
int lvl;
int step;
S(int x, int y, int lvl, int step):x(x),y(y),lvl(lvl),step(step){}
};
int main(){
int h,w,lvl,sx,sy,gx,gy;
cin >> h >> w >> lvl;
fill((char *)f, (char *)f+1003*1003, 'X');
fill((bool *)visited, (bool *)visited+1003*1003*10, false);
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
cin >> f[i][j];
if(f[i][j] == 'S'){
sx = j;
sy = i;
}else if(f[i][j] == lvl + '0'){
gx = j;
gy = i;
}
}
}
deque<S> q;
q.push_back(S(sx,sy,1,0));
visited[sy][sx][1] = true;
int px,py,tmplvl,tmpstep;
while(!q.empty()){
px = q.front().x;
py = q.front().y;
tmplvl = q.front().lvl;
tmpstep = q.front().step;
q.pop_front();
//printf("current:(y = %d, x = %d, lvl = %d, step = %d)\n", py,px,tmplvl,tmpstep);
if(py == gy && px == gx && tmplvl == lvl+1){
break;
}
visited[py][px][tmplvl] = tmpstep;
for(int i=0;i<4;i++){
int nx = px + dx[i];
int ny = py + dy[i];
if(f[ny][nx] != 'X'){
if(f[ny][nx] == tmplvl +'0'){
q.push_back(S(nx,ny,tmplvl+1,tmpstep+1));
}else{
if(!visited[ny][nx][tmplvl]){
q.push_back(S(nx,ny,tmplvl,tmpstep+1));
visited[ny][nx][tmplvl] = true;
}
}
}
}
}
cout << tmpstep << endl;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s178430958 | p00481 | C | #include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef struct {
short cost, x, y;
}Point;//螳壻ケ我ク?クェ扈捺桷菴鍋畑譚・蟄伜お豈丈クェ蟾・蜴ら噪蝮先?菴咲スョ蜥悟・カ驟ェ逧??
int H, W, N;
vector<Point> factory;
char map[1000][1002];
short dx[4] = {-1, 1, 0, 0}, dy[4] = {0, 0, -1, 1};
bool myfunction(Point a, Point b)
{
return a.cost < b.cost;
}
int bfs(int sx, int sy, int ex, int ey);
int main()
{
cin>>H>>W>>N;
int sx, sy;
for(int i = 0; i < H; i++){
cin>>map[i];
for(int j = 0; j < W; j++){
if( 1 <= (map[i][j]-'0') && (map[i][j]-'0') <= N){
Point p;
p.x = i, p.y = j, p.cost = map[i][j] - '0';
factory.push_back(p);//謚雁キ・蜴ら噪陦ィ遉コ謾セ蛻ー蜿ッ蜿俶焚扈?クュ
}
if(map[i][j] == 'S')
sx = i, sy = j; //隶ー蠖戊オキ蟋倶ス咲スョ逧?攝譬? }
}
sort(factory.begin(), factory.end(), myfunction);
int ans = 0;
int start_x = sx, start_y = sy;
for(int i = 0; i < factory.size(); i++){
ans += bfs(start_x, start_y, factory[i].x, factory[i].y);
start_x = factory[i].x; start_y = factory[i].y;
}
cout<<ans<<endl;
return 0;
}
int bfs(int sx, int sy, int ex, int ey)
{
queue<Point> q;
Point s;
s.x = sx; s.y = sy; s.cost = 0;//蛻晏ァ句喧蠑?ァ狗噪豁・謨ー荳コ0
q.push(s);//謚願オキ蟋狗せ謾セ蛻ー髦溷?荳ュ
while(!q.empty()){
s = q.front();
q.pop();
for(int i = 0; i < 4; i++){
int xx,yy;
xx = s.x + dx[i]; yy = s.y + dy[i];
if(xx == ex && yy == ey) return s.cost+1;//螯よ棡蟾イ扈丞芦莠?サ育せ蛻呵ソ泌屓螳?噪豁・謨ー
if(xx >= 0 && xx < H && yy >= 0 && yy < W && map[xx][yy] != 'X'){
Point now;
now.x = xx; now.y = yy; now.cost = s.cost + 1;
cout<<now.x<<'\t'<<now.y<<'\t'<<now.cost<<endl;
q.push(now);
}
}//for()
}//while()
}//bfs() | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s770263445 | p00481 | C | #include <stdio.h>
#include <queue>
using namespace std;
const int INF = 100000;
char maze[1005][1005];
int d[1005][1005];
int w, h;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct Coor {
int x, y;
Coor(int x, int y) : x(x), y(y) {}
};
queue<Coor> Q;
int bfs(int sx, int sy, int gx, int gy)
{
int i, j;
int nx, ny;
while (Q.size() != 0){
Q.pop();
}
for (i = 0; i < h; i++){
for (j = 0; j < w; j++){
d[i][j] = INF;
}
}
d[sy][sx] = 0;
Q.push(Coor(sx, sy));
while (Q.size() != 0){
Coor p = Q.front();
Q.pop();
if (p.x == gx && p.y == gy){
break;
}
for (i = 0; i < 4; i++){
nx = p.x + dx[i];
ny = p.y + dy[i];
if (nx >= 0 && ny >= 0 && nx < w && ny < h && maze[ny][nx] != 'X' && d[ny][nx] == INF){
Q.push(Coor(nx, ny));
d[ny][nx] = d[p.y][p.x] + 1;
}
}
}
return (d[gy][gx]);
}
int main(void)
{
int n, ans = 0;
int sx, sy;
int x, y;
int i, j;
int gx[9], gy[9];
scanf("%d %d %d", &h, &w, &n);
for (i = 0; i < h; i++){
for (j = 0; j < w; j++){
scanf(" %c", &maze[i][j]);
if (maze[i][j] == 'S'){
sx = j;
sy = i;
}
else if (maze[i][j] == '1'){
gx[0] = j;
gy[0] = i;
}
else if (maze[i][j] == '2'){
gx[1] = j;
gy[1] = i;
}
else if (maze[i][j] == '3'){
gx[2] = j;
gy[2] = i;
}
else if (maze[i][j] == '4'){
gx[3] = j;
gy[3] = i;
}
else if (maze[i][j] == '5'){
gx[4] = j;
gy[4] = i;
}
else if (maze[i][j] == '6'){
gx[5] = j;
gy[5] = i;
}
else if (maze[i][j] == '7'){
gx[6] = j;
gy[6] = i;
}
else if (maze[i][j] == '8'){
gx[7] = j;
gy[7] = i;
}
else if (maze[i][j] == '9'){
gx[8] = j;
gy[8] = i;
}
}
}
ans += bfs(sx, sy, gx[0], gy[0]);
for (i = 1; i < n; i++){
ans += bfs(gx[i - 1], gy[i - 1], gx[i], gy[i]);
}
printf("%d\n", ans);
return (0);
} | main.c:2:10: fatal error: queue: No such file or directory
2 | #include <queue>
| ^~~~~~~
compilation terminated.
|
s260814148 | p00481 | C++ | #include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
const int MAX_H = 1000;
const int MAX_W = 1000;
const int MAX_N = 9;
const int INF = INT32_MAX;
char maze[MAX_H][MAX_W + 1];
int H, W, N;
int si, sj;
int gi[MAX_N + 1], gj[MAX_N + 1];
int d[MAX_H][MAX_W];
int dx[4] = {0, 1, 0, -1};
int dy[4] = {-1, 0, 1, 0};
int bfs(int goalNum)
{
queue<P> que;
int cgi = gi[goalNum], cgj = gj[goalNum];
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
d[i][j] = INF;
que.push(P(si, sj));
d[si][sj] = 0;
while (que.size()) {
P p = que.front(); que.pop();
if (p.first == cgi && p.second == cgj) break;
for (int i = 0; i < 4; i++) {
int ni = p.first + dx[i], nj = p.second + dy[i];
if (0 <= ni && ni < H && 0 <= nj && nj < W && maze[ni][nj] != 'X' && d[ni][nj] == INF) {
que.push(P(ni, nj));
d[ni][nj] = d[p.first][p.second] + 1;
}
}
}
return d[cgi][cgj];
}
int solve()
{
int res = 0;
for (int i = 1; i <= N; i++) {
// printf("%d:(%d, %d) => ", i, si, sj);
res += bfs(i);
si = gi[i]; sj = gj[i];
// printf("(%d, %d):%d\n", si, sj, res);
}
return res;
}
int main()
{
scanf("%d %d %d", &H, &W, &N);
for (int i = 0; i < H; i++) {
scanf("%s", maze[i]);
maze[i][W] = 0;
for (int j = 0; j < W; j++) {
if ('0' < maze[i][j] && maze[i][j] <= '9') {
gi[maze[i][j] - '0'] = i;
gj[maze[i][j] - '0'] = j;
}
if (maze[i][j] == 'S') {
si = i;
sj = j;
}
}
}
printf("%d\n", solve());
}
| a.cc:12:17: error: 'INT32_MAX' was not declared in this scope
12 | const int INF = INT32_MAX;
| ^~~~~~~~~
a.cc:4:1: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
3 | #include <queue>
+++ |+#include <cstdint>
4 |
|
s888144305 | p00481 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<string>
#include<cstdio>
#include<stack>
#include<cmath>
#include<bitset>
#include<memory>
#include<utility>
#include<map>
using namespace std;
#define FOR(i,m,n) for(i=m;i<n;i++)
#define CLR(a,b) memset(a,b,sizeof(a))
#define ROF(i,m,n) for(i=m;i>=n;i--)
#define BUG cout<<"debug"<<endl;
#define RT return
#define BK break
#define HEAP priority_queue
#define SP " "
#define rd(x) (rand()%(x))
#define lowf(a,b,c) lower_bound(a,b,c)
#define upf(a,b,c) upper_bound(a,b,c)
#define sh(a) cout<<a<<endl
typedef long long LL;
typedef vector<int> VI;
const int INF = 2147483647;
const int NEN = -INF - 1;
const LL LINF = 9223372036854775807;
int W, H, I1, J1,N;char g[1005][1005];
bool vis[1005][1005];
bool can(int x, int y)
{
return x >= 0 && y >= 0 && x < H&&y < W&&g[x][y]!='X';
}
typedef struct node
{
int i, j, sum;
node()
{
;
}
node(int a, int b, int c)
{
i = a; j = b; sum = c;
}
}node;
queue<node>bfs;
typedef struct pos
{
int x,y;
}pos;
pos all[10];
int dir[4][2] = { {1,0},{-1,0},{0,1},{0,-1} };
int main()
{
cin >> H >> W >> N;
node temp;
int T,i,j,ans=0;
FOR(i, 0, H)
{
FOR(j, 0, W)
{
//cin >> g[i][j];
scanf("%c",&g[i][j]);
if (g[i][j] > '0'&&g[i][j] <='9')
{
all[g[i][j] - 48].x = i;
all[g[i][j] - 48].y = j;
}
else if (g[i][j] == 'S')I1 = i, J1 = j;
}
}
FOR(T,0,N)
{
CLR(vis, 0);
while (!bfs.empty())bfs.pop();
if(T>0)bfs.push(node(all[T].x, all[T].y, 0));
else bfs.push(node(I1, J1, 0));
while (!bfs.empty())
{
temp = bfs.front();
bfs.pop();
if (g[temp.i][temp.j] == T+48+1)
{
ans += temp.sum;
break;
}
int k = 4,tx,ty;
while (k--)
{
tx = temp.i + dir[k][0];
ty = temp.j + dir[k][1];
if (can(tx, ty) == true&&!vis[tx][ty])
{
vis[tx][ty] = 1;
bfs.push(node(tx, ty, temp.sum + 1));
}
}
}
}
cout << ans;
}
| a.cc: In function 'int main()':
a.cc:16:18: error: 'memset' was not declared in this scope
16 | #define CLR(a,b) memset(a,b,sizeof(a))
| ^~~~~~
a.cc:78:17: note: in expansion of macro 'CLR'
78 | CLR(vis, 0);
| ^~~
a.cc:14:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
13 | #include<map>
+++ |+#include <cstring>
14 | using namespace std;
|
s556055106 | p00481 | C++ | #include <cstdio>
#include <utility>
#include <queue>
#include <cstdlib>
using namespace std;
int H, W, N;
char field[1001][1001];
int d[1000][1000];
pair<int, int> start;
pair<int, int> cheese;
int INF = 1000000;
int result = 0;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
void bfs()
{
for (int n = 1; n < N + 1; n++)
{
queue<pair<int, int>> que;
for (int i = 0; i < H; i++)
{
for (int j = 0; j < W; j++)
{
d[i][j] = INF;
}
}
que.push(start);
d[start.first][start.second] = 0;
while (que.size())
{
pair<int, int> p = que.front();
que.pop();
if (field[p.first][p.second] == '0' + (char)n)
{
cheese = p;
break;
}
for (int i = 0; i < 4; i++)
{
int nx = p.first + dx[i];
int ny = p.second + dy[i];
if (0 <= nx && nx < H && 0 <= ny && ny < W && field[nx][ny] != 'X' && d[nx][ny] == INF)
{
que.push(pair<int, int>(nx, ny));
d[nx][ny] = d[p.first][p.second] + 1;
}
}
}
result += d[cheese.first][cheese.second];
start = cheese;
}
}
int main() {
scanf(" %d %d %d", &H, &W, &N);
for (int i = 0; i < H; i++)
{
for (int j = 0; j < W; j++)
{
scanf(" %c", &field[i][j]);
if (field[i][j] == 'S')
{
start.first = i;
start.second = j;
}
}
}
bfs();
printf("%d\n", result);
}= 0; i < 4; i++)
{
int nx = p.first + dx[i];
int ny = p.second + dy[i];
if (0 <= nx && nx < H && 0 <= ny && ny < W && field[nx][ny] != 'X' && d[nx][ny] == INF)
{
que.push(pair<int, int>(nx, ny));
d[nx][ny] = d[p.first][p.second] + 1;
}
}
}
result += d[cheese.first][cheese.second];
start = cheese;
}
}
int main() {
scanf(" %d %d %d", &H, &W, &N);
for (int i = 0; i < H; i++)
{
for (int j = 0; j < W; j++)
{
scanf(" %c", &field[i][j]);
if (field[i][j] == 'S')
{
start.first = i;
start.second = j;
}
}
}
bfs();
printf("%d\n", result);
}
| a.cc:76:2: error: expected unqualified-id before '=' token
76 | }= 0; i < 4; i++)
| ^
a.cc:76:7: error: 'i' does not name a type
76 | }= 0; i < 4; i++)
| ^
a.cc:76:14: error: 'i' does not name a type
76 | }= 0; i < 4; i++)
| ^
a.cc:87:9: error: expected declaration before '}' token
87 | }
| ^
a.cc:88:9: error: 'result' does not name a type
88 | result += d[cheese.first][cheese.second];
| ^~~~~~
a.cc:89:9: error: 'start' does not name a type
89 | start = cheese;
| ^~~~~
a.cc:90:5: error: expected declaration before '}' token
90 | }
| ^
a.cc:91:1: error: expected declaration before '}' token
91 | }
| ^
a.cc:93:5: error: redefinition of 'int main()'
93 | int main() {
| ^~~~
a.cc:60:5: note: 'int main()' previously defined here
60 | int main() {
| ^~~~
|
s273391503 | p00481 | C++ | #include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define VDEL(v, n) v.erase(v.begin() + (n))
#define ALL(v) v.begin(), v.end()
#define INTMAX 2147483647
#define INF 200000000
#define TINT(str) atoi(str.c_str())
#define TSTR(num) to_string(num)
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VII = vector<vector<int>>;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
PII goal[10];
char k[1000][1000];
int x0, y0;
int H,W;
int BFS(int x, int y)
{
int cost[1000][1000];
REP(i, 1000)
{
REP(h, 1000)
{
cost[i][h] = INF;
}
}
cost[x0][y0] = 0;
queue<PII> q;
q.push(make_pair(x0, y0));
while(!q.empty())
{
PII now = q.front();
q.pop();
int nx = now.first;
int ny = now.second;
REP(i, 4)
{
if(now.first + dx[i] >= H ||
now.first + dx[i] < 0) continue;
if(now.second + dy[i] >= W ||
now.second + dy[i] < 0) continue;
if(nx + dx[i] == x &&
ny + dy[i] == y)
{
return cost[nx][ny] + 1;
}
if(k[nx + dx[i]][ny + dy[i]] != 'X')
{
if(cost[nx + dx[i]][ny + dy[i]] >
cost[nx][ny])
{
cost[nx + dx[i]][ny + dy[i]] =
cost[nx][ny] + 1;
q.push({nx + dx[i], ny + dy[i]});
}
}
else continue;
}
}
}
signed main()
{
int N;
cin >> H >> W >> N;
char str[1001];
REP(h, H)
{
scanf("%s", str);
REP(w, W)
{
k[h][w] = str[w];
if(k[h][w] == 'S')
{
x0 = h;
y0 = w;
}
if(k[h][w] != '.' &&
k[h][w] != 'X')
{
goal[k[h][w] - '1'] = make_pair(h, w);
}
}
}
int ans = 0;
REP(i, N)
{
ans += BFS(goal[i].first, goal[i].second);
x0 = goal[i].first;
y0 = goal[i].second;
}
cout << ans << endl;
return 0;
}
| a.cc:29:9: error: 'long long int y0' redeclared as different kind of entity
29 | int x0, y0;
| ^~
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:256:1: note: previous declaration 'double y0(double)'
256 | __MATHCALL (y0,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'long long int BFS(long long int, long long int)':
a.cc:44:13: error: invalid types 'long long int [1000][double(double) noexcept]' for array subscript
44 | cost[x0][y0] = 0;
| ^
a.cc:48:11: error: no matching function for call to 'std::queue<std::pair<long long int, long long int> >::push(std::pair<long long int, double (*)(double) noexcept>)'
48 | q.push(make_pair(x0, y0));
| ~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157:
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::deque<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; value_type = std::pair<long long int, long long int>]'
283 | push(const value_type& __x)
| ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:30: note: no known conversion for argument 1 from 'std::pair<long long int, double (*)(double) noexcept>' to 'const std::queue<std::pair<long long int, long long int> >::value_type&' {aka 'const std::pair<long long int, long long int>&'}
283 | push(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::deque<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; value_type = std::pair<long long int, long long int>]'
288 | push(value_type&& __x)
| ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:25: note: no known conversion for argument 1 from 'std::pair<long long int, double (*)(double) noexcept>' to 'std::queue<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
288 | push(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:100:20: error: assignment of function 'double y0(double)'
100 | y0 = w;
| ~~~^~~
a.cc:115:12: error: assignment of function 'double y0(double)'
115 | y0 = goal[i].second;
| ~~~^~~~~~~~~~~~~~~~
a.cc: In function 'long long int BFS(long long int, long long int)':
a.cc:83:1: warning: control reaches end of non-void function [-Wreturn-type]
83 | }
| ^
|
s052950174 | p00481 | C++ | #include <iostream>
#include <utility>
#include <queue>
using namespace std;
typedef pair<int, int> Pair;
const int INF = 100000000;
int H, W;
char N;
const int MAX_H = 1000, MAX_W = 1000;
char plant[MAX_H][MAX_W];
int sx, sy;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
int d[MAX_H][MAX_W];
int time;
void bfs() {
queue<Pair> que;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
d[i][j] = INF;
}
}
char muscle = '1';
que.push(Pair(sx,sy));
d[sx][sy] = 0;
while (que.size()) {
Pair p = que.front(); que.pop();
if (muscle-1 == N) break;
for (int i = 0; i < 4; i++) {
int nx = p.first + dx[i], ny = p.second + dy[i];
if (0 <= nx && nx < H && 0 <= ny && ny < W && plant[nx][ny] != 'X' && d[nx][ny] == INF) {
que.push(Pair(nx, ny));
d[nx][ny] = d[p.first][p.second] + 1;
}
if (muscle == plant[nx][ny]) {
while(que.size()) {que.pop();}
que.push(Pair(nx, ny));
muscle = muscle + 1;
time += d[nx][ny];
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
d[i][j] = INF;
}
}
d[nx][ny] = 0;
break;
}
}
}
}
void solve() {
time = 0;
bfs();
cout << time << endl;
}
int main () {
cin >> H >> W >> N;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
cin >> plant[i][j];
if(plant[i][j] == 'S') {sx = i; sy = j;}
}
}
solve();
}
| a.cc:16:5: error: 'int time' redeclared as different kind of entity
16 | int time;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void bfs()':
a.cc:41:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
41 | time += d[nx][ny];
| ~~~~~^~~~~~~~~~~~
a.cc:41:22: error: assignment of read-only location 'time'
a.cc: In function 'void solve()':
a.cc:55:10: error: assignment of function 'time_t time(time_t*)'
55 | time = 0;
| ~~~~~^~~
|
s411349562 | p00481 | C++ | #include <iostream>
#include <utility>
#include <queue>
using namespace std;
typedef pair<int, int> Pair;
const int INF = 100000000;
int H, W;
char N;
const int MAX_H = 1000, MAX_W = 1000;
char plant[MAX_H][MAX_W];
int sx, sy;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
int d[MAX_H][MAX_W];
int time;
void bfs() {
queue<Pair> que;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
d[i][j] = INF;
}
}
char muscle = '1';
que.push(Pair(sx,sy));
d[sx][sy] = 0;
while (que.size()) {
Pair p = que.front(); que.pop();
if (muscle-1 == N) break;
for (int i = 0; i < 4; i++) {
int nx = p.first + dx[i], ny = p.second + dy[i];
if (0 <= nx && nx < H && 0 <= ny && ny < W && plant[nx][ny] != 'X' && d[nx][ny] == INF) {
que.push(Pair(nx, ny));
d[nx][ny] = d[p.first][p.second] + 1;
}
if (muscle == plant[nx][ny]) {
while(que.size()) {que.pop();}
que.push(Pair(nx, ny));
muscle = muscle + 1;
time += d[nx][ny];
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
d[i][j] = INF;
}
}
d[nx][ny] = 0;
break;
}
}
}
}
void solve() {
time = 0;
bfs();
cout << time << endl;
}
int main () {
cin >> H >> W >> N;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
cin >> plant[i][j];
if(plant[i][j] == 'S') {sx = i; sy = j;}
}
}
solve();
}
| a.cc:16:5: error: 'int time' redeclared as different kind of entity
16 | int time;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void bfs()':
a.cc:41:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
41 | time += d[nx][ny];
| ~~~~~^~~~~~~~~~~~
a.cc:41:22: error: assignment of read-only location 'time'
a.cc: In function 'void solve()':
a.cc:55:10: error: assignment of function 'time_t time(time_t*)'
55 | time = 0;
| ~~~~~^~~
|
s993281487 | p00481 | C++ | #include <iostream>
#include <utility>
#include <queue>
using namespace std;
typedef pair<int, int> Pair;
const int INF = 100000000;
int H, W;
char N;
const int MAX_H = 1000, MAX_W = 1000;
char plant[MAX_H][MAX_W];
int sx, sy;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
int d[MAX_H][MAX_W];
int time;
void bfs() {
queue<Pair> que;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
d[i][j] = INF;
}
}
char muscle = '1';
que.push(Pair(sx,sy));
d[sx][sy] = 0;
while (que.size()) {
Pair p = que.front(); que.pop();
if (muscle-1 == N) break;
for (int i = 0; i < 4; i++) {
int nx = p.first + dx[i], ny = p.second + dy[i];
if (0 <= nx && nx < H && 0 <= ny && ny < W && plant[nx][ny] != 'X' && d[nx][ny] == INF) {
que.push(Pair(nx, ny));
d[nx][ny] = d[p.first][p.second] + 1;
}
if (muscle == plant[nx][ny]) {
while(que.size()) {que.pop();}
que.push(Pair(nx, ny));
muscle = muscle + 1;
time += d[nx][ny];
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
d[i][j] = INF;
}
}
d[nx][ny] = 0;
break;
}
}
}
}
void solve() {
time = 0;
bfs();
cout << time << endl;
}
int main () {
cin >> H >> W >> N;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
cin >> plant[i][j];
if(plant[i][j] == 'S') {sx = i; sy = j;}
}
}
solve();
}
| a.cc:16:5: error: 'int time' redeclared as different kind of entity
16 | int time;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void bfs()':
a.cc:41:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
41 | time += d[nx][ny];
| ~~~~~^~~~~~~~~~~~
a.cc:41:22: error: assignment of read-only location 'time'
a.cc: In function 'void solve()':
a.cc:55:10: error: assignment of function 'time_t time(time_t*)'
55 | time = 0;
| ~~~~~^~~
|
s137392589 | p00481 | C++ | #include <iostream>
#include <utility>
#include <queue>
using namespace std;
typedef pair<int, int> Pair;
const int INF = 100000000;
int H, W;
char N;
const int MAX_H = 1000, MAX_W = 1000;
char plant[MAX_H][MAX_W];
int sx, sy;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
int d[MAX_H][MAX_W];
int time;
void bfs() {
queue<Pair> que;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
d[i][j] = INF;
}
}
char muscle = '1';
que.push(Pair(sx,sy));
d[sx][sy] = 0;
while (que.size()) {
Pair p = que.front(); que.pop();
if (muscle-1 == N) break;
for (int i = 0; i < 4; i++) {
int nx = p.first + dx[i], ny = p.second + dy[i];
if (0 <= nx && nx < H && 0 <= ny && ny < W && plant[nx][ny] != 'X' && d[nx][ny] == INF) {
que.push(Pair(nx, ny));
d[nx][ny] = d[p.first][p.second] + 1;
}
if (muscle == plant[nx][ny]) {
while(que.size()) {que.pop();}
que.push(Pair(nx, ny));
muscle = muscle + 1;
time += d[nx][ny];
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
d[i][j] = INF;
}
}
d[nx][ny] = 0;
break;
}
}
}
}
void solve() {
time = 0;
bfs();
cout << time << endl;
}
int main () {
cin >> H >> W >> N;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
cin >> plant[i][j];
if(plant[i][j] == 'S') {sx = i; sy = j;}
}
}
solve();
return 0;
}
| a.cc:16:5: error: 'int time' redeclared as different kind of entity
16 | int time;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void bfs()':
a.cc:41:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
41 | time += d[nx][ny];
| ~~~~~^~~~~~~~~~~~
a.cc:41:22: error: assignment of read-only location 'time'
a.cc: In function 'void solve()':
a.cc:55:10: error: assignment of function 'time_t time(time_t*)'
55 | time = 0;
| ~~~~~^~~
|
s108000418 | p00481 | C++ | #include <iostream>
#include <cstdio>
#include <utility>
#include <queue>
using namespace std;
typedef pair<int, int> Pair;
const int INF = 100000000;
int H, W, N;
const int MAX_H = 1000, MAX_W = 1000;
char plant[MAX_H][MAX_W];
int sx, sy;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
int d[MAX_H][MAX_W];
int time;
void bfs() {
queue<Pair> que;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
d[i][j] = INF;
}
}
char muscle = '1';
que.push(Pair(sx,sy));
d[sx][sy] = 0;
while (que.size()) {
Pair p = que.front(); que.pop();
if (int(muscle)-49 == N) break;
for (int i = 0; i < 4; i++) {
int nx = p.first + dx[i], ny = p.second + dy[i];
if (0 <= nx && nx < H && 0 <= ny && ny < W && plant[nx][ny] != 'X' && d[nx][ny] == INF) {
que.push(Pair(nx, ny));
d[nx][ny] = d[p.first][p.second] + 1;
}
if (muscle == plant[nx][ny]) {
while(que.size()) {que.pop();}
que.push(Pair(nx, ny));
muscle = muscle + 1;
time += d[nx][ny];
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
d[i][j] = INF;
}
}
d[nx][ny] = 0;
break;
}
}
}
}
// void solve() {
// time = 0;
// bfs();
// cout << time << endl;
// }
// int main () {
// cin >> H >> W >> N;
// for (int i = 0; i < H; i++) {
// for (int j = 0; j < W; j++) {
// cin >> plant[i][j];
// if(plant[i][j] == 'S') {sx = i; sy = j;}
// }
// }
// solve();
// }
void solve() {
time = 0;
bfs();
printf("%d",time);
}
int main () {
scanf("%d%d%d",&H,&W,&N);
for (int i = 0; i < H; i++) {
scanf("%s", plant[i]);
for (int j = 0; j < W; j++) {
if(plant[i][j] == 'S') {sx = i; sy = j;}
}
}
solve();
}
| a.cc:16:5: error: 'int time' redeclared as different kind of entity
16 | int time;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void bfs()':
a.cc:41:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
41 | time += d[nx][ny];
| ~~~~~^~~~~~~~~~~~
a.cc:41:22: error: assignment of read-only location 'time'
a.cc: In function 'void solve()':
a.cc:72:10: error: assignment of function 'time_t time(time_t*)'
72 | time = 0;
| ~~~~~^~~
|
s677403806 | p00481 | C++ |
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <queue>
using namespace std;
int h,w,n;
char map[1010][1010]={0};
bool flag[1010][1010]={false};
int arr[11][2]={0};
int dir[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };
class node
{
public:
node(int x,int y,int s);
int x;
int y;
int s;
};
node::node(int x,int y,int s)
{
this->x=x;
this->y=y;
this->s=s;
}
int bfs(int sx,int sy,int dx,int dy)
{
queue<node> que;
node no(sx,sy,0);
que.push(no);
flag[sx][sy]=true;
while(!que.empty())
{
node cur=que.front();
que.pop();
if(cur.x==dx && cur.y==dy)
return cur.s;
for(int i=0;i<4;i++)
{
int tx=cur.x+dir[i][0];
int ty=cur.y+dir[i][1];
if(map[tx][ty]!='X' && flag[tx][ty] !=true && tx>=0 && tx<h && ty>=0 && ty<w)
{
node next(tx,ty,cur.s+1);
que.push(next);
flag[tx][ty]=true;
}
}
}
return -1;
}
int main()
{
cin>>h>>w>>n;
for(int i=0;i<h;i++)
for(int j=0;j<w;j++)
{
cin>>map[i][j];
if(map[i][j]=='S')
{
arr[0][0]=i;
arr[0][1]=j;
map[i][j]='.';
}
else if(isdigit(map[i][j]))
{
int d=map[i][j]-'0';
arr[d][0]=i;
arr[d][1]=j;
}
}
int ans=0;
for(int i=0;i<n;i++)
{
memset(flag,false,sizeof(flag));
ans+=bfs(arr[i][0],arr[i][1],arr[i+1][0],arr[i+1][1]);
}
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:79:17: error: 'memset' was not declared in this scope
79 | memset(flag,false,sizeof(flag));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <queue>
+++ |+#include <cstring>
6 | using namespace std;
|
s573253883 | p00481 | C++ | #include <iostream>
#include <queue>
using namespace std;
#define MAXN 1001
char A[MAXN][MAXN];
int w,h,n;
int s[2];
void input()
{
cin>>h>>w>>n;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>A[i][j];
if(A[i][j]=='S'){
s[0]=i;
s[1]=j;
}
}
}
}
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
using P = pair<pair<int,int>,int>;
int known[MAXN][MAXN];
int bfs(int& x, int& y, char k)
{
queue<P>que;
que.push(P(make_pair(x, y), 0));
while(!que.empty()){
P cur = que.front();
// cout<<"*"<<cur.first.first<<" "<<cur.first.second<<endl;
que.pop();
if(A[cur.first.first][cur.first.second]==k){
x = cur.first.first;
y = cur.first.second;
return cur.second;
}
for(int i=0;i<4;i++){
int nx = cur.first.first+dx[i];
int ny = cur.first.second+dy[i];
if(0<=nx&&nx<h && 0<=ny&&ny<w && A[nx][ny]!='X' && !known[nx][ny]){
que.push(P(make_pair(nx, ny), cur.second+1));
known[nx][ny]=1;
}
}
}
return 0x3fffffff;
}
int main()
{
input();
int res = 0;
int x, y;
x = s[0];
y = s[1];
for(int i=1;i<=n;i++){
memset(known, 0, sizeof(int)*MAXN*MAXN);
int tmp = bfs(x, y, '0'+i);
res += tmp;
}
cout<<res<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:63:9: error: 'memset' was not declared in this scope
63 | memset(known, 0, sizeof(int)*MAXN*MAXN);
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <queue>
+++ |+#include <cstring>
3 | using namespace std;
|
s081476553 | p00481 | C++ | #include <iostream>
#include <queue>
using namespace std;
#define MAXN 1001
char A[MAXN][MAXN];
int w,h,n;
int s[2];
void input()
{
cin>>h>>w>>n;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>A[i][j];
if(A[i][j]=='S'){
s[0]=i;
s[1]=j;
}
}
}
}
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
typedef pair<pair<int,int>,int> P;
int known[MAXN][MAXN];
int bfs(int& x, int& y, char k)
{
queue<P>que;
que.push(P(make_pair(x, y), 0));
while(!que.empty()){
P cur = que.front();
// cout<<"*"<<cur.first.first<<" "<<cur.first.second<<endl;
que.pop();
if(A[cur.first.first][cur.first.second]==k){
x = cur.first.first;
y = cur.first.second;
return cur.second;
}
for(int i=0;i<4;i++){
int nx = cur.first.first+dx[i];
int ny = cur.first.second+dy[i];
if(0<=nx&&nx<h && 0<=ny&&ny<w && A[nx][ny]!='X' && !known[nx][ny]){
que.push(P(make_pair(nx, ny), cur.second+1));
known[nx][ny]=1;
}
}
}
return 0x3fffffff;
}
int main()
{
input();
int res = 0;
int x, y;
x = s[0];
y = s[1];
for(int i=1;i<=n;i++){
memset(known, 0, sizeof(int)*MAXN*MAXN);
int tmp = bfs(x, y, '0'+i);
res += tmp;
}
cout<<res<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:63:9: error: 'memset' was not declared in this scope
63 | memset(known, 0, sizeof(int)*MAXN*MAXN);
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <queue>
+++ |+#include <cstring>
3 | using namespace std;
|
s824426701 | p00481 | C++ | #include <iostream>
#include <queue>
#include <string>
using namespace std;
#define MAXN 1001
char A[MAXN][MAXN];
int w,h,n;
int s[2];
void input()
{
cin>>h>>w>>n;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>A[i][j];
if(A[i][j]=='S'){
s[0]=i;
s[1]=j;
}
}
}
}
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
typedef pair<pair<int,int>,int> P;
int known[MAXN][MAXN];
int bfs(int& x, int& y, char k)
{
queue<P>que;
que.push(P(make_pair(x, y), 0));
while(!que.empty()){
P cur = que.front();
// cout<<"*"<<cur.first.first<<" "<<cur.first.second<<endl;
que.pop();
if(A[cur.first.first][cur.first.second]==k){
x = cur.first.first;
y = cur.first.second;
return cur.second;
}
for(int i=0;i<4;i++){
int nx = cur.first.first+dx[i];
int ny = cur.first.second+dy[i];
if(0<=nx&&nx<h && 0<=ny&&ny<w && A[nx][ny]!='X' && !known[nx][ny]){
que.push(P(make_pair(nx, ny), cur.second+1));
known[nx][ny]=1;
}
}
}
return 0x3fffffff;
}
int main()
{
input();
int res = 0;
int x, y;
x = s[0];
y = s[1];
for(int i=1;i<=n;i++){
memset(known, 0, sizeof(int)*MAXN*MAXN);
int tmp = bfs(x, y, '0'+i);
res += tmp;
}
cout<<res<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:64:9: error: 'memset' was not declared in this scope
64 | memset(known, 0, sizeof(int)*MAXN*MAXN);
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <queue>
+++ |+#include <cstring>
3 | #include <string>
|
s986880079 | p00481 | C++ | //幅優先探索
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<set>
#include<map>
#include<memory>
#define FOR(i,R) for(int i=0;i<R;i++)
#define ZERO(a) memset(a,0,sizeof(a))
using namespace std;
typedef pair<int,int> P;
const int INF=10000;
//init()
char maze[1024][1024];
int H,W,N;
int sx,sy;
int gx,gy;
int e[16][3];
int d[1024][1024];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int bfs(){
queue<P> que;
for(int i=0;i<H;i++)for(int j=0;j<W;j++)d[i][j]=INF;
que.push(P(sx,sy));
d[sx][sy]=0;
while(que.size()){
P p=que.front(); que.pop();
if(p.first==gx&&p.second==gy)break;
for(int i=0;i<4;i++){
int nx=p.first+dx[i],ny=p.second+dy[i];
if(0<=nx&&nx<H&&0<=ny&&ny<W&&maze[nx][ny]!='X'&&d[nx][ny]==INF){
que.push(P(nx,ny));
d[nx][ny]=d[p.first][p.second]+1;
}
}
}
return d[gx][gy];
}
void main(){
int i,j,k=0,t=0;
cin>>H>>W>>N;
FOR(i,H)FOR(j,W){
cin>>maze[i][j];
if(maze[i][j]=='S'){
sx=i;sy=j;
}else if('0'<=maze[i][j]&&maze[i][j]<='9'){
k=maze[i][j]-'0';
e[k][0]=i;e[k][1]=j;
}
}
FOR(i,N){
if(i==0){
gx=e[1][0];
gy=e[1][1];
}else{
sx=e[i][0];
sy=e[i][1];
gx=e[i+1][0];
gy=e[i+1][1];
}
t+=bfs();
}
cout<<t<<endl;
} | a.cc:47:1: error: '::main' must return 'int'
47 | void main(){
| ^~~~
|
s726854173 | p00481 | C++ | #include<iostream>
#include<queue>
const int MAXW = 1 | a.cc:4:19: error: expected ',' or ';' at end of input
4 | const int MAXW = 1
| ^
|
s820193008 | p00481 | C++ | #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#pragma warning(disable:4996)
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
using namespace std;
struct point{
Int j, i,step;
point(Int i_, Int j_,Int s) :i(i_), j(j_),step(s){}
};
int dx[4] = { 0, -1, 0, 1 };
int dy[4] = { 1, 0, -1, 0 };
queue<point> que;
char tile[1001][1001];
int H, W;
bool ed[1001][1001];
point solve(char target)
{
while (!que.empty()){
point now(que.front());
ed[now.i][now.j] = true;
que.pop();
REP(i, 4){
int x = now.j + dx[i];
int y = now.i + dy[i];
if (x < 0 || y < 0 || x > W || y > H || ed[y][x])
continue;
if (tile[y][x] == target){
return point(y, x,now.step+1);
}
if (tile[y][x] != 'X'){
que.push(point(y, x, now.step + 1));
ed[y][x] = true;
}
}
}
}
int main()
{
cin.tie(0); ios::sync_with_stdio(false);
//fstream fs("input.txt");
////////////ここから開始///////////
int n(0);
cin >> H >> W >> n;
REP(i, 1001)REP(j, 1001){ tile[i][j] = 'X'; ed[i][j] = false; }
REP(i, H)REP(j, W)cin >> tile[i][j];
REP(i, H)REP(j, W){ if (tile[i][j] == 'S')que.emplace(i, j, 0); }
for (int i = 0; i < n; ++i){
REP(i_1, H + 1)REP(j_1, W + 1){ ed[i_1][j_1] = false; }
point t = solve('1' + i);
que = {};
que.emplace(t);
que.front().step
}
cout << que.front().step << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:76:33: error: expected ';' before '}' token
76 | que.front().step
| ^
| ;
77 | }
| ~
a.cc: In function 'point solve(char)':
a.cc:55:1: warning: control reaches end of non-void function [-Wreturn-type]
55 | }
| ^
|
s998469083 | p00481 | C++ | #include<iostream>
#include<queue>
#define fi first
#define se second
using namespace std;
int dy[4]={0,0,-1,1},dx[4]={1,-1,0,0};
int X,Y,N;
typedef pair<int,int>P;
char field[1000][1001];
P time[1000][1001];//first->time,second->cheese
typedef struct point{
int y,x,t,n;
}point;
int bfs(int,int);
int main(){
cin>>Y>>X>>N;
int rep=0;
for(int i=0;i<Y;i++)cin>>field[i];
for(int i=0;i<Y;i++){
for(int j=0;j<X;j++){
time[i][j].fi=time[i][j].se=-1;
}
}
for(int i=0;i<Y;i++){
bool flag=false;
for(int j=0;j<X;j++){
if(field[i][j]=='S'){
rep=bfs(i,j);
flag=true;
break;
}
}
if(flag)break;
}
cout<<rep<<endl;
return 0;
}
int bfs(int y,int x){
point start={y,x,0,0};
queue<point>Q;
Q.push(start);
while(Q.size()){
point a;
a=Q.front();
Q.pop();
if(a.y<0 || a.y>=Y ||a.x<0||a.x>=X)continue;
if(field[a.y][a.x]=='X')continue;
if(a.n+1==field[a.y][a.x]-'0')a.n++;
if(a.n>time[a.y][a.x].se){
time[a.y][a.x].fi=a.t;
time[a.y][a.x].se=a.n;
}else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
time[a.y][a.x].fi=a.t;
}else continue;
if(a.n==N){//ゴール判定
return a.t;
}
for(int i=0;i<4;i++){
point next={a.y+dy[i],a.x+dx[i],a.t+1,a.n};
Q.push(next);
}
}
} | a.cc:10:18: error: 'P time [1000][1001]' redeclared as different kind of entity
10 | P time[1000][1001];//first->time,second->cheese
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:21:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:21:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:21:24: note: in expansion of macro 'fi'
21 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc:21:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:21:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:21:38: note: in expansion of macro 'se'
21 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc: In function 'int bfs(int, int)':
a.cc:55:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
55 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:55:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
55 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:55:31: note: in expansion of macro 'se'
55 | if(a.n>time[a.y][a.x].se){
| ^~
a.cc:56:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | time[a.y][a.x].fi=a.t;
| ^
a.cc:56:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:56:28: note: in expansion of macro 'fi'
56 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:57:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].se=a.n;
| ^
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].se=a.n;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:57:28: note: in expansion of macro 'se'
57 | time[a.y][a.x].se=a.n;
| ^~
a.cc:58:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:58:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:58:38: note: in expansion of macro 'se'
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:58:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:58:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:58:61: note: in expansion of macro 'fi'
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:59:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[a.y][a.x].fi=a.t;
| ^
a.cc:59:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:59:28: note: in expansion of macro 'fi'
59 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:77:1: warning: control reaches end of non-void function [-Wreturn-type]
77 | }
| ^
|
s447454251 | p00481 | C++ | #include<iostream>
#include<queue>
#define fi first
#define se second
using namespace std;
int dy[4]={0,0,-1,1},dx[4]={1,-1,0,0};
int X,Y,N;
typedef pair<int,int>P;
char field[1000][1001];
P time[1000][1001];
typedef struct point{
int y,x,t,n;
}point;
int bfs(int,int);
int main(){
cin>>Y>>X>>N;
int rep=0;
for(int i=0;i<Y;i++)cin>>field[i];
for(int i=0;i<Y;i++){
for(int j=0;j<X;j++){
time[i][j].fi=time[i][j].se=-1;
}
}
for(int i=0;i<Y;i++){
bool flag=false;
for(int j=0;j<X;j++){
if(field[i][j]=='S'){
rep=bfs(i,j);
flag=true;
break;
}
}
if(flag)break;
}
cout<<rep<<endl;
return 0;
}
int bfs(int y,int x){
point start={y,x,0,0};
queue<point>Q;
Q.push(start);
while(Q.size()){
point a;
a=Q.front();
Q.pop();
if(a.y<0 || a.y>=Y ||a.x<0||a.x>=X)continue;
if(field[a.y][a.x]=='X')continue;
if(a.n+1==field[a.y][a.x]-'0')a.n++;
if(a.n>time[a.y][a.x].se){
time[a.y][a.x].fi=a.t;
time[a.y][a.x].se=a.n;
}else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
time[a.y][a.x].fi=a.t;
}else continue;
if(a.n==N){
return a.t;
}
for(int i=0;i<4;i++){
point next={a.y+dy[i],a.x+dx[i],a.t+1,a.n};
Q.push(next);
}
}
} | a.cc:10:18: error: 'P time [1000][1001]' redeclared as different kind of entity
10 | P time[1000][1001];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:21:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:21:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:21:24: note: in expansion of macro 'fi'
21 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc:21:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:21:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:21:38: note: in expansion of macro 'se'
21 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc: In function 'int bfs(int, int)':
a.cc:55:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
55 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:55:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
55 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:55:31: note: in expansion of macro 'se'
55 | if(a.n>time[a.y][a.x].se){
| ^~
a.cc:56:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | time[a.y][a.x].fi=a.t;
| ^
a.cc:56:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:56:28: note: in expansion of macro 'fi'
56 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:57:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].se=a.n;
| ^
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].se=a.n;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:57:28: note: in expansion of macro 'se'
57 | time[a.y][a.x].se=a.n;
| ^~
a.cc:58:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:58:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:58:38: note: in expansion of macro 'se'
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:58:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:58:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:58:61: note: in expansion of macro 'fi'
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:59:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[a.y][a.x].fi=a.t;
| ^
a.cc:59:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:59:28: note: in expansion of macro 'fi'
59 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:77:1: warning: control reaches end of non-void function [-Wreturn-type]
77 | }
| ^
|
s678745629 | p00481 | C++ | #include<iostream>
#include<queue>
#define fi first
#define se second
using namespace std;
int dy[4]={0,0,-1,1},dx[4]={1,-1,0,0};
int X,Y,N;
typedef pair<int,int> P;
char field[1000][1001];
P time[1000][1001];
typedef struct point{
int y,x,t,n;
}point;
int bfs(int,int);
int main(){
cin>>Y>>X>>N;
int rep;
for(int i=0;i<Y;i++)cin>>field[i];
for(int i=0;i<Y;i++){
for(int j=0;j<X;j++){
time[i][j].fi=time[i][j].se=-1;
}
}
for(int i=0;i<Y;i++){
bool flag=false;
for(int j=0;j<X;j++){
if(field[i][j]=='S'){
rep=bfs(i,j);
flag=true;
break;
}
}
if(flag)break;
}
cout<<rep<<endl;
return 0;
}
int bfs(int y,int x){
point start={y,x,0,0};
queue<point>Q;
Q.push(start);
while(Q.size()){
point a;
a=Q.front();
Q.pop();
if(a.y<0 || a.y>=Y ||a.x<0||a.x>=X)continue;
if(field[a.y][a.x]=='X')continue;
if(a.n+1==field[a.y][a.x]-'0')a.n++;
if(a.n>time[a.y][a.x].se){
time[a.y][a.x].fi=a.t;
time[a.y][a.x].se=a.n;
}else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
time[a.y][a.x].fi=a.t;
}else continue;
if(a.n==N){
return a.t;
}
for(int i=0;i<4;i++){
point next={a.y+dy[i],a.x+dx[i],a.t+1,a.n};
Q.push(next);
}
}
} | a.cc:10:18: error: 'P time [1000][1001]' redeclared as different kind of entity
10 | P time[1000][1001];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:21:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:21:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:21:24: note: in expansion of macro 'fi'
21 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc:21:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:21:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:21:38: note: in expansion of macro 'se'
21 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc: In function 'int bfs(int, int)':
a.cc:55:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
55 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:55:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
55 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:55:31: note: in expansion of macro 'se'
55 | if(a.n>time[a.y][a.x].se){
| ^~
a.cc:56:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | time[a.y][a.x].fi=a.t;
| ^
a.cc:56:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:56:28: note: in expansion of macro 'fi'
56 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:57:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].se=a.n;
| ^
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].se=a.n;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:57:28: note: in expansion of macro 'se'
57 | time[a.y][a.x].se=a.n;
| ^~
a.cc:58:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:58:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:58:38: note: in expansion of macro 'se'
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:58:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:58:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:58:61: note: in expansion of macro 'fi'
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:59:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[a.y][a.x].fi=a.t;
| ^
a.cc:59:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:59:28: note: in expansion of macro 'fi'
59 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:77:1: warning: control reaches end of non-void function [-Wreturn-type]
77 | }
| ^
|
s214702209 | p00481 | C++ | #include<iostream>
#include<queue>
#define fi first
#define se second
using namespace std;
int dy[4]={0,0,-1,1},dx[4]={1,-1,0,0};
int X,Y,N;
typedef pair<int,int> P;
char field[1000][1001];
P time[1000][1001];
struct point{
int y,x,t,n;
};
int bfs(int,int);
int main(){
cin>>Y>>X>>N;
int rep;
for(int i=0;i<Y;i++)cin>>field[i];
for(int i=0;i<Y;i++){
for(int j=0;j<X;j++){
time[i][j].fi=time[i][j].se=-1;
}
}
for(int i=0;i<Y;i++){
bool flag=false;
for(int j=0;j<X;j++){
if(field[i][j]=='S'){
rep=bfs(i,j);
flag=true;
break;
}
}
if(flag)break;
}
cout<<rep<<endl;
return 0;
}
int bfs(int y,int x){
point start={y,x,0,0};
queue<point>Q;
Q.push(start);
while(Q.size()){
point a;
a=Q.front();
Q.pop();
if(a.y<0 || a.y>=Y ||a.x<0||a.x>=X)continue;
if(field[a.y][a.x]=='X')continue;
if(a.n+1==field[a.y][a.x]-'0')a.n++;
if(a.n>time[a.y][a.x].se){
time[a.y][a.x].fi=a.t;
time[a.y][a.x].se=a.n;
}else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
time[a.y][a.x].fi=a.t;
}else continue;
if(a.n==N){
return a.t;
}
for(int i=0;i<4;i++){
point next={a.y+dy[i],a.x+dx[i],a.t+1,a.n};
Q.push(next);
}
}
} | a.cc:10:18: error: 'P time [1000][1001]' redeclared as different kind of entity
10 | P time[1000][1001];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:21:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:21:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:21:24: note: in expansion of macro 'fi'
21 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc:21:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:21:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
21 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:21:38: note: in expansion of macro 'se'
21 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc: In function 'int bfs(int, int)':
a.cc:55:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
55 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:55:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
55 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:55:31: note: in expansion of macro 'se'
55 | if(a.n>time[a.y][a.x].se){
| ^~
a.cc:56:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | time[a.y][a.x].fi=a.t;
| ^
a.cc:56:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:56:28: note: in expansion of macro 'fi'
56 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:57:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].se=a.n;
| ^
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].se=a.n;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:57:28: note: in expansion of macro 'se'
57 | time[a.y][a.x].se=a.n;
| ^~
a.cc:58:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:58:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:58:38: note: in expansion of macro 'se'
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:58:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:58:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:58:61: note: in expansion of macro 'fi'
58 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:59:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[a.y][a.x].fi=a.t;
| ^
a.cc:59:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:59:28: note: in expansion of macro 'fi'
59 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:77:1: warning: control reaches end of non-void function [-Wreturn-type]
77 | }
| ^
|
s326696710 | p00481 | C++ | #include<iostream>
#include<queue>
#define fi first
#define se second
using namespace std;
int dy[4]={0,0,-1,1},dx[4]={1,-1,0,0};
int X,Y,N;
typedef pair<int,int> P;
char field[1000][1001];
P time[1000][1001];
struct point{
int y,x,t,n;
point(int y_,int x_,int t_,int n_){
y=y_;x=x_;t=t_;n=n_;
}
};
int bfs(int,int);
int main(){
cin>>Y>>X>>N;
int rep;
for(int i=0;i<Y;i++)cin>>field[i];
for(int i=0;i<Y;i++){
for(int j=0;j<X;j++){
time[i][j].fi=time[i][j].se=-1;
}
}
for(int i=0;i<Y;i++){
bool flag=false;
for(int j=0;j<X;j++){
if(field[i][j]=='S'){
rep=bfs(i,j);
flag=true;
break;
}
}
if(flag)break;
}
cout<<rep<<endl;
return 0;
}
int bfs(int y,int x){
point start=point(y,x,0,0);
queue<point>Q;
Q.push(start);
while(Q.size()){
point a=Q.front();
Q.pop();
if(a.y<0 || a.y>=Y ||a.x<0||a.x>=X)continue;
if(field[a.y][a.x]=='X')continue;
if(a.n+1==field[a.y][a.x]-'0')a.n++;
if(a.n>time[a.y][a.x].se){
time[a.y][a.x].fi=a.t;
time[a.y][a.x].se=a.n;
}else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
time[a.y][a.x].fi=a.t;
}else continue;
if(a.n==N){
return a.t;
}
for(int i=0;i<4;i++){
point next=point(a.y+dy[i],a.x+dx[i],a.t+1,a.n);
Q.push(next);
}
}
} | a.cc:10:18: error: 'P time [1000][1001]' redeclared as different kind of entity
10 | P time[1000][1001];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:24:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:24:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:24:24: note: in expansion of macro 'fi'
24 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc:24:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:24:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:24:38: note: in expansion of macro 'se'
24 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc: In function 'int bfs(int, int)':
a.cc:57:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:57:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:57:31: note: in expansion of macro 'se'
57 | if(a.n>time[a.y][a.x].se){
| ^~
a.cc:58:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | time[a.y][a.x].fi=a.t;
| ^
a.cc:58:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:58:28: note: in expansion of macro 'fi'
58 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:59:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[a.y][a.x].se=a.n;
| ^
a.cc:59:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[a.y][a.x].se=a.n;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:59:28: note: in expansion of macro 'se'
59 | time[a.y][a.x].se=a.n;
| ^~
a.cc:60:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:60:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:60:38: note: in expansion of macro 'se'
60 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:60:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:60:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:60:61: note: in expansion of macro 'fi'
60 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:61:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
61 | time[a.y][a.x].fi=a.t;
| ^
a.cc:61:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
61 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:61:28: note: in expansion of macro 'fi'
61 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:79:1: warning: control reaches end of non-void function [-Wreturn-type]
79 | }
| ^
|
s780471790 | p00481 | C++ | #include<iostream>
#include<queue>
#define fi first
#define se second
using namespace std;
int dy[4]={0,0,-1,1},dx[4]={1,-1,0,0};
int X,Y,N;
char field[1000][1001];
pair<int,int> time[1000][1001];
struct point{
int y,x,t,n;
point(int y_,int x_,int t_,int n_){
y=y_;x=x_;t=t_;n=n_;
}
};
int bfs(int,int);
int main(){
cin>>Y>>X>>N;
int rep;
for(int i=0;i<Y;i++)cin>>field[i];
for(int i=0;i<Y;i++){
for(int j=0;j<X;j++){
time[i][j].fi=time[i][j].se=-1;
}
}
for(int i=0;i<Y;i++){
bool flag=false;
for(int j=0;j<X;j++){
if(field[i][j]=='S'){
rep=bfs(i,j);
flag=true;
break;
}
}
if(flag)break;
}
cout<<rep<<endl;
return 0;
}
int bfs(int y,int x){
point start=point(y,x,0,0);
queue<point>Q;
Q.push(start);
while(Q.size()){
point a=Q.front();
Q.pop();
if(a.y<0 || a.y>=Y ||a.x<0||a.x>=X)continue;
if(field[a.y][a.x]=='X')continue;
if(a.n+1==field[a.y][a.x]-'0')a.n++;
if(a.n>time[a.y][a.x].se){
time[a.y][a.x].fi=a.t;
time[a.y][a.x].se=a.n;
}else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
time[a.y][a.x].fi=a.t;
}else continue;
if(a.n==N){
return a.t;
}
for(int i=0;i<4;i++){
point next=point(a.y+dy[i],a.x+dx[i],a.t+1,a.n);
Q.push(next);
}
}
} | a.cc:9:30: error: 'std::pair<int, int> time [1000][1001]' redeclared as different kind of entity
9 | pair<int,int> time[1000][1001];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:23:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:23:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:23:24: note: in expansion of macro 'fi'
23 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc:23:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:23:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:23:38: note: in expansion of macro 'se'
23 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc: In function 'int bfs(int, int)':
a.cc:56:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:56:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:56:31: note: in expansion of macro 'se'
56 | if(a.n>time[a.y][a.x].se){
| ^~
a.cc:57:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].fi=a.t;
| ^
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:57:28: note: in expansion of macro 'fi'
57 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:58:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | time[a.y][a.x].se=a.n;
| ^
a.cc:58:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | time[a.y][a.x].se=a.n;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:58:28: note: in expansion of macro 'se'
58 | time[a.y][a.x].se=a.n;
| ^~
a.cc:59:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:59:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:59:38: note: in expansion of macro 'se'
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:59:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:59:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:59:61: note: in expansion of macro 'fi'
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:60:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[a.y][a.x].fi=a.t;
| ^
a.cc:60:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:60:28: note: in expansion of macro 'fi'
60 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:78:1: warning: control reaches end of non-void function [-Wreturn-type]
78 | }
| ^
|
s879374229 | p00481 | C++ | #include<iostream>
#include<queue>
#define fi first
#define se second
using namespace std;
int dy[4]={0,0,-1,1},dx[4]={1,-1,0,0};
int X,Y,N;
char field[1000][1001];
pair<int,int> time[1000][1001];
struct point{
int y,x,t,n;
point(int y_,int x_,int t_,int n_){
y=y_;x=x_;t=t_;n=n_;
}
};
int bfs(int y,int x);
int main(){
cin>>Y>>X>>N;
int rep;
for(int i=0;i<Y;i++)cin>>field[i];
for(int i=0;i<Y;i++){
for(int j=0;j<X;j++){
time[i][j].fi=time[i][j].se=-1;
}
}
for(int i=0;i<Y;i++){
bool flag=false;
for(int j=0;j<X;j++){
if(field[i][j]=='S'){
rep=bfs(i,j);
flag=true;
break;
}
}
if(flag)break;
}
cout<<rep<<endl;
return 0;
}
int bfs(int y,int x){
point start=point(y,x,0,0);
queue<point>Q;
Q.push(start);
while(Q.size()){
point a=Q.front();
Q.pop();
if(a.y<0 || a.y>=Y ||a.x<0||a.x>=X)continue;
if(field[a.y][a.x]=='X')continue;
if(a.n+1==field[a.y][a.x]-'0')a.n++;
if(a.n>time[a.y][a.x].se){
time[a.y][a.x].fi=a.t;
time[a.y][a.x].se=a.n;
}else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
time[a.y][a.x].fi=a.t;
}else continue;
if(a.n==N){
return a.t;
}
for(int i=0;i<4;i++){
point next=point(a.y+dy[i],a.x+dx[i],a.t+1,a.n);
Q.push(next);
}
}
} | a.cc:9:30: error: 'std::pair<int, int> time [1000][1001]' redeclared as different kind of entity
9 | pair<int,int> time[1000][1001];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:23:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:23:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:23:24: note: in expansion of macro 'fi'
23 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc:23:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:23:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[i][j].fi=time[i][j].se=-1;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)i) + ((sizetype)j)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:23:38: note: in expansion of macro 'se'
23 | time[i][j].fi=time[i][j].se=-1;
| ^~
a.cc: In function 'int bfs(int, int)':
a.cc:56:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:56:29: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if(a.n>time[a.y][a.x].se){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:56:31: note: in expansion of macro 'se'
56 | if(a.n>time[a.y][a.x].se){
| ^~
a.cc:57:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].fi=a.t;
| ^
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:57:28: note: in expansion of macro 'fi'
57 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:58:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | time[a.y][a.x].se=a.n;
| ^
a.cc:58:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | time[a.y][a.x].se=a.n;
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:58:28: note: in expansion of macro 'se'
58 | time[a.y][a.x].se=a.n;
| ^~
a.cc:59:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:59:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:4:12: error: request for member 'second' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
4 | #define se second
| ^~~~~~
a.cc:59:38: note: in expansion of macro 'se'
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:59:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:59:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:59:61: note: in expansion of macro 'fi'
59 | }else if(a.n==time[a.y][a.x].se&&a.t<time[a.y][a.x].fi){
| ^~
a.cc:60:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[a.y][a.x].fi=a.t;
| ^
a.cc:60:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[a.y][a.x].fi=a.t;
| ^
a.cc:3:12: error: request for member 'first' in '*(time + (((sizetype)a.point::y) + ((sizetype)a.point::x)))', which is of non-class type 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}
3 | #define fi first
| ^~~~~
a.cc:60:28: note: in expansion of macro 'fi'
60 | time[a.y][a.x].fi=a.t;
| ^~
a.cc:73:1: warning: control reaches end of non-void function [-Wreturn-type]
73 | }
| ^
|
s614085446 | p00481 | C++ | #include <stdio.h>
int main() {
int i, j;
int h, w, n;
scanf("%d %d %d", &h, &w, &n);
for (i=0; i<h; i++) {
for (j=0; j<w; j++) {
int c;
scanf(" %c", &c);
if (c == 'S')
| a.cc: In function 'int main()':
a.cc:13:26: error: expected statement at end of input
13 | if (c == 'S')
| ^
a.cc:13:26: error: expected '}' at end of input
a.cc:9:29: note: to match this '{'
9 | for (j=0; j<w; j++) {
| ^
a.cc:13:26: error: expected '}' at end of input
13 | if (c == 'S')
| ^
a.cc:8:25: note: to match this '{'
8 | for (i=0; i<h; i++) {
| ^
a.cc:13:26: error: expected '}' at end of input
13 | if (c == 'S')
| ^
a.cc:3:12: note: to match this '{'
3 | int main() {
| ^
|
s307349206 | p00481 | C++ | #include <stdio.h>
int main() {
int i, j;
int h, w, n;
scanf("%d %d %d", &h, &w, &n);
for (i=0; i<h; i++) {
for (j=0; j<w; j++) {
int c;
scanf(" %c", &c);
if (c == 'S')
| a.cc: In function 'int main()':
a.cc:13:26: error: expected statement at end of input
13 | if (c == 'S')
| ^
a.cc:13:26: error: expected '}' at end of input
a.cc:9:29: note: to match this '{'
9 | for (j=0; j<w; j++) {
| ^
a.cc:13:26: error: expected '}' at end of input
13 | if (c == 'S')
| ^
a.cc:8:25: note: to match this '{'
8 | for (i=0; i<h; i++) {
| ^
a.cc:13:26: error: expected '}' at end of input
13 | if (c == 'S')
| ^
a.cc:3:12: note: to match this '{'
3 | int main() {
| ^
|
s917931066 | p00481 | C++ | #include<iostream>
#include<queue>
using namespace std;
int flg[1000][1000];
void ini(){
for(int i=0;i<1000;i++){
for(int j=0;j<1000;j++){
flg[i][j]=-1;
}
}
}
int main(){
int x,y,n;
int map[1001][1001];
int cnt=0;
pair<int,int> p;
ntoa[10]="123456789";
cin>>y>>x>>n;
for(int i=0i<y;i++){
for(int j=0;j<x;j++){
cin>>map[i][j];
if(map[i][j]=='S'){
p = make_pair(i,j);
}
}
}
for(int i=0;i<n;i++){
ini();
queue<pair<int,int>> q;
q.push(p);
flg[p.first][p.second]=0;
//幅優先
while(!q,empty()){
pair<int,int> temp=q.front();
q.pop();
int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};
for(int i2=0;i2<4;i2++){
if( temp.first+dy[i2]<y && temp.first+dy[i2]>-1 && temp.second+dx[i2]<x && temp.second+dx[i2]>-1){
if(map[temp.first+dy[i2]][temp.second+dx[i2]] != 'X' && flg[temp.first+dy[i2]][temp.second+dx[i2]] == -1){
q.push(make_pair(temp.first+dy[i2],temp.second+dx[i2]));
flg[temp.first+dy[i2]][temp.second+dx[i2]] = flg[temp.first][temp.second]+1;
}
}
if(map[temp.first][temp.second] == ntoa[i]){
cnt+=flg[temp.first][temp.second];
p=temp;
}
}
}
//
}
cout<<cnt;
return 0;
} | a.cc: In function 'int main()':
a.cc:19:9: error: 'ntoa' was not declared in this scope
19 | ntoa[10]="123456789";
| ^~~~
a.cc:22:21: error: invalid operands of types '__complex__ int' and 'int' to binary 'operator<'
22 | for(int i=0i<y;i++){
a.cc:22:27: error: expected ';' before ')' token
22 | for(int i=0i<y;i++){
| ^
| ;
a.cc:36:23: error: no match for 'operator!' (operand type is 'std::queue<std::pair<int, int> >')
36 | while(!q,empty()){
| ^~
a.cc:36:23: note: candidate: 'operator!(bool)' (built-in)
a.cc:36:23: note: no known conversion for argument 1 from 'std::queue<std::pair<int, int> >' to 'bool'
a.cc:36:31: error: no matching function for call to 'empty()'
36 | while(!q,empty()){
| ~~~~~^~
In file included from /usr/include/c++/14/string:53,
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/range_access.h:282:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.empty()) std::empty(const _Container&)'
282 | empty(const _Container& __cont) noexcept(noexcept(__cont.empty()))
| ^~~~~
/usr/include/c++/14/bits/range_access.h:282:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:292:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr bool std::empty(const _Tp (&)[_Nm])'
292 | empty(const _Tp (&)[_Nm]) noexcept
| ^~~~~
/usr/include/c++/14/bits/range_access.h:292:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:302:5: note: candidate: 'template<class _Tp> constexpr bool std::empty(initializer_list<_Tp>)'
302 | empty(initializer_list<_Tp> __il) noexcept
| ^~~~~
/usr/include/c++/14/bits/range_access.h:302:5: note: candidate expects 1 argument, 0 provided
|
s737716778 | p00481 | C++ | #include<iostream>
#include<map>
#include<queue>
using namespace std;
typedef pair<int,int> P;
queue<P> q;
int sx,sy;
int gx,gy;
int g;
char field[1000][1000];
int d[1000][1000];
int H,W,N;
int hp=1;
int ans=0;
int bfs(){
memset(d,-1,sizeof(d));
P p;
q.push(P(sx,sy));
d[sx][sy]=0;
while(q.size()){
if(q.front().first==gx&&q.front().second==gy) break;
p=q.front();
q.pop();
for(int i=-1;i<=1;i++){
for(int j=-1;j<=1;j++){
if((i==0||j==0)&&(i!=0||j!=0)){
if(p.first+i>=0&&p.first+i<=H-1&&p.second+j>=0&&p.second+j<=W-1&&d[p.first+i][p.second+j]<0){
if(field[p.first+i][p.second+j]!='X'){
q.push(P(p.first+i,p.second+j));
d[p.first+i][p.second+j]=d[p.first][p.second]+1;
}
}
}
}
}
}
return d[gx][gy];
}
int main(){
cin>>H>>W>>N;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>field[i][j];
}
}
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(field[i][j]=='S')
{
sx=i;
sy=j;
}
if(field[i][j]==49)
{
gx=i;
gy=j;
}
}
}
ans+=bfs();
for(int i=0;i<N-1;i++){
for(int j=0;j<H;j++){
for(int k=0;k<W;k++){
if(field[j][k]==49+i)
{
sx=j;
sy=k;
}
if(field[j][k]==50+i)
{
gx=j;
gy=k;
}
}
}
while(q.size()){
q.pop();
}
memset(d,-1,sizeof(d));
ans+=bfs();
}
cout<<ans<<endl;
} | a.cc: In function 'int bfs()':
a.cc:19:9: error: 'memset' was not declared in this scope
19 | memset(d,-1,sizeof(d));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<queue>
+++ |+#include <cstring>
4 |
a.cc: In function 'int main()':
a.cc:83:17: error: 'memset' was not declared in this scope
83 | memset(d,-1,sizeof(d));
| ^~~~~~
a.cc:83:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s751741965 | p00481 | C++ | #include<iostream>
#include<queue>
using namespace std;
struct ma
{
int x;
int y;
};
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
int main()
{
int ans = 0;
int tate, yoko;
int n;
cin >> tate >> yoko >> n;
char m[1100][1100];
ma sta;
for (int i = 0; i < tate; i++)
{
for (int k = 0; k < yoko; k++)
{
cin >> m[i][k];
if (m[i][k] == 'S')
{
sta.x = k;
sta.y = i;
}
}
}
int HP = 1;
queue<ma> hoge;
for (int i = 0; i < n; i++)
{
hoge.push(sta);
int map[1100][1100];
memset(map, -1, sizeof(map));
map[sta.y][sta.x] = 0;
while (!hoge.empty())
{
ma now;
now = hoge.front();
hoge.pop();
for (int k = 0; k < 4; k++)
{
if (now.y + dy[k] < 0 || now.x + dx[k] < 0)continue;
if (m[now.y + dy[k]][now.x + dx[k]] != 'X')
{
if (map[now.y + dy[k]][now.x + dx[k]] != -1)
{
continue;
}
map[now.y + dy[k]][now.x + dx[k]] = map[now.y][now.x] + 1;
if (m[now.y + dy[k]][now.x + dx[k]] - '0' == HP)
{
m[now.y + dy[k]][now.x + dx[k]] = '.';
ans += map[now.y + dy[k]][now.x + dx[k]];
while (!hoge.empty())hoge.pop();
HP++;
sta.x = now.x + dx[k];
sta.y = now.y + dy[k];
break;
}
else
{
ma hage;
hage.x = now.x + dx[k];
hage.y = now.y + dy[k];
hoge.push(hage);
}
}
}
/* for (int i = 0; i < tate; i++)
{
for (int k = 0; k < yoko; k++)
{
cout << map[i][k] << " ";
}
cout << endl;
}
cout << endl;*/
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:36:17: error: 'memset' was not declared in this scope
36 | memset(map, -1, sizeof(map));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<queue>
+++ |+#include <cstring>
3 | using namespace std;
|
s649089365 | p00481 | C++ | #include<bits/stdc++.h>
using namespace std;
struct ma
{
int x;
int y;
};
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
char m[2200][2200];
int map[2200][2200];
int main()
{
int ans = 0;
int tate, yoko;
int n;
cin >> tate >> yoko >> n;
ma sta;
for (int i = 0; i < tate; i++)
{
for (int k = 0; k < yoko; k++)
{
cin >> m[i][k];
if (m[i][k] == 'S')
{
sta.x = k;
sta.y = i;
}
}
}
int HP = 1;
queue<ma> hoge;
for (int i = 0; i < n; i++)
{
hoge.push(sta);
memset(map, -1, sizeof(map));
map[sta.y][sta.x] = 0;
while (!hoge.empty())
{
ma now;
now = hoge.front();
hoge.pop();
for (int k = 0; k < 4; k++)
{
if (now.y + dy[k] >= tate || now.x + dx[k] >= yoko)continue;
if (now.y + dy[k] < 0 || now.x + dx[k] < 0)continue;
if (m[now.y + dy[k]][now.x + dx[k]] != 'X')
{
if (map[now.y + dy[k]][now.x + dx[k]] != -1)
{
continue;
}
map[now.y + dy[k]][now.x + dx[k]] = map[now.y][now.x] + 1;
if (m[now.y + dy[k]][now.x + dx[k]] - '0' == HP)
{
m[now.y + dy[k]][now.x + dx[k]] = '.';
ans += map[now.y + dy[k]][now.x + dx[k]];
while (!hoge.empty())hoge.pop();
HP++;
sta.x = now.x + dx[k];
sta.y = now.y + dy[k];
break;
}
else
{
ma hage;
hage.x = now.x + dx[k];
hage.y = now.y + dy[k];
hoge.push(hage);
}
}
}
/* for (int i = 0; i < tate; i++)
{
for (int k = 0; k < yoko; k++)
{
cout << map[i][k] << " ";
}
cout << endl;
}
cout << endl;*/
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:37:24: error: reference to 'map' is ambiguous
37 | memset(map, -1, sizeof(map));
| ^~~
In file included from /usr/include/c++/14/map:63,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [2200][2200]'
10 | int map[2200][2200];
| ^~~
a.cc:37:40: error: reference to 'map' is ambiguous
37 | memset(map, -1, sizeof(map));
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [2200][2200]'
10 | int map[2200][2200];
| ^~~
a.cc:38:17: error: reference to 'map' is ambiguous
38 | map[sta.y][sta.x] = 0;
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [2200][2200]'
10 | int map[2200][2200];
| ^~~
a.cc:50:45: error: reference to 'map' is ambiguous
50 | if (map[now.y + dy[k]][now.x + dx[k]] != -1)
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [2200][2200]'
10 | int map[2200][2200];
| ^~~
a.cc:54:41: error: reference to 'map' is ambiguous
54 | map[now.y + dy[k]][now.x + dx[k]] = map[now.y][now.x] + 1;
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [2200][2200]'
10 | int map[2200][2200];
| ^~~
a.cc:54:77: error: reference to 'map' is ambiguous
54 | map[now.y + dy[k]][now.x + dx[k]] = map[now.y][now.x] + 1;
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [2200][2200]'
10 | int map[2200][2200];
| ^~~
a.cc:58:56: error: reference to 'map' is ambiguous
58 | ans += map[now.y + dy[k]][now.x + dx[k]];
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [2200][2200]'
10 | int map[2200][2200];
| ^~~
|
s564574146 | p00481 | C++ | #include<bits/stdc++.h>
using namespace std;
struct ma
{
int x;
int y;
};
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
char m[1200][1200];
int map[1200][1200];
int main()
{
int ans = 0;
int tate, yoko;
int n;
cin >> tate >> yoko >> n;
ma sta;
for (int i = 0; i < tate; i++)
{
for (int k = 0; k < yoko; k++)
{
cin >> m[i][k];
if (m[i][k] == 'S')
{
sta.x = k;
sta.y = i;
}
}
}
int HP = 1;
queue<ma> hoge;
for (int i = 0; i < n; i++)
{
hoge.push(sta);
memset(map, -1, sizeof(map));
map[sta.y][sta.x] = 0;
while (!hoge.empty())
{
ma now;
now = hoge.front();
hoge.pop();
for (int k = 0; k < 4; k++)
{
if (now.y + dy[k] >= tate || now.x + dx[k] >= yoko)continue;
if (now.y + dy[k] < 0 || now.x + dx[k] < 0)continue;
if (m[now.y + dy[k]][now.x + dx[k]] != 'X')
{
if (map[now.y + dy[k]][now.x + dx[k]] != -1)
{
continue;
}
map[now.y + dy[k]][now.x + dx[k]] = map[now.y][now.x] + 1;
if (m[now.y + dy[k]][now.x + dx[k]] - '0' == HP)
{
m[now.y + dy[k]][now.x + dx[k]] = '.';
ans += map[now.y + dy[k]][now.x + dx[k]];
while (!hoge.empty())hoge.pop();
HP++;
sta.x = now.x + dx[k];
sta.y = now.y + dy[k];
break;
}
else
{
ma hage;
hage.x = now.x + dx[k];
hage.y = now.y + dy[k];
hoge.push(hage);
}
}
}
/* for (int i = 0; i < tate; i++)
{
for (int k = 0; k < yoko; k++)
{
cout << map[i][k] << " ";
}
cout << endl;
}
cout << endl;*/
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:37:24: error: reference to 'map' is ambiguous
37 | memset(map, -1, sizeof(map));
| ^~~
In file included from /usr/include/c++/14/map:63,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [1200][1200]'
10 | int map[1200][1200];
| ^~~
a.cc:37:40: error: reference to 'map' is ambiguous
37 | memset(map, -1, sizeof(map));
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [1200][1200]'
10 | int map[1200][1200];
| ^~~
a.cc:38:17: error: reference to 'map' is ambiguous
38 | map[sta.y][sta.x] = 0;
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [1200][1200]'
10 | int map[1200][1200];
| ^~~
a.cc:50:45: error: reference to 'map' is ambiguous
50 | if (map[now.y + dy[k]][now.x + dx[k]] != -1)
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [1200][1200]'
10 | int map[1200][1200];
| ^~~
a.cc:54:41: error: reference to 'map' is ambiguous
54 | map[now.y + dy[k]][now.x + dx[k]] = map[now.y][now.x] + 1;
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [1200][1200]'
10 | int map[1200][1200];
| ^~~
a.cc:54:77: error: reference to 'map' is ambiguous
54 | map[now.y + dy[k]][now.x + dx[k]] = map[now.y][now.x] + 1;
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [1200][1200]'
10 | int map[1200][1200];
| ^~~
a.cc:58:56: error: reference to 'map' is ambiguous
58 | ans += map[now.y + dy[k]][now.x + dx[k]];
| ^~~
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:10:5: note: 'int map [1200][1200]'
10 | int map[1200][1200];
| ^~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.