submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s906613001 | p00438 | C++ | #include <cstdio>
#include <cstring>
using namespace std;
typedef __int64 Int;
#define MAX_L 16
Int table[MAX_L + 1][MAX_L + 1];
bool wall[MAX_L + 1][MAX_L + 1];
int a, b, n;
Int dp(int x, int y){
if(x == a && y == b) return 1;
if(x > a || y > b) return 0;
if(table[x][y] >= 0) return table[x][y];
if(wall[x][y]) return 0;
return table[x][y] = dp(x + 1, y) + dp(x, y + 1);
}
int main(){
scanf("%d%d", &a, &b);
scanf("%d", &n);
int in_x, in_y;
for(int i = 0; i < n; i++){
scanf("%d%d", &in_x, &in_y);
wall[in_x][in_y] = true;
}
memset(table, -1, sizeof(table));
printf("%I64d\n", dp(1, 1));
return 0;
} | a.cc:5:9: error: '__int64' does not name a type; did you mean '__int64_t'?
5 | typedef __int64 Int;
| ^~~~~~~
| __int64_t
a.cc:7:1: error: 'Int' does not name a type; did you mean 'int'?
7 | Int table[MAX_L + 1][MAX_L + 1];
| ^~~
| int
a.cc:11:1: error: 'Int' does not name a type; did you mean 'int'?
11 | Int dp(int x, int y){
| ^~~
| int
a.cc: In function 'int main()':
a.cc:30:16: error: 'table' was not declared in this scope; did you mean 'mutable'?
30 | memset(table, -1, sizeof(table));
| ^~~~~
| mutable
a.cc:32:27: error: 'dp' was not declared in this scope
32 | printf("%I64d\n", dp(1, 1));
| ^~
|
s171791505 | p00438 | C++ | #include<bits/sdtc++.h>
using namespace std;
typedef pair<int,int> pii;
int main(){
int r,c;
int n;
while(1){
cin>>r>>c;
if(r==0)break;
cin>>n;
int dp[c][r];
memset(dp,-1,sizeof(dp));
for(int i=0;i<n;i++){
int a,b;
cin>>a>>b;
dp[b-1][a-1]=0;
}
for(int i=c-1;i>=0;i--){
for(int j=r-1;j>=0;j--){
if(dp[i][j]==0)continue;
if(i==c-1 || j==r-1){
dp[i][j]=1;
}else{
dp[i][j]=dp[i+1][j]+dp[i][j+1];
}
}
}
cout<<dp[0][0]<<endl;
}
return 0;
} | a.cc:1:9: fatal error: bits/sdtc++.h: No such file or directory
1 | #include<bits/sdtc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s182040490 | p00438 | C++ | #include<bis/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
int main(){
int r,c;
int n;
while(1){
cin>>r>>c;
if(r==0)break;
cin>>n;
int dp[c][r];
memset(dp,-1,sizeof(dp));
for(int i=0;i<n;i++){
int a,b;
cin>>a>>b;
dp[b-1][a-1]=0;
}
for(int i=c-1;i>=0;i--){
for(int j=r-1;j>=0;j--){
if(dp[i][j]==0)continue;
if(i==c-1 || j==r-1){
dp[i][j]=1;
}else{
dp[i][j]=dp[i+1][j]+dp[i][j+1];
}
}
}
cout<<dp[0][0]<<endl;
}
return 0;
} | a.cc:1:9: fatal error: bis/stdc++.h: No such file or directory
1 | #include<bis/stdc++.h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s048578754 | p00438 | C++ |
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int DX[] = {0, 1, 0, -1};
const int DY[] = {-1, 0, 1, 0};
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int main(int argc, char const *argv[])
{
cin.tie(0);
ios::sync_with_stdio(false);
int width, height, n;
while(true){
cin >> width >> height;
if(width == 0 && height == 0){
break;
}
cin >> n;
vector<PII> bad(n);
VVI table(height, VI(width));
REP(i, n){
int x, y;
cin >> x >> y;
x--;
y = height - y;
table[y][x] = -1;
}
table[height - 1][0] = 1;
int value;
for(int y = height -1; y >= 0; --y){
REP(x, width){
if(table[y][x] == -1) continue;
if(x > 0){
value = table[y][x -1];
table[y][x] += value > -1 ? value : 0;
}
if(y < height - 1){
value = table[y + 1][x];
table[y][x] += value > -1 ? value : 0;
}
}
}
cout << table[0][width -1] << endl;
}
}
return 0;
} | a.cc:118:9: error: expected unqualified-id before 'return'
118 | return 0;
| ^~~~~~
a.cc:119:1: error: expected declaration before '}' token
119 | }
| ^
|
s961019268 | p00438 | C++ | #include <iostream>
using namespace std;
int mass[17][17];
int memo[17][17];
int solve( int x ,int y ,int maxx ,int maxy);
int main(){
int n ,x ,y;
int cx ,cy;
while( true ){
memset( mass ,0 ,sizeof( mass ) );
memset( memo ,0 ,sizeof( memo ) );
cin >> x >> y;
if( x == 0 && y == 0 ) break;
mass[y-1][x-1] = 2; // goal地点の指定
cin >> n;
for( int i=0 ; i<n ; i++ ){ // 行けない地点の指定
cin >> cx >> cy;
mass[cy-1][cx-1] = 1;
}
cout << solve( 0 ,0 ,x-1 ,y-1 ) << endl; // go 再帰
}
}
int solve( int x ,int y ,int maxx ,int maxy ){
if( memo[y][x] != 0 ) return memo[y][x];
else if( mass[y][x] == 2 ) return 1; // goal
else if( x > maxx || y > maxy ) return 0; // どっか行った
else if( mass[y][x] == 1 ) return 0; // いけねぇ
else return memo[y][x] = (solve( x+1 ,y ,maxx ,maxy ) + solve( x ,y+1 ,maxx ,maxy ) );
} | a.cc: In function 'int main()':
a.cc:11:5: error: 'memset' was not declared in this scope
11 | memset( mass ,0 ,sizeof( mass ) );
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s910257166 | p00438 | C++ | #include <stdio.h>
int dp[16];
bool u[16][16];
int main()
{
int a,b;
scanf("%d%d",&a,&b);
for(int i = 0; i < b; i++)
{
for(int ii = 0; ii < a; ii++)
{
u[i] = true;
}
}
int n;
scanf("%d",&n);
for(int i = 0; i < n; i++)
{
int x,y;
scanf("%d%d",&x,&y);
u[y - 1][x - 1] = false;
}
for(int i = 0; i < a; i++)
{
dp[i] = 0;
}
for(int i = 0; i < b; i++)
{
int now = 0;
for(int ii = 0; ii < a; ii++)
{
if(u[i][ii])
{
now += dp[ii];
dp[ii] = now;
}
else
{
dp[ii] = 0;
}
}
}
printf("%d\n",dp[a - 1]);
return 0;
} | a.cc: In function 'int main()':
a.cc:14:9: error: incompatible types in assignment of 'bool' to 'bool [16]'
14 | u[i] = true;
| ~~~~~^~~~~~
|
s265839967 | p00438 | C++ | #include<stdio.h>
int main(void){
int road[20][20]={{0}},i,j,t,a,b,tree,tx,ty,ans;
for(;;){
road[1][1]=1;
scanf("%d %d",&a,&b);
if(a==0&&b==0)break;
scanf("%d",&tree);
for(t=0;t<tree;t++){
scanf("%d %d",&tx,&ty);
road[tx][ty]=-1;
}
for(i=1;i<=a;i++){
for(j=1;j<=b;j++){
if(road[i][j]==0){
if(i==1){
road[i][j]=road[i][j-1];
}
else if(j==1){
road[i][j]=road[i-1][j];
}
else{
if(road[i][j-1]==-1){
road[i][j]=road[i-1][j];
}
else if(road[i-1][j]==-1){
road[i][j]=road[i][j-1];
}
else road[i][j]=road[i-1][j]+road[i][j-1];
}
}
}
}
printf("%d\n",road[a][b]);
} | a.cc: In function 'int main()':
a.cc:35:2: error: expected '}' at end of input
35 | }
| ^
a.cc:2:15: note: to match this '{'
2 | int main(void){
| ^
|
s489589491 | p00438 | C++ | #include<cstdio>
#include<math.h>
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int INF=1001001001;
int A,B;
int N;
long long int DP[20][20];
int main(){
while(1){
memset(DP,0,sizeof(DP));
scanf("%d %d",&A,&B);
if(A==0&&B==0)break;
scanf("%d",&N);
rep(i,N){
int a,b;
scanf("%d %d",&a,&b);
DP[a-1][b-1]=-1;
}
rep(i,A){
rep(j,B){
if(DP[i][j]==-1)continue;
if(i==0){DP[i][j]=1;continue;}
else if(DP[i-1][j]!=-1)DP[i][j]+=DP[i-1][j];
if(j==0){DP[i][j]=1;continue;}
else if(DP[i][j-1]!=-1)DP[i][j]+=DP[i][j-1];
}
}
printf("%lld",DP[A-1][B-1]);
}
} | a.cc: In function 'int main()':
a.cc:15:9: error: 'memset' was not declared in this scope
15 | memset(DP,0,sizeof(DP));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<algorithm>
+++ |+#include <cstring>
4 |
|
s884727351 | p00438 | C++ | #include<math.h>
#include<algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int INF=1001001001;
int A,B;
int N;
long long int DP[20][20];
int main(){
while(1){
memset(DP,0,sizeof(DP));
scanf("%d %d",&A,&B);
if(A==0&&B==0)break;
scanf("%d",&N);
rep(i,N){
int a,b;
scanf("%d %d",&a,&b);
DP[a-1][b-1]=-1;
}
rep(i,A){
rep(j,B){
if(DP[i][j]==-1)continue;
if(i==0&&j==0){DP[0][0]=1;continue;}
if(i==0){if(DP[i][j-1]>0)DP[i][j]=1;continue;}
else if(DP[i-1][j]!=-1)DP[i][j]+=DP[i-1][j];
if(j==0){if(DP[i-1][j]>0)DP[i][j]=1;continue;}
else if(DP[i][j-1]!=-1)DP[i][j]+=DP[i][j-1];
}
}
printf("%lld",DP[A-1][B-1]);
}
} | a.cc: In function 'int main()':
a.cc:15:9: 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<algorithm>
+++ |+#include <cstring>
3 |
a.cc:16:9: error: 'scanf' was not declared in this scope
16 | scanf("%d %d",&A,&B);
| ^~~~~
a.cc:35:9: error: 'printf' was not declared in this scope
35 | printf("%lld",DP[A-1][B-1]);
| ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
2 | #include<algorithm>
+++ |+#include <cstdio>
3 |
|
s290309156 | p00438 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int W, H;
while(cin >> W >> H, W||H){
int n, dp[17][17] = {0};
bool xx[17][17];
memset(xx, false, sizeof(xx));
cin >> n;
for(int i = 0; i < n; i++){
int x, y; cin >> x >> y;
xx[--y][--x] = true;
}
for(int i = 0; i < W; i++)
dp[0][i] = 1;
for(int i = 0; i < H; i++)
dp[i][0] = 1;
for(int i = 1; i < H; i++){
for(int j = 1; j < W; j++){
if(!xx[i][j])
dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
}
}
cout << dp[H - 1][W - 1] << endl;
}
} | a.cc: In function 'int main()':
a.cc:12:9: error: 'memset' was not declared in this scope
12 | memset(xx, false, sizeof(xx));
| ^~~~~~
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;
|
s366206591 | p00438 | C++ | #include <iostream>
#include <stack>
#include <algorithm>
using namespace std;
typedef pair<int,int>pa;
int ma[42][42];
int main(){
while(true){
int a,b,x,y;
int n;
cin>>a>>b;
if(a==0)break;
cin>>n;
memset(ma,0,sizeof(ma));
while(n--){
cin>>x>>y;x--;
ma[b-y][x]=-1;
}
ma[b-1][0]=1;
stack<pa>stk;
stk.push(pa(0, b-1));
while(stk.size()){
pa p=stk.top();
stk.pop();
x=p.first,y=p.second;
if(x+1<a&&ma[y][x+1]!=-1){
ma[y][x+1]+=1;
stk.push(pa(x+1,y));
}
if(y-1>-1&&ma[y-1][x]!=-1){
ma[y-1][x]+=1;
stk.push(pa(x,y-1));
}
}
cout<<ma[0][a-1]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:9: error: 'memset' was not declared in this scope
14 | memset(ma,0,sizeof(ma));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <algorithm>
+++ |+#include <cstring>
4 | using namespace std;
|
s372014378 | p00438 | C++ | #include <iostream>
#include <vector>
class Road{
private:
int col,row,close_num, goal_num;
std::vector<int> close_x;
std::vector<int> close_y;
public:
Road(int a, int b, int n);
~Road() = default;
void inPoint();
void go_road(int now_x,int now_y);
int isGo(int x, int y);
void showGoal();
};
int main(){
int a,b;
while(std::cin >> a >> b){
if(a == 0 && b == 0) break;
int n;
std::cin >> n;
Road road(a,b,n);
road.inPoint();
road.go_road(1,1);
road.showGoal();
}
return 0;
}
Road(int a, int b, int n){
col = a; //column
row = b; //row
close_num = n; //close count
close_x.resize(n);
close_y.resize(n);
goal_num = 0; //goal count
}
void inPoint(){
for(int i=0; i<close_num; ++i){
std::cin >> close_x[i] >> close_y[i];
}
}
void go_road(int now_x,int now_y){
if(now_x == col && now_y == row){
++goal_num;
return;
}
if(now_x+1 <= col)
if(isGo(now_x+1, now_y)) go_road(now_x+1, now_y);
if(now_y+1 <= row)
if(isGo(now_x, now_y+1)) go_road(now_x, now_y+1);
}
int isGo(int x, int y){
for(int i=0; i<close_num; ++i){
if(x == close_x[i] && y == close_y[i]) return 0;
}
return 1;
}
void showGoal(){ std::cout << goal_num << std::endl; } | a.cc:37:1: error: ISO C++ forbids declaration of 'Road' with no type [-fpermissive]
37 | Road(int a, int b, int n){
| ^~~~
a.cc: In function 'int Road(int, int, int)':
a.cc:38:9: error: 'col' was not declared in this scope
38 | col = a; //column
| ^~~
a.cc:39:9: error: 'row' was not declared in this scope
39 | row = b; //row
| ^~~
a.cc:40:9: error: 'close_num' was not declared in this scope
40 | close_num = n; //close count
| ^~~~~~~~~
a.cc:41:9: error: 'close_x' was not declared in this scope
41 | close_x.resize(n);
| ^~~~~~~
a.cc:42:9: error: 'close_y' was not declared in this scope
42 | close_y.resize(n);
| ^~~~~~~
a.cc:43:9: error: 'goal_num' was not declared in this scope
43 | goal_num = 0; //goal count
| ^~~~~~~~
a.cc:44:1: warning: no return statement in function returning non-void [-Wreturn-type]
44 | }
| ^
a.cc: In function 'void inPoint()':
a.cc:47:24: error: 'close_num' was not declared in this scope
47 | for(int i=0; i<close_num; ++i){
| ^~~~~~~~~
a.cc:48:29: error: 'close_x' was not declared in this scope
48 | std::cin >> close_x[i] >> close_y[i];
| ^~~~~~~
a.cc:48:43: error: 'close_y' was not declared in this scope
48 | std::cin >> close_x[i] >> close_y[i];
| ^~~~~~~
a.cc: In function 'void go_road(int, int)':
a.cc:53:21: error: 'col' was not declared in this scope
53 | if(now_x == col && now_y == row){
| ^~~
a.cc:53:37: error: 'row' was not declared in this scope
53 | if(now_x == col && now_y == row){
| ^~~
a.cc:54:19: error: 'goal_num' was not declared in this scope
54 | ++goal_num;
| ^~~~~~~~
a.cc:58:23: error: 'col' was not declared in this scope
58 | if(now_x+1 <= col)
| ^~~
a.cc:59:20: error: 'isGo' was not declared in this scope
59 | if(isGo(now_x+1, now_y)) go_road(now_x+1, now_y);
| ^~~~
a.cc:61:23: error: 'row' was not declared in this scope
61 | if(now_y+1 <= row)
| ^~~
a.cc:62:20: error: 'isGo' was not declared in this scope
62 | if(isGo(now_x, now_y+1)) go_road(now_x, now_y+1);
| ^~~~
a.cc: In function 'int isGo(int, int)':
a.cc:66:24: error: 'close_num' was not declared in this scope
66 | for(int i=0; i<close_num; ++i){
| ^~~~~~~~~
a.cc:67:25: error: 'close_x' was not declared in this scope
67 | if(x == close_x[i] && y == close_y[i]) return 0;
| ^~~~~~~
a.cc:67:44: error: 'close_y' was not declared in this scope
67 | if(x == close_x[i] && y == close_y[i]) return 0;
| ^~~~~~~
a.cc: In function 'void showGoal()':
a.cc:72:31: error: 'goal_num' was not declared in this scope
72 | void showGoal(){ std::cout << goal_num << std::endl; }
| ^~~~~~~~
|
s618165773 | p00438 | C++ | #include <iostream>
#include <arrary>
#include <iterator>
int main(){
std::array<int, 256> crossing; //16*16
int length,width;
while(std::cin >> width >> length){
if(width == 0 && length == 0){
break;
}
int construction;
std::cin >> construction;
for(int i = 0; i < construction; ++i){
int con_length,con_width;
std::cin >> con_width >> con_length;
crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width) break;
}
}
return 0;
} | a.cc:2:10: fatal error: arrary: No such file or directory
2 | #include <arrary>
| ^~~~~~~~
compilation terminated.
|
s290296603 | p00438 | C++ | #include <iostream>
#include <arrary>
#include <iterator>
int main(){
std::array<int, 256> crossing; //16*16
int length,width;
while(std::cin >> width >> length){
if(width == 0 && length == 0){
break;
}
int construction;
std::cin >> construction;
for(int i = 0; i < construction; ++i){
int con_length,con_width;
std::cin >> con_width >> con_length;
crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width) break;
}
}
return 0;
} | a.cc:2:10: fatal error: arrary: No such file or directory
2 | #include <arrary>
| ^~~~~~~~
compilation terminated.
|
s098770692 | p00438 | C++ | #include <iostream>
#include <arrary>
#include <iterator>
int main(){
std::array<int, 256> crossing; //16*16
int length,width;
while(std::cin >> width >> length){
if(width == 0 && length == 0) break;
int construction;
std::cin >> construction;
for(int i = 0; i < construction; ++i){
int con_length,con_width;
std::cin >> con_width >> con_length;
crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width) break;
}
}
return 0;
} | a.cc:2:10: fatal error: arrary: No such file or directory
2 | #include <arrary>
| ^~~~~~~~
compilation terminated.
|
s188008848 | p00438 | C++ | #include <iostream>
#include <arrary>
#include <iterator>
int main(){
int length,width;
while(std::cin >> width >> length){
std::array<int, 256> crossing; //16*16
if(width == 0 && length == 0) break;
int construction;
std::cin >> construction;
for(int i = 0; i < construction; ++i){
int con_length,con_width;
std::cin >> con_width >> con_length;
crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width){
std::cout << *itr << endl;
break;
}
}
}
return 0;
} | a.cc:2:10: fatal error: arrary: No such file or directory
2 | #include <arrary>
| ^~~~~~~~
compilation terminated.
|
s854423138 | p00438 | C++ | #include <iostream>
#include <arrary>
#include <iterator>
int main(){
int length,width;
while(std::cin >> width >> length){
std::array<int, 256> crossing; //16*16
if(width == 0 && length == 0) break;
int construction;
std::cin >> construction;
for(int i = 0; i < construction; ++i){
int con_length,con_width;
std::cin >> con_width >> con_length;
crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width){
std::cout << *itr << endl;
break;
}
}
}
return 0;
} | a.cc:2:10: fatal error: arrary: No such file or directory
2 | #include <arrary>
| ^~~~~~~~
compilation terminated.
|
s338390784 | p00438 | C++ | #include <iostream>
#include <arrary>
#include <iterator>
int main(){
int length,width;
while(std::cin >> width >> length){
std::array<int, 256> crossing; //16*16
if(width == 0 && length == 0) break;
int construction;
std::cin >> construction;
int con_length, con_width;
for(int i = 0; i < construction; ++i){
//int con_length, con_width;
std::cin >> con_width >> con_length;
crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width){
std::cout << *itr << endl;
break;
}
}
}
return 0;
} | a.cc:2:10: fatal error: arrary: No such file or directory
2 | #include <arrary>
| ^~~~~~~~
compilation terminated.
|
s040296621 | p00438 | C++ | #include <iostream>
#include <arrary>
#include <iterator>
int main(){
int length,width;
while(std::cin >> width >> length){
std::array<int, 256> crossing; //16*16
if(width == 0 && length == 0) break;
int construction;
std::cin >> construction;
for(int i = 0; i < construction; ++i){
int con_length, con_width;
//std::cin >> con_width >> con_length;
crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width){
std::cout << *itr << endl;
break;
}
}
}
return 0;
} | a.cc:2:10: fatal error: arrary: No such file or directory
2 | #include <arrary>
| ^~~~~~~~
compilation terminated.
|
s427307996 | p00438 | C++ | #include <iostream>
#include <arrary>
#include <iterator>
int main(){
int length,width;
while(std::cin >> width >> length){
std::array<int, 256> crossing; //16*16
if(width == 0 && length == 0) break;
int construction;
std::cin >> construction;
for(int i = 0; i < construction; ++i){
int con_length, con_width;
//std::cin >> con_width >> con_length;
//crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width){
std::cout << *itr << endl;
break;
}
}
}
return 0;
} | a.cc:2:10: fatal error: arrary: No such file or directory
2 | #include <arrary>
| ^~~~~~~~
compilation terminated.
|
s685208062 | p00438 | C++ | #include <iostream>
#include <arrary>
#include <iterator>
int main(){
int length,width;
while(std::cin >> width >> length){
std::array<int, 256> crossing; //16*16
if(width == 0 && length == 0) break;
int construction;
std::cin >> construction;
for(int i = 0; i < construction; ++i){
int con_length, con_width;
//std::cin >> con_width >> con_length;
//crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width){
std::cout << *itr << endl;
break;
}
}
}
return 0;
} | a.cc:2:10: fatal error: arrary: No such file or directory
2 | #include <arrary>
| ^~~~~~~~
compilation terminated.
|
s423518878 | p00438 | C++ | #include <iostream>
#include <array>
#include <iterator>
int main(){
int length,width;
while(std::cin >> width >> length){
std::array<int, 256> crossing; //16*16
if(width == 0 && length == 0) break;
int construction;
std::cin >> construction;
for(int i = 0; i < construction; ++i){
int con_length, con_width;
std::cin >> con_width >> con_length;
crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width){
std::cout << *itr << endl;
break;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:53: error: expected ';' before '!=' token
25 | for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
| ^~~
| ;
a.cc:25:54: error: expected primary-expression before '!=' token
25 | for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
| ^~
a.cc:25:78: error: expected ';' before ')' token
25 | for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
| ^
| ;
a.cc:56:54: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
56 | std::cout << *itr << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s448360858 | p00438 | C++ | #include <iostream>
#include <array>
#include <iterator>
int main(){
int length,width;
while(std::cin >> width >> length){
std::array<int, 256> crossing; //16*16
if(width == 0 && length == 0) break;
int construction;
std::cin >> construction;
for(int i = 0; i < construction; ++i){
int con_length, con_width;
std::cin >> con_width >> con_length;
crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width){
std::cout << *itr << endl;
break;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:53: error: expected ';' before '!=' token
25 | for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
| ^~~
| ;
a.cc:25:54: error: expected primary-expression before '!=' token
25 | for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
| ^~
a.cc:25:78: error: expected ';' before ')' token
25 | for(auto itr = crossing.begin(), itr != crossing.end(), ++itr){
| ^
| ;
a.cc:56:54: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
56 | std::cout << *itr << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s292502524 | p00438 | C++ | #include <iostream>
#include <array>
#include <iterator>
int main(){
int length,width;
while(std::cin >> width >> length){
std::array<int, 256> crossing; //16*16
if(width == 0 && length == 0) break;
int construction;
std::cin >> construction;
for(int i = 0; i < construction; ++i){
int con_length, con_width;
std::cin >> con_width >> con_length;
crossing[con_width + (width * (con_length - 1)) - 1] = -1; //construction = -1
}
crossing.front() = 1; //start
int cros_num = 0;
for(auto itr = crossing.begin(); itr != crossing.end(); ++itr){
if(*itr != -1){ //not crossing
//considering left crossing
if(cros_num % width != 0){ //no left
itr -= 1;
if(*itr != -1){ //left not construction
int buf = *itr;
itr += 1;
*itr += buf; //plus left
}else{
itr += 1;
}
}
//considering down crossing
if(cros_num > width){ //no down
itr -= width;
if(*itr != -1){ //down not construction
int buf = *itr;
itr += width;
*itr += buf; //plus down
}else{
itr += width;
}
}
}
++cros_num;
if(cros_num == length * width){
std::cout << *itr << endl;
break;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:56:54: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
56 | std::cout << *itr << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s643871845 | p00438 | C++ | #include <iostream>
#include <vector>
int main(){
u_int a; // width
u_int b; // height
while(std::cin >> a >> b){
if(a == 0 && b == 0){
break;
}
// initialization
std::vector<std::vector<u_int>> path(a+1, std::vector<int>(b+1, 1));
//for(u_int i = 0; i < a+1; ++i){
// path[i].resize(b+1, 1);
//}
// construction
u_int n;
std::cin >> n;
for(u_int i = 0; i < n; ++i){
u_int x, y;
std::cin >> x >> y;
path[x][y] = 0;
}
// out path
for(u_int i = 0; i < a+1; ++i) path[i][0] = 0;
for(u_int i = 0; i < b+1; ++i) path[0][i] = 0;
for(u_int x = 1; x <= a; ++x){
for(u_int y = 1; y <= b; ++y){
if(path[x][y] != 0 && !(x == 1 && y == 1)){
path[x][y] = path[x-1][y] + path[x][y-1];
}
}
}
std::cout << path[a][b] << std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:75: error: no matching function for call to 'std::vector<std::vector<unsigned int> >::vector(u_int, std::vector<int>)'
13 | std::vector<std::vector<u_int>> path(a+1, std::vector<int>(b+1, 1));
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed:
a.cc:13:75: note: deduced conflicting types for parameter '_InputIterator' ('unsigned int' and 'std::vector<int>')
13 | std::vector<std::vector<u_int>> path(a+1, std::vector<int>(b+1, 1));
| ^
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >; allocator_type = std::allocator<std::vector<unsigned int> >]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'u_int' {aka 'unsigned int'} to 'std::initializer_list<std::vector<unsigned int> >'
678 | vector(initializer_list<value_type> __l,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<unsigned int> >]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'u_int' {aka 'unsigned int'} to 'std::vector<std::vector<unsigned int> >&&'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >; allocator_type = std::allocator<std::vector<unsigned int> >; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >; allocator_type = std::allocator<std::vector<unsigned int> >; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<unsigned int> >]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'u_int' {aka 'unsigned int'} to 'const std::vector<std::vector<unsigned int> >&'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >; size_type = long unsigned int; value_type = std::vector<unsigned int>; allocator_type = std::allocator<std::vector<unsigned int> >]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<unsigned int> >::value_type&' {aka 'const std::vector<unsigned int>&'}
569 | vector(size_type __n, const value_type& __value,
| ~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<unsigned int> >]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<unsigned int> >::allocator_type&' {aka 'const std::allocator<std::vector<unsigned int> >&'}
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >; allocator_type = std::allocator<std::vector<unsigned int> >]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<unsigned int>; _Alloc = std::allocator<std::vector<unsigned int> >]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
|
s722612534 | p00438 | C++ | #include <cstdio>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int main(){
while(1){
long long int a,b,c,d,n;
long long int way[16][16]={{0}};
bool flg;
scanf("%d%d\n",&a,&b);
if(a==0&&b==0)break;
scanf("%d\n",&n);
REP(i,n){
scanf("%d%d\n",&c,&d);
way[d-1][c-1]=-1;
}
REP(i,a){
if(way[0][i]==-1||flg){
way[0][i]=0;
flg=true;
}else way[0][i]=1;
}
flg=false;
REP(i,b){
if(way[i][0]==-1||flg){
way[i][0]=0;
flg=true;
}else way[i][0]=1;
}
REP(y,b-1){
REP(x,a-1){
if(way[y+1][x+1]==-1)way[y+1][x+1]=0;
else way[y+1][x+1]=way[y][x+1]+way[y+1][x];
}
}
cout << way[b-1][a-1] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:35:5: error: 'cout' was not declared in this scope
35 | cout << way[b-1][a-1] << endl;
| ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <cstdio>
+++ |+#include <iostream>
2 | #define REP(i,n) for(int i=0;i<(int)(n);i++)
a.cc:35:30: error: 'endl' was not declared in this scope
35 | cout << way[b-1][a-1] << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <cstdio>
+++ |+#include <ostream>
2 | #define REP(i,n) for(int i=0;i<(int)(n);i++)
|
s317882664 | p00438 | C++ | #include <iostream>
using namespace std;
int main() {
while(1)
int a[17][17]={} ,x ,y ,n ,badpoint ,badpoint1;
cin>>x>>y>>n;
if(x==0&&y==0)
break;
for(int i=0;i<n;i++){
cin>>badpoint>>badpoint1;
a[badpoint][badpoint1]=-1;
}
a[0][1]=1;
for(int i=1;i<=x;i++){
for(int j=1;j<=y;j++){
if(a[i][j]==0)
a[i][j]=a[i-1][j]+a[i][j-1];
else
a[i][j]=0;
}
}
cout<<a[x][y]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:14: error: 'x' was not declared in this scope
7 | cin>>x>>y>>n;
| ^
a.cc:7:17: error: 'y' was not declared in this scope
7 | cin>>x>>y>>n;
| ^
a.cc:7:20: error: 'n' was not declared in this scope
7 | cin>>x>>y>>n;
| ^
a.cc:9:9: error: break statement not within loop or switch
9 | break;
| ^~~~~
a.cc:11:22: error: 'badpoint' was not declared in this scope
11 | cin>>badpoint>>badpoint1;
| ^~~~~~~~
a.cc:11:32: error: 'badpoint1' was not declared in this scope
11 | cin>>badpoint>>badpoint1;
| ^~~~~~~~~
a.cc:12:17: error: 'a' was not declared in this scope
12 | a[badpoint][badpoint1]=-1;
| ^
a.cc:14:9: error: 'a' was not declared in this scope
14 | a[0][1]=1;
| ^
|
s441579717 | p00438 | C++ | #include<bits/stdc++.h>
using namespace std;
int area[18][18];
int a,b,n;
int ans=0;
int saiki(int x,int y){
//cout << x << ' ' << y << endl;
if(area[x][y] == -1) return 0;
if(x == a && y == b) {
// cout << 'z' << endl;
return 1;
}
ans += saiki(x,y+1);
ans += saiki(x+1,y);
return 0;
}
int main(){
int x,y;
memset(area,-1,sizeof(area));
while(1){
cin >> a >> b;
if(a == 0 && b == 0)break;
for(int i=1;i<=a;i++){
for(int j=1;j<=b;j++){
area[i][j]=0;
}
}
cin >> n;
for(int i=0;i<n;i++){
cin >> x >> y;
area[x][y]=-1;
}
saiki(1,1);
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:38:2: error: expected '}' at end of input
38 | }
| ^
a.cc:20:11: note: to match this '{'
20 | int main(){
| ^
|
s800077973 | p00438 | C++ | #include <iostream>
typedef std::pair<int, int> P;
const int MAX_AB = 16;
const int MAX_N = 40;
int N, A, B;
int dp[MAX_AB][MAX_AB];
bool obstacle[MAX_AB][MAX_AB] = {false};
void solve(){
for(int i = 0; i < B; ++i){
for(int j = 0; j < A; ++j){
if(obstacle[i][j])
continue;
else if(i == 0 || j == 0)
dp[i][j] = 1;
else{
dp[i][j] += dp[i - 1][j] + dp[i][j - 1];
}
}
}
std::cout << dp[B - 1][A - 1] << std::endl;
return;
}
int main(){
memset(dp, 0, MAX_AB * MAX_AB);
std::cin >> A >> B >> N;
int x, y;
for(int i = 0; i < N; ++i){
std::cin >> y >> x;
--x, --y;
obstacle[x][y] = true;
}
solve();
return 0;
} | a.cc: In function 'int main()':
a.cc:30:5: error: 'memset' was not declared in this scope
30 | memset(dp, 0, MAX_AB * MAX_AB);
| ^~~~~~
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 |
|
s307095545 | p00438 | C++ | #include <iostream>
typedef std::pair<int, int> P;
const int MAX_AB = 16;
const int MAX_N = 40;
int N, A, B;
int dp[MAX_AB][MAX_AB];
bool obstacle[MAX_AB][MAX_AB] = {false};
void solve(){
for(int i = 0; i < B; ++i){
for(int j = 0; j < A; ++j){
if(obstacle[i][j])
continue;
else if(i == 0 || j == 0)
dp[i][j] = 1;
else{
dp[i][j] += dp[i - 1][j] + dp[i][j - 1];
}
}
}
std::cout << dp[B - 1][A - 1] << std::endl;
return;
}
int main(){
memset(dp, 0, MAX_AB * MAX_AB);
std::cin >> A >> B >> N;
int x, y;
for(int i = 0; i < N; ++i){
std::cin >> y >> x;
--x, --y;
obstacle[x][y] = true;
}
solve();
return 0;
} | a.cc: In function 'int main()':
a.cc:30:5: error: 'memset' was not declared in this scope
30 | memset(dp, 0, MAX_AB * MAX_AB);
| ^~~~~~
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 |
|
s027276814 | p00438 | C++ | #include <iostream>
typedef std::pair<int, int> P;
const int MAX_AB = 16;
const int MAX_N = 40;
int N, A, B;
int dp[MAX_AB][MAX_AB];
bool obstacle[MAX_AB][MAX_AB] = {false};
void solve(){
for(int i = 0; i < B; ++i){
for(int j = 0; j < A; ++j){
if(obstacle[i][j])
continue;
else if(i == 0 || j == 0)
dp[i][j] = 1;
else{
dp[i][j] += dp[i - 1][j] + dp[i][j - 1];
}
}
}
std::cout << dp[B - 1][A - 1] << std::endl;
return;
}
int main(){
memset(dp, 0, MAX_AB * MAX_AB);
std::cin >> A >> B >> N;
int x, y;
for(int i = 0; i < N; ++i){
std::cin >> y >> x;
--x, --y;
obstacle[x][y] = true;
}
solve();
return 0;
} | a.cc: In function 'int main()':
a.cc:30:5: error: 'memset' was not declared in this scope
30 | memset(dp, 0, MAX_AB * MAX_AB);
| ^~~~~~
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 |
|
s169688004 | p00438 | C++ | #include <cstdio>
#include <string>
using namespace std;
int main(){
const int size = 16 + 1;
int a, b, n, x, y;
int dp[size][size];
bool fab[size][size];
while(true){
scanf("%d%d", &a, &b);
if(a == 0 && b == 0) break;
scanf("%d", &n);
memset(fab, false, sizeof(fab));
for(int i = 0; i < n; i++){
scanf("%d%d", &x, &y);
fab[y][x] = true;
}
memset(dp, 0, sizeof(dp));
dp[1][1] = 1;
for(int i = 1; i <= b; i++){
for(int j = 1; j <= a; j++){
if(i == 1 && j == 1) continue;
if(fab[i][j]) dp[i][j] = 0;
else{
dp[i][j] = ((i > 1)? dp[i - 1][j] : 0) + ((j > 1)? dp[i][j - 1] : 0);
}
}
}
printf("%d\n", dp[b][a]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
15 | memset(fab, false, sizeof(fab));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <string>
+++ |+#include <cstring>
3 | using namespace std;
|
s331935303 | p00438 | C++ | #include<stdio.h>
#include<iostream>
long long int memo[20][20],j[1000000000];
long long int a,b,c,i,k=0,A,B,C;
long long int f(int x,int y){
if(memo[x][y]==-2)return 0;
if(x==1&&y==1)return 1;
if(x==1)
return memo[x][y]=f(x,y-1);
if(y==1)
return memo[x][y]=f(x-1,y);
if(memo[x][y]!=-1){
return memo[x][y];
}else{
return memo[x][y]=f(x-1,y)+f(x,y-1);
}}
int main(){
using namespace std;
while(1){
scanf("%lld%lld",&A,&B);
if(A==0&&B==0)break;
fill((int*)memo,(int*)memo+400,-1);
scanf("%lld",&a);
for(i=0;i<a;i++){
scanf("%lld %lld",&b,&c);
memo[b][c]=-2;
}
j[k]=f(A,B);
k=k+1;
}
for(C=0;C<k;C++){
printf("%lld\n",j[C]);
}
return 0;
} | /tmp/ccLApzsC.o: in function `main':
a.cc:(.text+0x26d): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccLApzsC.o
a.cc:(.text+0x277): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccLApzsC.o
a.cc:(.text+0x295): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccLApzsC.o
a.cc:(.text+0x2a1): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccLApzsC.o
a.cc:(.text+0x2d8): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccLApzsC.o
a.cc:(.text+0x2f6): relocation truncated to fit: R_X86_64_PC32 against symbol `i' defined in .bss section in /tmp/ccLApzsC.o
a.cc:(.text+0x303): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccLApzsC.o
a.cc:(.text+0x30d): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccLApzsC.o
a.cc:(.text+0x32b): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccLApzsC.o
a.cc:(.text+0x332): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccLApzsC.o
a.cc:(.text+0x361): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s752713030 | p00438 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
while(1){
int int dp[100][100] = {0},built[100][100] = {0};x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
dp[1][1] = 1;
scanf("%d%d%d",&x,&y,&n);
if(x == 0 && y == 0)break;
for(int i = 1;i <= n;i++){
scanf("%d%d",&X,&Y);
built[X][Y] = -1;
}
for(int i = 1;i <= x;i++){
for(int j = 1;j <= y;j++){
for(int k = 0;k < 2;k++){
if(built[i][j] >= 0){
dp[i][j] += dp[i + dx[k]][j + dy[k]];
}
}
}
}
printf("%d\n",dp[x][y]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:5: error: two or more data types in declaration of 'dp'
8 | int int dp[100][100] = {0},built[100][100] = {0};x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
| ^~~
a.cc:8:5: error: two or more data types in declaration of 'built'
a.cc:8:54: error: 'x' was not declared in this scope
8 | int int dp[100][100] = {0},built[100][100] = {0};x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
| ^
a.cc:8:56: error: 'y' was not declared in this scope; did you mean 'yn'?
8 | int int dp[100][100] = {0},built[100][100] = {0};x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
| ^
| yn
a.cc:8:58: error: 'n' was not declared in this scope; did you mean 'yn'?
8 | int int dp[100][100] = {0},built[100][100] = {0};x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
| ^
| yn
a.cc:8:60: error: 'X' was not declared in this scope
8 | int int dp[100][100] = {0},built[100][100] = {0};x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
| ^
a.cc:8:62: error: 'Y' was not declared in this scope
8 | int int dp[100][100] = {0},built[100][100] = {0};x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
| ^
a.cc:8:64: error: 'dx' was not declared in this scope
8 | int int dp[100][100] = {0},built[100][100] = {0};x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
| ^~
a.cc:8:67: error: expected primary-expression before ']' token
8 | int int dp[100][100] = {0},built[100][100] = {0};x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
| ^
a.cc:8:78: error: 'dy' was not declared in this scope
8 | int int dp[100][100] = {0},built[100][100] = {0};x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
| ^~
a.cc:8:81: error: expected primary-expression before ']' token
8 | int int dp[100][100] = {0},built[100][100] = {0};x,y,n,X,Y,dx[] = {-1,0},dy[] = {0,-1};
| ^
a.cc:9:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
9 | dp[1][1] = 1;
| ^~
| dup
a.cc:14:9: error: 'built' was not declared in this scope
14 | built[X][Y] = -1;
| ^~~~~
a.cc:19:24: error: 'built' was not declared in this scope
19 | if(built[i][j] >= 0){
| ^~~~~
|
s115770572 | p00438 | C++ | #include<bits/stdc++.h>
using namespace std;
int f(int x,int y)
{
if(x == 1 && y == 1)return 1;
if(x <= 0 || y <= 0)return 0;
if(load[x][y] == 0) return f(x - 1,y) + f(x,y - 1);
return 0;
}
int main()
{
int a,b,n,x,y;
while(1){
int load[17][17] = {0};
cin >> a >> b;
if(a == 0 && b == 0)break;
cin >> n;
for(int i = 0;i < n;i++){
cin >> x >> y;
load[x][y]=-1;
}
cout << f(a,b) << endl;
}
return 0;
} | a.cc: In function 'int f(int, int)':
a.cc:9:8: error: 'load' was not declared in this scope
9 | if(load[x][y] == 0) return f(x - 1,y) + f(x,y - 1);
| ^~~~
|
s301499572 | p00438 | C++ | import java.util.Scanner;
public class Main {
public static void main(String[] args){
new Main();
}
public Main(){
Scanner sc = new Scanner(System.in);
while(true){
int w = sc.nextInt();
int h = sc.nextInt();
if(h==0 && w==0)break;
int[][] dp = new int[h][w];
dp[0][0] = 1;
int n = sc.nextInt();
while(n-->0){
int x = sc.nextInt();
int y = sc.nextInt();
dp[y-1][x-1] = -1;
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(dp[i][j]==-1)continue;
if(i<h-1 && dp[i+1][j]!=-1) dp[i+1][j] += dp[i][j];
if(j<w-1 && dp[i][j+1]!=-1) dp[i][j+1] += dp[i][j];
}
}
System.out.println(dp[h-1][w-1]);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s075563009 | p00438 | C++ | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int a,b,n,m=0;
int ans[100];
int con1[40],con2[40];
int road[16][16];
while(1)
{
cin>>a>>b;
if(a==0&&b==0)break;
cin>>n;
for(int i=0;i<n;i++)cin>>con1[i]>>con2[i];
for(int i=1;i<=a;i++)for(int j=1;j<=b;j++)
{
if(i==1||j==1)road[i][j]=1;
else road[i][j]=road[i-1][j]+road[i][j-1];
for(int k=0;k<n;k++)if(i==con1[k]&&j==con2[k])road[i][j]=0;
}
ans[m]=road[a][b];
m++
}
for(int i=0;i<m;i++)cout<<ans[m];
return 0;
} | a.cc: In function 'int main()':
a.cc:25:12: error: expected ';' before '}' token
25 | m++
| ^
| ;
26 | }
| ~
|
s235622921 | p00438 | C++ | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int a,b,n,m=0;
int ans[100];
int con1[40],con2[40];
int road[16][16];
while(1)
{
cin>>a>>b;
if(a==0&&b==0)break;
cin>>n;
for(int i=0;i<n;i++)cin>>con1[i]>>con2[i];
for(int i=1;i<=a;i++)for(int j=1;j<=b;j++)
{
if(i==1||j==1)road[i][j]=1;
else road[i][j]=road[i-1][j]+road[i][j-1];
for(int k=0;k<n;k++)if(i==con1[k]&&j==con2[k])road[i][j]=0;
}
ans[m]=road[a][b];
m++
}
for(int i=0;i<m;i++)cout<<ans[m]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:25:12: error: expected ';' before '}' token
25 | m++
| ^
| ;
26 | }
| ~
|
s444923640 | p00438 | C++ | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int a,b,n,m=0;
int ans[1000];
int con1[40],con2[40];
int road[16][16];
while(1)
{
cin>>a>>b;
if(a==0&&b==0)break;
cin>>n;
for(int i=0;i<n;i++)cin>>con1[i]>>con2[i];
for(int i=1;i<=a;i++)for(int j=1;j<=b;j++)
{
if(i==1||j==1)road[i][j]=1;
else road[i][j]=road[i-1][j]+road[i][j-1];
for(int k=0;k<n;k++)if(i==con1[k]&&j==con2[k])road[i][j]=0;
}
ans[m]=road[a][b];
m++
}
for(int i=0;i<m;i++)cout<<ans[m]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:25:12: error: expected ';' before '}' token
25 | m++
| ^
| ;
26 | }
| ~
|
s131943765 | p00438 | C++ | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int a,b,n,m=0;
int ans[10000];
int con1[40],con2[40];
int road[16][16];
while(1)
{
cin>>a>>b;
if(a==0&&b==0)break;
cin>>n;
for(int i=0;i<n;i++)cin>>con1[i]>>con2[i];
for(int i=1;i<=a;i++)for(int j=1;j<=b;j++)
{
if(i==1||j==1)road[i][j]=1;
else road[i][j]=road[i-1][j]+road[i][j-1];
for(int k=0;k<n;k++)if(i==con1[k]&&j==con2[k])road[i][j]=0;
}
ans[m]=road[a][b];
m++
}
for(int i=0;i<m;i++)cout<<ans[m]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:25:12: error: expected ';' before '}' token
25 | m++
| ^
| ;
26 | }
| ~
|
s262118175 | p00438 | C++ | #include<stdio.h>
int main(void)
|
int a,b,n,x,y,i,j,dp[101][101]
scanf("%d%d%d",&a,&b,&n);
for(i=1;i<=a;i++){
for(j=1;j<b;j++){
dp[i][j]=0;
}
}
for(i=1;i<=n;i++){
scanf("%d%d",&x,&y);
dp[x][y]=-1;
}
dp[1][1]=1;
for(i=1;i<=a;i++){
for(j=1;j<=b;j++){
if(dp[i][j]!=-1){
if(dp[i+1][j]==0&&i<=a){
dp[i+1][j]=dp[i][j];
}
if(dp[i][j+1]!=-1&&j<=b){
dp[i][j+1]=dp[i][j]+dp[i][j+1];
}
}
}
}
printf("%d\n",dp[a][b]);
return 0;
} | a.cc:3:1: error: expected initializer before '|' token
3 | |
| ^
a.cc:6:9: error: expected unqualified-id before 'for'
6 | for(i=1;i<=a;i++){
| ^~~
a.cc:6:17: error: 'i' does not name a type
6 | for(i=1;i<=a;i++){
| ^
a.cc:6:22: error: 'i' does not name a type
6 | for(i=1;i<=a;i++){
| ^
a.cc:11:9: error: expected unqualified-id before 'for'
11 | for(i=1;i<=n;i++){
| ^~~
a.cc:11:17: error: 'i' does not name a type
11 | for(i=1;i<=n;i++){
| ^
a.cc:11:22: error: 'i' does not name a type
11 | for(i=1;i<=n;i++){
| ^
a.cc:15:9: error: 'dp' does not name a type
15 | dp[1][1]=1;
| ^~
a.cc:16:9: error: expected unqualified-id before 'for'
16 | for(i=1;i<=a;i++){
| ^~~
a.cc:16:17: error: 'i' does not name a type
16 | for(i=1;i<=a;i++){
| ^
a.cc:16:22: error: 'i' does not name a type
16 | for(i=1;i<=a;i++){
| ^
a.cc:28:15: error: expected constructor, destructor, or type conversion before '(' token
28 | printf("%d\n",dp[a][b]);
| ^
a.cc:29:9: error: expected unqualified-id before 'return'
29 | return 0;
| ^~~~~~
a.cc:30:1: error: expected declaration before '}' token
30 | }
| ^
|
s863467912 | p00438 | C++ | {
int a,b,n,x,y;
while(1){
cin>>a>>b;
if(a==0)break;
int route[a+1][b+1];
cin>>n;
for(int i=1;i<=a;i++){
for(int j=1;j<=b;j++){
route[i][j]=0;
}
}
for(int i=0;i<n;i++){
cin>>x>>y;
route[x][y]=-1;
}
route[1][1]=1;
for(int i=1;i<=a;i++){
for(int j=1;j<=b;j++){
if(route[i][j]==-1){
route[i][j]=0;
}else{
if(i>1) route[i][j]+=route[i-1][j];
if(j>1) route[i][j]+=route[i][j-1];
}
}
}
cout<<route[a][b]<<endl;
}
return 0;
} | a.cc:1:1: error: expected unqualified-id before '{' token
1 | {
| ^
|
s961398041 | p00438 | C++ | #include <bits/std/c++.h>
using namespace std;
#define loop(i,n) for(int i=1;i<=n;i++)
int pat[17][17];
bool out[17][17];
int solve(){
int a, b, n, x, y;
cin >> a >> b;
if (a == 0)return 0;
cin >> n;
loop(i, n){
cin >> x;
cin >> y;
out[x][y] = 1;
}
loop(i, a)pat[i][1] = 1;
loop(j, b)pat[1][j] = 1;
loop(i, a){
if (i == 1)continue;
loop(j, b){
if (j == 1)continue;
if (out[i][j])continue;
pat[i][j] = pat[i - 1][j] + pat[i][j - 1];
}
}
cout << pat[a][b] << endl;
return 1;
}
int main(){
while (solve());
return 0;
} | a.cc:1:10: fatal error: bits/std/c++.h: No such file or directory
1 | #include <bits/std/c++.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.
|
s764243690 | p00438 | C++ |
#include<iostream>
#include<stdio.h>
#include<string>
#include<math.h>
#include<iomanip>
#include<algorithm>
#include<string.h>
#include<cctype>
#include<map>
#include<set>
#include<vector>
#include<sstream>
#include<stack>
#include<queue>
using namespace std;
int dir_x[2]={1,0};
int dir_y[2]={0,1};
int start_x,start_y;
typedef pair<int,int> P;
int n,m;
int map[16][16];
int bfs()
{
queue<P> que;
int count=0;
que.push(P(start_x,start_y));
while(que.size())
{
P p=que.front();
que.pop();
if(p.first==n-1&&p.second==m-1)
{
count++;
break;
}
for(int i=0;i<2;i++)
{
int next_x=p.first+dir_x[i];
int next_y=p.second+dir_y[i];
if(next_x<n&&next_y<m&&(map[next_x][next_y]==0))
{
que.push(P(next_x,next_y));
}
}
}
return count;
}
int main()
{
int count=0;
start_x=start_y=0;
cin>>n>>m;
for(int i=0;i<n;i++) for(int j=0;j<m;j++) map[i][j]=0;
int obj;
cin>>obj;
while(obj--)
{
int x,y;
cin>>x>>y;
map[x-1][y-1]=1;
}
int count=bfs();
cout<<count<<endl;
//while(1);
return 0;
}
| a.cc: In function 'int bfs()':
a.cc:46:32: error: reference to 'map' is ambiguous
46 | if(next_x<n&&next_y<m&&(map[next_x][next_y]==0))
| ^~~
In file included from /usr/include/c++/14/map:63,
from a.cc:10:
/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:26:6: note: 'int map [16][16]'
26 | int map[16][16];
| ^~~
a.cc: In function 'int main()':
a.cc:60:46: error: reference to 'map' is ambiguous
60 | for(int i=0;i<n;i++) for(int j=0;j<m;j++) map[i][j]=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:26:6: note: 'int map [16][16]'
26 | int map[16][16];
| ^~~
a.cc:67:6: error: reference to 'map' is ambiguous
67 | map[x-1][y-1]=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:26:6: note: 'int map [16][16]'
26 | int map[16][16];
| ^~~
a.cc:69:8: error: redeclaration of 'int count'
69 | int count=bfs();
| ^~~~~
a.cc:57:8: note: 'int count' previously declared here
57 | int count=0;
| ^~~~~
|
s473278417 | p00438 | C++ |
#include<iostream>
#include<stdio.h>
#include<string>
#include<math.h>
#include<iomanip>
#include<algorithm>
#include<string.h>
#include<cctype>
#include<map>
#include<set>
#include<vector>
#include<sstream>
#include<stack>
#include<queue>
using namespace std;
int dir_x[2]={1,0};
int dir_y[2]={0,1};
int start_x,start_y;
typedef pair<int,int> P;
int n,m;
//int map[16][16];
int bfs()
{
queue<P> que;
int count=0;
que.push(P(start_x,start_y));
while(que.size())
{
P p=que.front();
que.pop();
if(p.first==n-1&&p.second==m-1)
{
count++;
break;
}
for(int i=0;i<2;i++)
{
int next_x=p.first+dir_x[i];
int next_y=p.second+dir_y[i];
if(next_x<n&&next_y<m&&map[next_x][next_y]==0)
{
que.push(P(next_x,next_y));
}
}
}
return count;
}
int main()
{
int count=0;
int map[16][16];
start_x=start_y=0;
cin>>n>>m;
for(int i=0;i<n;i++) for(int j=0;j<m;j++) map[i][j]=0;
int obj;
cin>>obj;
while(obj--)
{
int x,y;
cin>>x>>y;
map[x-1][y-1]=1;
}
int count=bfs();
cout<<count<<endl;
//while(1);
return 0;
}
| a.cc: In function 'int bfs()':
a.cc:46:34: error: missing template arguments before '[' token
46 | if(next_x<n&&next_y<m&&map[next_x][next_y]==0)
| ^
a.cc: In function 'int main()':
a.cc:70:8: error: redeclaration of 'int count'
70 | int count=bfs();
| ^~~~~
a.cc:57:8: note: 'int count' previously declared here
57 | int count=0;
| ^~~~~
|
s068000858 | p00438 | C++ |
#include<iostream>
#include<stdio.h>
#include<string>
#include<math.h>
#include<iomanip>
#include<algorithm>
#include<string.h>
#include<cctype>
#include<map>
#include<set>
#include<vector>
#include<sstream>
#include<stack>
#include<queue>
using namespace std;
struct stu
{
int x;
int y;
};
stu f;
int dir_x[2]={1,0};
int dir_y[2]={0,1};
int start_x,start_y;
int n,m;
int map[16][16];
int bfs()
{
queue<stu> que;
int count=0;
f.x=start_x;
f.y=start_y;
que.push(f);
while(que.size())
{
stu p=que.front();
que.pop();
if(p.x==n-1&&p.y==m-1)
{
count++;
break;
}
for(int i=0;i<2;i++)
{
stu q;
q.x=p.x+dir_x[i];
q.y=p.y+dir_y[i];
if((q.x<n)&&(q.y<m)&&(map[q.x][q.y]!=1))
{
que.push(q);
}
}
}
return count;
}
int main()
{
count=0;
//int map[16][16];
start_x=start_y=0;
cin>>n>>m;
for(int i=0;i<n;i++) for(int j=0;j<m;j++) map[i][j]=0;
int obj;
cin>>obj;
while(obj--)
{
int x,y;
cin>>x>>y;
map[x-1][y-1]=1;
}
int count=bfs();
cout<<count<<endl;
//while(1);
return 0;
}
| a.cc: In function 'int bfs()':
a.cc:55:30: error: reference to 'map' is ambiguous
55 | if((q.x<n)&&(q.y<m)&&(map[q.x][q.y]!=1))
| ^~~
In file included from /usr/include/c++/14/map:63,
from a.cc:10:
/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:32:6: note: 'int map [16][16]'
32 | int map[16][16];
| ^~~
a.cc: In function 'int main()':
a.cc:66:10: error: overloaded function with no contextual type information
66 | count=0;
| ^
a.cc:70:46: error: reference to 'map' is ambiguous
70 | for(int i=0;i<n;i++) for(int j=0;j<m;j++) map[i][j]=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:32:6: note: 'int map [16][16]'
32 | int map[16][16];
| ^~~
a.cc:77:6: error: reference to 'map' is ambiguous
77 | map[x-1][y-1]=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:32:6: note: 'int map [16][16]'
32 | int map[16][16];
| ^~~
|
s888968749 | p00438 | C++ | #include<iostream>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
using namespace std;
long long sousuu = 1, ans;
int main()
{
int machi[20][20] = { 0,0 }, a, b, n; cin >> a >> b;
bool kouji[20][20] = { false };
a--; b--;
while (scanf_s("%d",&n)) {
if (n == 0) { break; }cout << n << endl;
for (int i = 0; i < n; i++)
{
int d, e; cin >> d >> e;
kouji[d - 1][e - 1] = true;
}
machi[0][0] = 1;
REP(i, a + 1) {
if (kouji[i][0]) {
machi[i][0] = 1;
}
else {
break;
}
}
REP(i, b + 1) {
if (kouji[0][i]) {
machi[0][i] = 1;
}
else { break; }
}
FOR(i, 1, a + 1) {
FOR(j, 1, b + 1) {
if (kouji[i][j] != true) {
machi[i][j] = machi[i - 1][j] + machi[i][j - 1];
//cout << i << " " << j << " " << machi[i][j] << endl;
}
}
}
cout << machi[a][b] << endl;
}
cout << "s";
return 0;
} | a.cc: In function 'int main()':
a.cc:12:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
12 | while (scanf_s("%d",&n)) {
| ^~~~~~~
| scanf
|
s119418272 | p00438 | C++ | #include<iostream>
#include<cstdio>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
using namespace std;
long long sousuu = 1, ans;
int main()
{
int machi[20][20] = { 0,0 }, a, b, n; cin >> a >> b;
bool kouji[20][20] = { false };
a--; b--;
while (scanf_s("%d",&n)) {
if (n == 0) { break; }//cout << n << endl;
for (int i = 0; i < n; i++)
{
int d, e; cin >> d >> e;
kouji[d - 1][e - 1] = true;
}
machi[0][0] = 1;
REP(i, a + 1) {
if (kouji[i][0]) {
machi[i][0] = 1;
}
else {
break;
}
}
REP(i, b + 1) {
if (kouji[0][i]) {
machi[0][i] = 1;
}
else { break; }
}
FOR(i, 1, a + 1) {
FOR(j, 1, b + 1) {
if (kouji[i][j] != true) {
machi[i][j] = machi[i - 1][j] + machi[i][j - 1];
//cout << i << " " << j << " " << machi[i][j] << endl;
}
}
}
cout << machi[a][b] << endl;
}
// cout << "s";
return 0;
} | a.cc: In function 'int main()':
a.cc:13:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
13 | while (scanf_s("%d",&n)) {
| ^~~~~~~
| scanf
|
s877916209 | p00438 | C++ | import Control.Monad
import Control.Applicative
main :: IO ()
main = do
[a, b] <- getInts
if (a == 0 && b == 0) then return ()
else do
n <- getInt
ss <- getIntsLines n
print $ solve [1,1] (ss ++ [[a+1, x] | x <- [1..b]] ++ [[x,b+1]|x<-[1..a]]) a b
main
solve p ss a b
| p == [a,b] = 1
| notElem (add1 p) ss && notElem (add2 p) ss = solve (add1 p) ss a b + solve (add2 p) ss a b
| elem (add1 p) ss && notElem (add2 p) ss = solve (add2 p) ss a b
| notElem (add1 p) ss && elem (add2 p) ss = solve (add1 p) ss a b
| otherwise = 0
---
getInt :: IO Integer
getInt = read <$> getLine
getInts :: IO [Integer]
getInts = map read . words <$> getLine
getIntLines :: Integral a => a -> IO [Integer]
getIntLines n = replicateM (fromIntegral n :: Int) getInt
getIntsLines :: Integral a => a -> IO [[Integer]]
getIntsLines n = replicateM (fromIntegral n :: Int) getInts
add1 [n,m] = [n + 1, m]
add2 [n,m] = [n, m + 1] | a.cc:11:50: error: too many decimal points in number
11 | print $ solve [1,1] (ss ++ [[a+1, x] | x <- [1..b]] ++ [[x,b+1]|x<-[1..a]]) a b
| ^~~~
a.cc:11:73: error: too many decimal points in number
11 | print $ solve [1,1] (ss ++ [[a+1, x] | x <- [1..b]] ++ [[x,b+1]|x<-[1..a]]) a b
| ^~~~
a.cc:1:1: error: 'import' does not name a type
1 | import Control.Monad
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s989516083 | p00438 | C++ | #include <iostream>
#include <vector>
/*
substitute 0 for cannot through path
'x' and 'y' is point of construction
'row' is a
'column' is b
*/
/*
void cannotThroughPath(int x, int y, int row, int column){
int v[row][column];
if(x == 1 && y != 1){
for(int i = 0; i < column; ++i){
v[x-1][i] = 0;
}
} else if(x != 1 && y == 1){
for(int i = 0; i < row; ++i){
v[i][y-1] = 0;
}
} else if(x != 1 && y != 1){
v[x-1][y-1] = 0;
}
}
*/
int main(void){
int a,b; //number of road
while(std::cin >> a >> b){ //input road
if(a == 0 && b == 0) //end of input
break;
//make matrix a x b
int path[a][b];
for(int i = 0; i < a; ++i){
for(int j = 0; j < b; ++j){
path[i][j] = -1;
}
}
path[0][0] = 0;
for(int i = 1; i < a; ++i){
path[i][0] = 1;
}
for(int j = 1; j < b; ++j){
path[0][j] = 1;
}
int num; //number of construction
std::cin >> num;
int x, y; //point of construction
for(int i = 0; i < num; ++i){
std::cin >> x >> y;
//cannotThroughPath(x, y, a, b);
if(x == 1 && y != 1){
for(int i = 0; i < column; ++i){
path[x-1][i] = 0;
}
} else if(x != 1 && y == 1){
for(int i = 0; i < row; ++i){
path[i][y-1] = 0;
}
} else if(x != 1 && y != 1){
path[x-1][y-1] = 0;
}
}
for(int i = 1; i < b; ++i){
for(int j = 1; j < a; ++j){
if(path[j][i] == 0){
path[j][i] = 0;
} else if(path[j][i] != 0){
path[j][i] = path[j-1][i] + path[j][i-1];
}
}
}
std::cout << path[a-1][b-1] << std::endl; //output answer
}
return 0;
} | a.cc: In function 'int main()':
a.cc:60:52: error: 'column' was not declared in this scope
60 | for(int i = 0; i < column; ++i){
| ^~~~~~
a.cc:64:52: error: 'row' was not declared in this scope
64 | for(int i = 0; i < row; ++i){
| ^~~
|
s574285333 | p00438 | C++ | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
int h, w;
while(cin >> w >> h) {
if(h == 0 && w == 0) return 0;
int n; cin >> n;
int ng[h][w]; CLR(ng);
FOR(i,0,n) {
int a, b; cin >> a >> b;
--a;--b;
ng[b][a] = true;
}
ll dp[h][w]; CLR(dp);
FOR(y,0,h) {
if(ng[y][x]) dp[y][0] = 1;
else break;
}
FOR(x,0,w) {
if(ng[y][x]) dp[0][x] = 1;
else break;
}
FOR(y,1,h) {
FOR(x,1,w) {
if(ng[y][x]) continue;
dp[y][x] = dp[y-1][x] + dp[y][x-1];
}
}
cout << dp[h-1][w-1] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:35:16: error: 'x' was not declared in this scope
35 | if(ng[y][x]) dp[y][0] = 1;
| ^
a.cc:39:13: error: 'y' was not declared in this scope
39 | if(ng[y][x]) dp[0][x] = 1;
| ^
|
s904866733 | p00438 | C++ | include<iostream>
#include<queue>
using namespace std;
#include<stdio.h>
int main(void)
{
while (1)
{
int a, b, i,j, n, x, y, m[18][18] = { 0 }, c = 0;
pair<int, int> g, h;
queue<pair<int, int> > q;
scanf("%d %d", &a, &b);
if (a == 0 && b == 0)
{
break;
}
for (i = 0; i <= a + 1; i++)
{
for (j = 0; j <= b + 1; j++)
{
if(i==0||i==a+1||j==0||j==b+1)
{
m[i][j] = 1;
}
}
}
scanf("%d", &n);
for (i = 0; i < n; i++)
{
scanf("%d%d", &x, &y);
m[x][y] = 1;
}
g.first = a;
g.second = b;
h.first = 1;
h.second = 1;
q.push(h);
while (!q.empty())
{
h = q.front();
q.pop();
if (m[h.first + 1][h.second] != 1)
{
h.first++;
q.push(h);
h.first--;
}
if (m[h.first][h.second + 1] != 1)
{
h.second++;
q.push(h);
h.second--;
}
if (h == g)
{
c++;
}
}
printf("%d\n", c);
}
return 0;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/deque:62,
from /usr/include/c++/14/queue: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 __se |
s723357125 | p00438 | C++ | #include <stdio.h>
#include <queue>
#include <iostream>
using namespace std;
??
int main (){
??
while (1){
??
int a,b,s,k,s2,i[18][18]={0},count=0;
??
stack <pair<int,int> > que;
??
pair <int,int> p,g;
??
p.first=1;
p.second=1;
??
que.push(p);
??
scanf ("%d %d",&a,&b);
??
if (a==0&&b==0) break;
??
for (s=0;s<=a+1;s++){
??????????for (s2=0;s2<=b+1;s2++){
????????????if (s==a+1||s==0){
????????????????i[s][s2]=1;
????????????????}
????????????if (s2==b+1||s2==0){
????????????????i[s][s2]=1;
????????????????????????????????}
????????}
}
??
g.first=a;
g.second=b;
??
scanf ("%d",&k);
??
for (s=0;s<k;s++){
??
scanf ("%d %d",&a,&b);
??
i[a][b]=1;
??
}
??
while (!que.empty()){
????????p=que.front();
????????que.pop();
????????if (i[p.first+1][p.second]==0){
????????????????p.first=p.first+1;
????????????????que.push(p);
????????????????p.first=p.first-1;
????????}
??
????????if (i[p.first][p.second+1]==0){
????????????????p.second=p.second+1;
????????????????que.push(p);
????????????????p.second=p.second-1;
????????}
??
????????????????if (p==g){
????????????????count++;
????????}
??
}
??
printf ("%d\n",count);
??
}
??
return 0;
} | a.cc:5:1: error: expected unqualified-id before '?' token
5 | ??
| ^
|
s851267226 | p00438 | C++ | #include <stdio.h>
#include <queue>
#include <iostream>
using namespace std;
??
int main (){
??
while (1){
??
int a,b,s,k,s2,i[18][18]={0},count=0;
??
queue <pair<int,int> > que;
??
pair <int,int> p,g;
??
p.first=1;
p.second=1;
??
que.push(p);
??
scanf ("%d %d",&a,&b);
??
if (a==0&&b==0) break;
??
for (s=0;s<=a+1;s++){
??????????for (s2=0;s2<=b+1;s2++){
????????????if (s==a+1||s==0){
????????????????i[s][s2]=1;
????????????????}
????????????if (s2==b+1||s2==0){
????????????????i[s][s2]=1;
????????????????????????????????}
????????}
}
??
g.first=a;
g.second=b;
??
scanf ("%d",&k);
??
for (s=0;s<k;s++){
??
scanf ("%d %d",&a,&b);
??
i[a][b]=1;
??
}
??
while (!que.empty()){
????????p=que.front();
????????que.pop();
????????if (i[p.first+1][p.second]==0){
????????????????p.first=p.first+1;
????????????????que.push(p);
????????????????p.first=p.first-1;
????????}
??
????????if (i[p.first][p.second+1]==0){
????????????????p.second=p.second+1;
????????????????que.push(p);
????????????????p.second=p.second-1;
????????}
??
????????????????if (p==g){
????????????????count++;
????????}
??
}
??
printf ("%d\n",count);
??
}
??
return 0;
} | a.cc:5:1: error: expected unqualified-id before '?' token
5 | ??
| ^
|
s421017876 | p00438 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#define INF 2147483647
#define IN 2047483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
int a,b;
while(cin>>a>>b,a+b){
int n;
cin>>n;
int dp[a*2][b*2];
fill(dp,IN);
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
dp[x][y]=INF;
}
dp[1][1]=0;
for(int i=1;i<=a;i++){
for(int j=1;j<=b;j++){
if(dp[i][j]==-1)
continue;
dp[i][j]=min(dp[i][j-1]+1,dp[i][j]);
}
}
cout<<dp[a][b]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:9: error: no matching function for call to 'fill(int [(a * 2)][(b * 2)], int)'
24 | fill(dp,IN);
| ~~~~^~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note: candidate: 'template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)'
1022 | fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
| ^~~~
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:6:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: candidate expects 4 arguments, 2 provided
|
s863246421 | p00438 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#define INF 2147483647
#define IN 2047483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
int a,b;
while(cin>>a>>b,a+b){
int n;
cin>>n;
int dp[a*2][b*2];
fill(dp,IN);
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
dp[x][y]=INF;
}
dp[1][1]=0;
for(int i=1;i<=a;i++){
for(int j=1;j<=b;j++){
if(dp[i][j]==-1)
continue;
dp[i][j]=min(dp[i][j-1]+1,dp[i][j]);
}
}
cout<<dp[a][b]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:9: error: no matching function for call to 'fill(int [(a * 2)][(b * 2)], int)'
24 | fill(dp,IN);
| ~~~~^~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note: candidate: 'template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)'
1022 | fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
| ^~~~
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:6:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: candidate expects 4 arguments, 2 provided
|
s343395573 | p00438 | C++ | #include<iostream>
using namespace std;
bool cant[20][20];
ll mp[20][20];
int a,b,ans;
int main()
{
while(cin >> a >> b,a)
{
for(int i = 0;i < 20;i++)for(int j = 0;j < 20;j++)
{
mp[i][j] = 0;
cant[i][j] = false;
}
ans = 0;
int n;
cin >> n;
for(int i = 0;i < n;i++)
{
int x,y;
cin >> x >> y;
cant[x-1][y-1] = true;
}
for(int i = 0;i < 20;i++)
{
if(cant[i][0])break;
mp[i][0]=1;
}
for(int i = 0;i < 20;i++)
{
if(cant[0][i])break;
mp[0][i]=1;
}
for(int i = 1;i < a ;i++)for(int j = 1;j < b;j++)
{
int tmp = 0;
if(i > 0)tmp += mp[i-1][j];
if(j > 0)tmp += mp[i][j-1];
if(!cant[i][j])
{
mp[i][j] = tmp;
}
else
{
mp[i][j] = 0;
}
}
cout << mp[a-1][b-1] << endl;
}
return 0;
} | a.cc:6:1: error: 'll' does not name a type
6 | ll mp[20][20];
| ^~
a.cc: In function 'int main()':
a.cc:15:25: error: 'mp' was not declared in this scope
15 | mp[i][j] = 0;
| ^~
a.cc:33:25: error: 'mp' was not declared in this scope
33 | mp[i][0]=1;
| ^~
a.cc:38:25: error: 'mp' was not declared in this scope
38 | mp[0][i]=1;
| ^~
a.cc:45:41: error: 'mp' was not declared in this scope; did you mean 'tmp'?
45 | if(i > 0)tmp += mp[i-1][j];
| ^~
| tmp
a.cc:46:41: error: 'mp' was not declared in this scope; did you mean 'tmp'?
46 | if(j > 0)tmp += mp[i][j-1];
| ^~
| tmp
a.cc:49:33: error: 'mp' was not declared in this scope; did you mean 'tmp'?
49 | mp[i][j] = tmp;
| ^~
| tmp
a.cc:53:33: error: 'mp' was not declared in this scope; did you mean 'tmp'?
53 | mp[i][j] = 0;
| ^~
| tmp
a.cc:58:25: error: 'mp' was not declared in this scope
58 | cout << mp[a-1][b-1] << endl;
| ^~
|
s620554654 | p00438 | C++ | #include<bits/stdc++.h>
#include<windows.h>
using namespace std ;
typedef pair<int,int> pii ;
int a = 0 ;
int b = 0 ;
int n = 0 ;
int dp[16][16] = {1} ;
vector<pii> construct ;
int inf = pow(10,9) ;
int solve()
{
for ( int i = 0 ; i < 16 ; i++ )
{
for ( int j = 0 ; j < 16 ; j++ )
{
dp[i][j] = 0 ;
}
}
for ( int i = 0 ; i < construct.size() ; i++ )
{
dp[ construct[i].first - 1 ][ construct[i].second - 1 ] = inf ;
}
dp[0][0] = 1 ;
for ( int i = 0 ; i < a ; i++ )
{
for ( int j = 0 ; j < b ; j++ )
{
if ( dp[i][j] == inf ) continue ;
if ( i < a - 1 )
{
if ( dp[ i + 1 ][j] != inf )
{
dp[ i + 1 ][j] += dp[i][j] ;
}
}
if ( j < b - 1 )
{
if ( dp[i][ j + 1 ] != inf )
{
dp[i][ j + 1 ] += dp[i][j] ;
}
}
}
}
return dp[ a - 1 ][ b - 1 ] ;
}
int main()
{
while (1)
{
cin >> a >> b ;
if ( !a && !b ) break ;
cin >> n ;
for ( int i = 0 ; i < n ; i++ )
{
int x, y ;
cin >> x >> y ;
construct.push_back( pii(x,y) ) ;
}
printf("%d\n", solve()) ;
}
return 0 ;
} | a.cc:2:9: fatal error: windows.h: No such file or directory
2 | #include<windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s471206796 | p00438 | C++ | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define MOD (1000000007ll)
#define l_ength size
#define PI 3.14159265358979
void mul_mod(ll& a, ll b){
a *= b;
a %= MOD;
}
void add_mod(ll& a, ll b){
b += MOD;
a += b;
a %= MOD;
}
int main(void){
int a,b,n,x,y,i,j
ll dp[20][20];
bool cst[20][20];
cin >> a >> b;
while(a || b){
fill(cst[0],cst[20],false);
cin >> n;
for(i=0; i<n; ++i){
cin >> x >> y;
--x; --y;
cst[x][y] = true;
}
for(i=0; i<a; ++i){
for(j=0; j<b; ++j){
if(cst[i][j]){
dp[i][j] = 0ll;
}else if(!(i && j)){
dp[i][j] = 1ll;
}else{
dp[i][j] = dp[i-1][j] + dp[i][j-1];
}
}
}
cout << dp[a-1][b-1] << endl;
cin >> a >> b;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:5: error: expected initializer before 'll'
25 | ll dp[20][20];
| ^~
a.cc:37:17: error: 'j' was not declared in this scope
37 | for(j=0; j<b; ++j){
| ^
a.cc:39:21: error: 'dp' was not declared in this scope; did you mean 'dup'?
39 | dp[i][j] = 0ll;
| ^~
| dup
a.cc:41:21: error: 'dp' was not declared in this scope; did you mean 'dup'?
41 | dp[i][j] = 1ll;
| ^~
| dup
a.cc:43:21: error: 'dp' was not declared in this scope; did you mean 'dup'?
43 | dp[i][j] = dp[i-1][j] + dp[i][j-1];
| ^~
| dup
a.cc:47:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
47 | cout << dp[a-1][b-1] << endl;
| ^~
| dup
|
s204469890 | p00438 | C++ | #include<stdio.h>
int a,b,cnt,flg[20][20],x,y;
int main(void)
{
int n,i;
while(1){
scanf("%d%d",&a,&b);
if(a==0&&b==0) break;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%d",&x,&y);
flg[x][y]=1;
}
cnt=0;
func(1,1);
printf("%d\n",cnt);
}
return 0;
}
int func(int x1,int y1){
// printf("x1=%d y1=%d\n",x1,y1);
if(x1==a&&y1==b) cnt++;
else if(x1<=a&&y1<=b){
if(flg[x1+1][y1]!=1&&x1+1<=a) func(x1+1,y1);
if(flg[x1][y1+1]!=1&&y1+1<=b) func(x1,y1+1);
}
}
| a.cc: In function 'int main()':
a.cc:15:17: error: 'func' was not declared in this scope
15 | func(1,1);
| ^~~~
a.cc: In function 'int func(int, int)':
a.cc:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
27 | }
| ^
|
s358088032 | p00438 | C++ | #include<stdio.h>
int a,b,cnt,flg[20][20],x,y;
int main(void)
{
int n,i;
while(1){
scanf("%d%d",&a,&b);
if(a==0&&b==0) break;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%d",&x,&y);
flg[x][y]=1;
}
cnt=0;
func(1,1);
printf("%d\n",cnt);
}
return 0;
}
int func(int x1,int y1){
if(x1==a&&y1==b) cnt++;
else if(x1<=a&&y1<=b){
if(flg[x1+1][y1]!=1&&x1+1<=a) func(x1+1,y1);
if(flg[x1][y1+1]!=1&&y1+1<=b) func(x1,y1+1);
}
}
| a.cc: In function 'int main()':
a.cc:15:17: error: 'func' was not declared in this scope
15 | func(1,1);
| ^~~~
a.cc: In function 'int func(int, int)':
a.cc:26:1: warning: no return statement in function returning non-void [-Wreturn-type]
26 | }
| ^
|
s744070990 | p00438 | C++ | #include<stdio.h>
int a,b,cnt,flg[20][20],x,y;
int main(void)
{
int n,i,j;
while(1){
scanf("%d%d",&a,&b);
if(a==0&&b==0) break;
scanf("%d",&n);
for(i=0;i<a;i++){
for(j=0;j<b;j++) flg[i][j]=0;
}
for(i=0;i<n;i++){
scanf("%d%d",&x,&y);
flg[x][y]=1;
}
cnt=0;
func(1,1);
printf("%d\n",cnt);
}
return 0;
}
int func(int x1,int y1){
// printf("x1=%d y1=%d\n",x1,y1);
if(x1==a&&y1==b) cnt++;
else if(x1<=a&&y1<=b){
if(flg[x1+1][y1]!=1&&x1+1<=a) func(x1+1,y1);
if(flg[x1][y1+1]!=1&&y1+1<=b) func(x1,y1+1);
}
}
| a.cc: In function 'int main()':
a.cc:18:17: error: 'func' was not declared in this scope
18 | func(1,1);
| ^~~~
a.cc: In function 'int func(int, int)':
a.cc:30:1: warning: no return statement in function returning non-void [-Wreturn-type]
30 | }
| ^
|
s370983596 | p00438 | C++ | #include<stdio.h>
int a,b,cnt,flg[50][50],x,y;
int main(void)
{
int n,i,j;
while(1){
scanf("%d%d",&a,&b);
if(a==0&&b==0) break;
scanf("%d",&n);
for(i=0;i<a;i++){
for(j=0;j<b;j++) flg[i][j]=0;
}
for(i=0;i<n;i++){
scanf("%d%d",&x,&y);
flg[x][y]=1;
}
cnt=0;
func(1,1);
printf("%d\n",cnt);
}
return 0;
}
int func(int x1,int y1){
// printf("x1=%d y1=%d\n",x1,y1);
if(x1==a&&y1==b) cnt++;
else if(x1<=a&&y1<=b){
if(flg[x1+1][y1]!=1&&x1+1<=a) func(x1+1,y1);
if(flg[x1][y1+1]!=1&&y1+1<=b) func(x1,y1+1);
}
}
| a.cc: In function 'int main()':
a.cc:18:17: error: 'func' was not declared in this scope
18 | func(1,1);
| ^~~~
a.cc: In function 'int func(int, int)':
a.cc:30:1: warning: no return statement in function returning non-void [-Wreturn-type]
30 | }
| ^
|
s330435927 | p00438 | C++ | #include<stdio.h>
int a,b,cnt,flg[50][50],x,y;
int main(void)
{
int n,i,j;
while(1){
scanf("%d%d",&a,&b);
if(a==0&&b==0) break;
scanf("%d",&n);
for(i=0;i<a;i++){
for(j=0;j<b;j++) flg[i][j]=0;
}
for(i=0;i<n;i++){
scanf("%d%d",&x,&y);
flg[x][y]=1;
}
cnt=0;
func(1,1);
printf("%d\n",cnt);
}
return 0;
}
int func(int x1,int y1){
// printf("x1=%d y1=%d\n",x1,y1);
if(x1==a&&y1==b) cnt++;
else if(x1<=a&&y1<=b){
if(flg[x1+1][y1]!=1&&x1+1<=a) func(x1+1,y1);
if(flg[x1][y1+1]!=1&&y1+1<=b) func(x1,y1+1);
}
}
| a.cc: In function 'int main()':
a.cc:18:17: error: 'func' was not declared in this scope
18 | func(1,1);
| ^~~~
a.cc: In function 'int func(int, int)':
a.cc:30:1: warning: no return statement in function returning non-void [-Wreturn-type]
30 | }
| ^
|
s845079264 | p00438 | C++ | #include<stdio.h>
int a,b,cnt,flg[50][50],x,y;
int main(void)
{
int n,i,j;
while(1){
scanf("%d%d",&a,&b);
if(a==0&&b==0) break;
scanf("%d",&n);
for(i=0;i<a;i++){
for(j=0;j<b;j++) flg[i][j]=0;
}
for(i=0;i<n;i++){
scanf("%d%d",&x,&y);
flg[x][y]=1;
}
cnt=0;
func(1,1);
printf("%d\n",cnt);
}
return 0;
}
int func(int x1,int y1){
// printf("x1=%d y1=%d\n",x1,y1);
if(x1==a&&y1==b) cnt++;
else if(x1<=a&&y1<=b){
if(flg[x1+1][y1]!=1&&x1+1<=a) func(x1+1,y1);
if(flg[x1][y1+1]!=1&&y1+1<=b) func(x1,y1+1);
}
}
| a.cc: In function 'int main()':
a.cc:18:17: error: 'func' was not declared in this scope
18 | func(1,1);
| ^~~~
a.cc: In function 'int func(int, int)':
a.cc:30:1: warning: no return statement in function returning non-void [-Wreturn-type]
30 | }
| ^
|
s775282258 | p00438 | C++ | #include<stdio.h>
int a,b,cnt,flg[50][50],x,y;
int main(void)
{
int n,i,j;
while(1){
scanf("%d%d",&a,&b);
if(a==0&&b==0) break;
scanf("%d",&n);
for(i=0;i<a;i++){
for(j=0;j<b;j++) flg[i][j]=0;
}
for(i=0;i<n;i++){
scanf("%d%d",&x,&y);
flg[x][y]=1;
}
cnt=0;
func(1,1);
printf("%d\n",cnt);
}
return 0;
}
int func(int x1,int y1){
// printf("x1=%d y1=%d\n",x1,y1);
if(x1==a&&y1==b) cnt++;
else if(x1<=a&&y1<=b){
if(flg[x1+1][y1]!=1&&x1+1<=a) func(x1+1,y1);
if(flg[x1][y1+1]!=1&&y1+1<=b) func(x1,y1+1);
}
}
| a.cc: In function 'int main()':
a.cc:18:17: error: 'func' was not declared in this scope
18 | func(1,1);
| ^~~~
a.cc: In function 'int func(int, int)':
a.cc:30:1: warning: no return statement in function returning non-void [-Wreturn-type]
30 | }
| ^
|
s506000692 | p00438 | C++ | #include <iostream>
#include <vector>
int main(){
int a,b;
while(std::cin >> a >> b){
if(a==0&&b==0) break;
std::cin >> int n;
std::vector<std::vector<int>> map(a,vector<int>(b,1)); //地図
for(int i=0;i<n;++i){
std::cin >> int x >> int y;
map[x][y]=0;
}
for(int i=1;i<a;++i){
for(int j=1;j<b;++j){
if(map[i][j]>0){
map[i][j] = map[i-1][j]+map[i][j-1];
}
}
}
std::cout << map[a][b] << std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:29: error: expected primary-expression before 'int'
9 | std::cin >> int n;
| ^~~
a.cc:10:53: error: 'vector' was not declared in this scope
10 | std::vector<std::vector<int>> map(a,vector<int>(b,1)); //地図
| ^~~~~~
a.cc:10:53: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:10:60: error: expected primary-expression before 'int'
10 | std::vector<std::vector<int>> map(a,vector<int>(b,1)); //地図
| ^~~
a.cc:12:31: error: 'n' was not declared in this scope
12 | for(int i=0;i<n;++i){
| ^
a.cc:13:37: error: expected primary-expression before 'int'
13 | std::cin >> int x >> int y;
| ^~~
a.cc:14:29: error: 'x' was not declared in this scope
14 | map[x][y]=0;
| ^
a.cc:14:32: error: 'y' was not declared in this scope
14 | map[x][y]=0;
| ^
|
s240963658 | p00438 | C++ | #include <iostream>
#include <vector>
int main(){
int a,b;
while(std::cin >> a >> b){
if(a==0&&b==0) break;
std::cin >> int n;
std::vector<std::vector<int>> map(a,std::vector<int>(b,1)); //地図
for(int i=0;i<n;++i){
std::cin >> int x >> int y;
map[x][y]=0;
}
for(int i=1;i<a;++i){
for(int j=1;j<b;++j){
if(map[i][j]>0){
map[i][j] = map[i-1][j]+map[i][j-1];
}
}
}
std::cout << map[a][b] << std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:29: error: expected primary-expression before 'int'
9 | std::cin >> int n;
| ^~~
a.cc:12:31: error: 'n' was not declared in this scope
12 | for(int i=0;i<n;++i){
| ^
a.cc:13:37: error: expected primary-expression before 'int'
13 | std::cin >> int x >> int y;
| ^~~
a.cc:14:29: error: 'x' was not declared in this scope
14 | map[x][y]=0;
| ^
a.cc:14:32: error: 'y' was not declared in this scope
14 | map[x][y]=0;
| ^
|
s576529991 | p00438 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
int n,m,i,j,k,xmax;
while(1){
xmax=0;
cin >> n >> m;
if(n == 1 && m ==1){
cout << 1 << end;
continue;
}
if(n == 0 && m == 0)break;
int MP[m+1][n+1];
for(i=1;i<=m;i++){
for(j=1;j<=n;j++){
if(i == 1 || j == 1){
MP[i][j]=1;
}else{
MP[i][j]=-1;
}
}
}
cin >> k;
int No[k+1][2];
for(i=0;i<k;i++){
cin >>No[i][0] >> No[i][1];
MP[No[i][1]][No[i][0]]=0;
}
for(i=2;i<=m;i++){
for(j=2;j<=n;j++){
if(MP[i][j] == 0)continue;
else{
MP[i][j]=MP[i-1][j]+MP[i][j-1];
xmax=max(xmax,MP[i][j]);
}
}
}
/**/
for(i=1;i<=m;i++){
for(j=1;j<=n;j++)cout << MP[i][j] << "**" ;
cout << endl;
}
/**/
cout << xmax << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:17: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
12 | cout << 1 << end;
| ~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
306 | operator<<(nullptr_t)
| ^~~~~~~~
/usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
| |
s912205589 | p00438 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int a;
int b;
int n;
int d;
int e;
int f;
int g;
while(cin >>a){
cin >> b;
if(a==0){break;}
cin >> n;
int c[a][b];
d=0;
while(d<a){
g=0;
while(g<b){
c[d][g]=-1;
g=g+1;}
d=d+1;}
d=0;
while(d<n){
cin >>e;
cin >>f;
c[e-1][f-1]=0;
d=d+1;}
c[0][0]=1;
d=1;
while(d<a){
if(c[d][0]!=0){c[d][0]=c[d-1][0]}
d=d+1;}
d=1;
while(d<b){
if(c[0][d]!=0){c[0][d]=c[0][d-1]}
d=d+1;}
d=1;
while(d<a){
g=1;
while(g<b){
if(c[d][g]!=0){c[d][g]=c[d-1][g]+c[d][g-1];}
g=g+1;}
d=d+1;}
cout <<c[a-1][b-1]<<endl;}} | a.cc: In function 'int main()':
a.cc:33:33: error: expected ';' before '}' token
33 | if(c[d][0]!=0){c[d][0]=c[d-1][0]}
| ^
| ;
a.cc:37:33: error: expected ';' before '}' token
37 | if(c[0][d]!=0){c[0][d]=c[0][d-1]}
| ^
| ;
|
s548224007 | p00438 | C++ | #include<cstdio>
#include<iostream>
using namespace std;
int main(){
int a,b;
int cnt=0;
intm[16]={0};
while(scanf("%d%d",&a,&b),a,b){
int ro[32][32]={{0}};
ro[0][1]=1;
int n;
scanf("%d",&n);
int x,y;
for(int i=0;i<n;i++){
scanf("%d%d",&x,&y);
ro[y][x]=1;
}
for(int i=1;i<=b;i++){
for(int j=1;j<=a;j++){
if(ro[i][j]==1)ro[i][j]=0;
else ro[i][j]=(ro[i-1][j]+ro[i][j-1]);
}
}
m[cnt]=ro[b][a];
cnt++;
}
for(int i=0;i<cnt;i++){
printf("%d\n",m[i]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:5: error: 'intm' was not declared in this scope; did you mean 'int'?
8 | intm[16]={0};
| ^~~~
| int
a.cc:25:9: error: 'm' was not declared in this scope
25 | m[cnt]=ro[b][a];
| ^
a.cc:29:23: error: 'm' was not declared in this scope
29 | printf("%d\n",m[i]);
| ^
|
s949191898 | p00438 | C++ | #include<iostream>
using namespace std;
int main(){
whie(1){
int a,b,n,x,y,dp[18][18];
bool c[18][18];
for(int i=0;i<18;i++)for(int j=0;j<18;j++){dp[i][j]=0; c[i][j]=true;}
scanf("%d%d",&a,&b);
if(a==0&&b==0)break;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d%d",&x,&y);
c[x][y]=false;
}
dp[1][1]=1;
for(int i=1;i<a+1;i++)for(int j=1;j<b+1;j++){
if(c[i][j]&&!(i==1&&j==1)){
dp[i][j]=dp[i-1][j]+dp[i][j-1];
}
}
printf("%d\n",dp[a][b]);
}
} | a.cc: In function 'int main()':
a.cc:5:1: error: 'whie' was not declared in this scope
5 | whie(1){
| ^~~~
|
s471538149 | p00438 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int a,b;
while(cin>>a>>b,a)
{
int dp[b+1][a+1];
memset(dp,0,sizeof(dp));
dp[1][1]=1;
int n; cin>>n;
bool flag[b+1][a+1];
memset(flag,0,sizeof(flag));
for(int i = 0; i < n; ++i)
{
int s,t; cin>>s>>t;
flag[t][s]=true;
}
for(int i = 1; i <= b; ++i)
{
for(int j = 1; j <= a; ++j)
{
if(flag[i][j]) continue;
if(0<=i-1) dp[i][j]+=dp[i-1][j];
if(0<=j-1) dp[i][j]+=dp[i][j-1];
}
}
cout<<dp[b][a]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:17: error: 'memset' was not declared in this scope
10 | memset(dp,0,sizeof(dp));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<algorithm>
+++ |+#include <cstring>
3 | using namespace std;
|
s831645680 | p00438 | C++ | #include<iostream>
#include<string>
#include<vector>
using namespace std;
int FindRoad(const vector<vector<int> >& road, int x, int y);
int h,w;
int n;
int dummy = 0;
int result = 0;
int main(void) {
int x,y;
vector<vector<int> > road(18,vector<int>(18));
cin >> w >> h;
while(w != 0 && h != 0) {
cin >> n;
for(int i = 0; i < n; i++) {
cin >> x >> y;
road[x][y] = 1;
}
cout << FindRoad(road,1,1) << endl;
for(int x = 0; x < 18; x++) {
for(int y = 0; y < 18; y++) {
if(road[x][y] == 1)
road[x][y] = 0;
}
}
result = 0;
cin >> w >> h;
}
return 0;
}
int FindRoad(const vector<vector<int> >& road, int x, int y) {
if( (x - 1 == w || y - 1 == h) || road[x][y] == 1) return 0;
if( x == w && y == h) { result++; return; }
dummy = FindRoad( road, x, y + 1);
dummy = FindRoad( road, x + 1, y);
return result;
} | a.cc: In function 'int FindRoad(const std::vector<std::vector<int> >&, int, int)':
a.cc:39:37: error: return-statement with no value, in function returning 'int' [-fpermissive]
39 | if( x == w && y == h) { result++; return; }
| ^~~~~~
|
s497932148 | p00438 | C++ | /* AOJ 0515 School Road */
#include <iostream>
using namespace std;
const int MAX_A = 16;
const int MAX_B = 16;
int n_routes[MAX_A + 1][MAX_B + 1];
bool closed[MAX_A + 1][MAX_B + 1];
int a, b;
void setup();
void solve();
int
main()
{
for (;;) {
cin >> a >> b;
if (a == 0 && b == 0) break;
setup();
solve();
}
return 0;
}
void
setup()
{
int n_closed;
memset(n_routes, 0, sizeof n_routes);
memset(closed, 0, sizeof closed);
cin >> n_closed;
while (n_closed--) {
int i, j;
cin >> i >> j;
closed[i][j] = true;
}
}
void
solve()
{
int i, j;
for (i = 1; i <= a; i++) {
for (j = 1; j <= b; j++) {
if (i == 1 && j == 1) {
n_routes[i][j] = 1;
continue;
}
if (closed[i][j]) continue;
n_routes[i][j] = n_routes[i - 1][j] + n_routes[i][j - 1];
}
}
cout << n_routes[a][b] << endl;
} | a.cc: In function 'void setup()':
a.cc:37:5: error: 'memset' was not declared in this scope
37 | memset(n_routes, 0, sizeof n_routes);
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <iostream>
+++ |+#include <cstring>
4 |
|
s724758887 | p00438 | C++ | #include<iostream>
#include<queue>
#include<map>
using namespace std;
int mas[1000][1000];
int x[2]={1,0},y[2]={0,1};
typedef pair<int,int>P;
int road(int,int);
int main(){
int h,w,cnt,n,x,y;
while(1){
cin >> h >> w;
if(h==0 && w==0){
break;
}
cin >> n;
memset(mas,0,sizeof(mas));
for(int i=0;i<n;i++){
cin >> y >> x;
mas[y][x]=56;
}
mas[h-1][w-1]=100;
cnt=road(h,w);
cnt++;
cout << cnt << endl;
}
}
int road(int h,int w){
queue<P>que;
int cnt=0;
que.push(P(0,0));
while(!que.empty()){
P p=que.front();
que.pop();
//if(
for(int i=0;i<2;i++){
int H = p.first+x[i];
int W = p.second+y[i];
if(H>=0 && H<h && W>=0 && W<w && mas[H][W]==0){
que.push(P(H,W));
}
if(mas[H][W]==100){
cnt++;
}
}
}
return (cnt);
} | a.cc: In function 'int main()':
a.cc:18:5: error: 'memset' was not declared in this scope
18 | memset(mas,0,sizeof(mas));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<map>
+++ |+#include <cstring>
4 | using namespace std;
|
s480301168 | p00438 | C++ |
#include<iostream>
using namespace std;
int construct[17][17], dp[17][17], W, H, N;
int main()
{
loop:
cin >> W >> H;
if(!W | a.cc: In function 'int main()':
a.cc:10:8: error: expected ')' at end of input
10 | if(!W
| ~ ^
| )
a.cc:10:8: error: expected statement at end of input
a.cc:10:8: error: expected '}' at end of input
a.cc:7:1: note: to match this '{'
7 | {
| ^
|
s907281792 | p00438 | C++ | import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//while(true){
int w = sc.nextInt();
int h = sc.nextInt();
//if(w==0&&h==0)break;
int n = sc.nextInt();
boolean map[][]=new boolean[w+1][h+1];
for(int i=0;i<n;i++)map[sc.nextInt()][sc.nextInt()]=true;
//今いる場所を記録
int dp[][]=new int[w+1][h+1];
//for(int i=2;i<=w;i++)dp[i][1]=1;
//for(int i=2;i<=h;i++)dp[1][i]=1;
dp[1][1]=1;
for(int i=1;i<=w;i++){
for(int j=1;j<=h;j++){
// if(map[i][j])
// dp[i][j]=0;
if(map[i][j]){
dp[i][j]=0;
}else if(i==1&&j==1){
dp[i][j]=1;
}else if(i==1){
dp[i][j]=dp[i][j-1];
}else if(j==1){
dp[i][j]=dp[i-1][j];
}else{
dp[i][j]=dp[i][j-1]+dp[i-1][j];
}
//System.out.println(i+""+j+" "+dp[i][j-1]+" "+dp[i-1][j]+" "+dp[i][j]);
}
}
System.out.println(dp[w][h]);
}
//}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
2 | public class Main{
| ^~~~~~
|
s732890978 | p00438 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <map>
//#include <fstream>
int count_course(const u_int a, const u_int b, const std::map<u_int, std::vector<u_int>> &point)
{
auto it = point.find(a);
if(it != point.end()){
std::vector<u_int> vec = it -> second;
if((std::find(vec.begin(), vec.end(), b)) != vec.end()){
return 0;
}
}
if(a == 1 && b == 1){
return 1;
}
else if(a == 1){
return count_course(a, b - 1, point);
}
else if(b == 1){
return count_course(a - 1, b, point);
}
else{
return count_course(a - 1, b, point) + count_course(a, b - 1, point);
}
}
int main()
{
u_int a, b, n, x, y;
//std::ifstream ifs("--.txt");
while(1){
u_int m = 0;
std::cin /*ifs*/ >> a >> b;
if(a == 0 && b == 0)
break;
std::map<u_int, std::vector<u_int>> point;
std::cin /*ifs*/ >> n;
for(u_int i = 0; i < n; ++i){
std::cin /*ifs*/ >> x >> y;
point[x].push_back(y);
}
m += get_course(a, b, point);
std::cout << m << std::endl;
}
//ifs.close();
return 0;
} | a.cc: In function 'int main()':
a.cc:47:14: error: 'get_course' was not declared in this scope; did you mean 'count_course'?
47 | m += get_course(a, b, point);
| ^~~~~~~~~~
| count_course
|
s084597490 | p00438 | C++ | #include <iostream>
#include <array>
//#include <fstream>
int main()
{
const u_int max_point = 16;
u_int a, b, n, x, y;
std::ifstream ifs("515.txt");
while(1){
std::cin /*ifs*/ >> a >> b;
if(a == 0 && b == 0)
break;
std::array<std::array<u_int, max_point>, max_point> point, count;
for(u_int i = 0; i < max_point; ++i){
count[i].fill(0);
point[i].fill(0);
}
std::cin /*ifs*/ >> n;
for(u_int i = 0; i < n; ++i){
std::cin /*ifs*/ >> x >> y;
point[x - 1][y - 1] = 1;
}
count[0][0] = 1;
for(u_int i = 0; i < a; ++i){
for(u_int j = 0; j < b; ++j){
if(point[i][j] != 1){
if(i ==0 && j == 0){
count[i][j] = 1;
}
else if(i == 0){
count[i][j] = count[i][j - 1];
}
else if(j == 0){
count[i][j] = count[i - 1][j];
}
else{
count[i][j] = count[i - 1][j] + count[i][j - 1];
}
}
}
}
std::cout << count[a - 1][b - 1] << std::endl;
}
//ifs.close();
return 0;
} | a.cc: In function 'int main()':
a.cc:9:22: error: variable 'std::ifstream ifs' has initializer but incomplete type
9 | std::ifstream ifs("515.txt");
| ^
a.cc:3:1: note: 'std::ifstream' is defined in header '<fstream>'; this is probably fixable by adding '#include <fstream>'
2 | #include <array>
+++ |+#include <fstream>
3 | //#include <fstream>
|
s198014493 | p00438 | C++ | #include <iostream>
#include <vector>
/*動的計画法で解く*/
int main(){
//入力1行目
int a, b;
std::cin >> a >> b;
//入力2行目
int n;
std::cin >> n;
//二次元のベクタ用意(a*b) dpはパターン数をいれる 1で初期化しておく(結局上書き)
std::vector<std::vector<int> > dp(a, std::vector<int>(b, 1));
//工事中の点に0をいれる
int x, y;
for(int i = 0; i < n; ++i){
std::cin >> x >> y;
dp[x - 1][y - 1] = 0;
}
//求める処理 現在の点は左の点と下の点を足す
for(int i = 1; i < a; ++i){
for(int j = 1; j < b; ++j){
if(dp[i][j] != 0){
dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
}
}
}
std::cout << dp[a - 1][b - 1] << std::endl;
} | a.cc:13:37: error: extended character is not valid in an identifier
13 | std::vector<std::vector<int> > dp(a, std::vector<int>(b, 1));
| ^
a.cc: In function 'int main()':
a.cc:13:39: error: template argument 1 is invalid
13 | std::vector<std::vector<int> > dp(a, std::vector<int>(b, 1));
| ^
a.cc:13:39: error: template argument 2 is invalid
a.cc:13:69: error: expression list treated as compound expression in initializer [-fpermissive]
13 | std::vector<std::vector<int> > dp(a, std::vector<int>(b, 1));
| ^
a.cc:13:52: error: cannot convert 'std::vector<int>' to 'int' in initialization
13 | std::vector<std::vector<int> > dp(a, std::vector<int>(b, 1));
| ^~~~~~~~~~~~~~~~~
| |
| std::vector<int>
a.cc:18:19: error: invalid types 'int[int]' for array subscript
18 | dp[x - 1][y - 1] = 0;
| ^
a.cc:23:30: error: invalid types 'int[int]' for array subscript
23 | if(dp[i][j] != 0){
| ^
a.cc:24:35: error: invalid types 'int[int]' for array subscript
24 | dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
| ^
a.cc:24:46: error: invalid types 'int[int]' for array subscript
24 | dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
| ^
a.cc:24:61: error: invalid types 'int[int]' for array subscript
24 | dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
| ^
a.cc:28:24: error: invalid types 'int[int]' for array subscript
28 | std::cout << dp[a - 1][b - 1] << std::endl;
| ^
|
s875206961 | p00438 | C++ | #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#define loop(lp) for(int lp2 = 0; lp2 < lp; lp2 ++)
#define ascent(i, a, b) for(int i = a; i < b; i ++)
#define pb push_back
//#define pair<int, int> ii
using namespace std;
int dp[20][20];
int main() {
int a, b;
cin >> a >> b;
int n;
cin >> n;
vector<pair<int, int> > acc;
loop(n) {
int x, y;
cin >> x >> y;
acc.pb(make_pair(x, y));
}
memset(dp, 0, sizeof(dp));
dp[1][1] = 1;
ascent(x, 1, a+1) {
ascent(y, 1, b+1) {
bool flg = true;
ascent(i, 0, n) {
if(x == acc[i].first && y == acc[i].second) {
dp[x][y] = 0;
flg = !flg;
break;
}
}
if(flg) {
if(x == 1 && y == 1) { continue; }
else if(x == 1) {
dp[x][y] = dp[x][y-1];
}
else if(y == 1) {
dp[x][y] = dp[x-1][y];
}
else {
dp[x][y] = dp[x-1][y] + dp[x][y-1];
}
}
}
}
cout << dp[a][b] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:34:9: error: 'memset' was not declared in this scope
34 | memset(dp, 0, sizeof(dp));
| ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include <map>
+++ |+#include <cstring>
7 | #include <string>
|
s938853353 | p00438 | C++ | #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#define loop(lp) for(int lp2 = 0; lp2 < lp; lp2 ++)
#define ascent(i, a, b) for(int i = a; i < b; i ++)
#define pb push_back
//#define pair<int, int> ii
using namespace std;
int dp[200][200];
int main() {
int a, b;
cin >> a >> b;
int n;
cin >> n;
vector<pair<int, int> > acc;
loop(n) {
int x, y;
cin >> x >> y;
acc.pb(make_pair(x, y));
}
memset(dp, 0, sizeof(dp));
dp[1][1] = 1;
ascent(x, 1, a+1) {
ascent(y, 1, b+1) {
bool flg = true;
ascent(i, 0, n) {
if(x == acc[i].first && y == acc[i].second) {
dp[x][y] = 0;
flg = !flg;
break;
}
}
if(flg) {
if(x == 1 && y == 1) { continue; }
else if(x == 1) {
dp[x][y] = dp[x][y-1];
}
else if(y == 1) {
dp[x][y] = dp[x-1][y];
}
else {
dp[x][y] = dp[x-1][y] + dp[x][y-1];
}
}
}
}
cout << dp[a][b] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:34:9: error: 'memset' was not declared in this scope
34 | memset(dp, 0, sizeof(dp));
| ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include <map>
+++ |+#include <cstring>
7 | #include <string>
|
s019028476 | p00438 | C++ | #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#define loop(lp) for(int lp2 = 0; lp2 < lp; lp2 ++)
#define ascent(i, a, b) for(int i = a; i < b; i ++)
#define pb push_back
using namespace std;
int dp[200][200];
int main() {
int a, b;
cin >> a >> b;
int n;
cin >> n;
vector<pair<int, int> > acc;
loop(n) {
int x, y;
cin >> x >> y;
acc.pb(make_pair(x, y));
}
memset(dp, 0, sizeof(dp));
dp[1][1] = 1;
ascent(x, 1, a+1) {
ascent(y, 1, b+1) {
bool flg = true;
ascent(i, 0, n) {
if(x == acc[i].first && y == acc[i].second) {
dp[x][y] = 0;
flg = !flg;
break;
}
}
if(flg) {
if(x == 1 && y == 1) { continue; }
else if(x == 1) {
dp[x][y] = dp[x][y-1];
}
else if(y == 1) {
dp[x][y] = dp[x-1][y];
}
else {
dp[x][y] = dp[x-1][y] + dp[x][y-1];
}
}
}
}
cout << dp[a][b] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:32:9: error: 'memset' was not declared in this scope
32 | memset(dp, 0, sizeof(dp));
| ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include <map>
+++ |+#include <cstring>
7 | #include <string>
|
s419456485 | p00439 | Java | n,k = map(int,input().split())
a = [int(input()) for i in range(n)]
unko = [0]
for i in range(n):
unko.append(unko[i]+a[i])
inf = float("inf")*(-1)
mvl = inf
for i in range(n-k+1):
if unko[i+k]-unko[i] >= mvl:
mvl = unko[i+k]-unko[i]
print(mvl)
| Main.java:1: error: class, interface, enum, or record expected
n,k = map(int,input().split())
^
1 error
|
s484611594 | p00439 | Java |
public class Main {
public static class BIT {
int[] dat;
public BIT(int n){
dat = new int[n + 1];
}
public void add(int k, int a){ // k : 0-indexed
for(int i = k + 1; i < dat.length; i += i & -i){
dat[i] += a;
}
}
public int sum(int s, int t){ // [s, t)
if(s > 0) return sum(0, t) - sum(0, s);
int ret = 0;
for(int i = t; i > 0; i -= i & -i) {
ret += dat[i];
}
return ret;
}
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(true){
final int n = sc.nextInt();
final int k = sc.nextInt();
if(n == 0 && k == 0){
break;
}
BIT bit = new BIT(n);
for(int i = 0; i < n; i++){
bit.add(i, sc.nextInt());
}
int max = Integer.MIN_VALUE;
for(int start = 0; start < n - k + 1; start++){
max = Math.max(max, bit.sum(start, start + k));
//System.out.println("[" + start + " " + (start + k) + ") = " + bit.sum(start, start + k));
}
System.out.println(max);
}
}
} | Main.java:29: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:29: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s102773721 | p00439 | Java | #include<stdio.h>
#include<iostream>
#include<math.h>
#include<chrono>
#include<string>
using namespace std;
int main() {
int nsize;
int ksize;
int a[100000];
while (true) {
cin >> nsize >> ksize;
if (nsize == 0 && ksize == 0)break;
for (int i = 0; i < nsize; i++) {
cin >> a[i];
}
int maxval;
int val = 0;
for (int i = 0; i < ksize; i++) {
val += a[i];
}
maxval = val;
for (int i = ksize; i < nsize; i++) {
val -= a[i - ksize];
val += a[i];
if (maxval < val) {
maxval = val;
}
}
cout << maxval << endl;
}
//system("pause");
return 0;
}
| Main.java:1: error: illegal character: '#'
#include<stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<stdio.h>
^
Main.java:2: error: illegal character: '#'
#include<iostream>
^
Main.java:3: error: illegal character: '#'
#include<math.h>
^
Main.java:4: error: illegal character: '#'
#include<chrono>
^
Main.java:5: error: illegal character: '#'
#include<string>
^
Main.java:23: error: not a statement
cin >> nsize >> ksize;
^
Main.java:26: error: not a statement
cin >> a[i];
^
Main.java:42: error: not a statement
cout << maxval << endl;
^
Main.java:14: error: unnamed classes are a preview feature and are disabled by default.
int main() {
^
(use --enable-preview to enable unnamed classes)
Main.java:19: error: ']' expected
int a[100000];
^
11 errors
|
s527513194 | p00439 | C | #include<stdio.h>
int main(){
int n,k;
int i,j,u[5],v=0;
int a[100000],sum=0,x=0;
while(scanf("%d%d",&n,&k),n!=0 && k!=0){
for(i=0;i<n;i++) scanf("%d",&a[i]);
for(i=0;i<n-k+1;i++){
for(j=0;j<k;j++) sum+=a[j]:
if(sum>w) w=sum;
}
u[v]=w,v++;
sum=0;
}
for(i=0;i<v;i++) printf("%d\n",u[i]);
return 0;
}
| main.c: In function 'main':
main.c:9:51: error: expected ';' before ':' token
9 | for(j=0;j<k;j++) sum+=a[j]:
| ^
| ;
main.c:12:22: error: 'w' undeclared (first use in this function)
12 | u[v]=w,v++;
| ^
main.c:12:22: note: each undeclared identifier is reported only once for each function it appears in
|
s303814815 | p00439 | C | #include<stdio.h>
int main(){
int n,k;
int i,j,u[5],v=0;
int a[100000],sum=0,x=0;
while(scanf("%d%d",&n,&k),n!=0 && k!=0){
for(i=0;i<n;i++) scanf("%d",&a[i]);
for(i=0;i<n-k+1;i++){
for(j=0;j<k;j++) sum+=a[j]:
if(sum>w) w=sum;
sum=0;
}
u[v]=w,v++;
}
for(i=0;i<v;i++) printf("%d\n",u[i]);
return 0;
}
| main.c: In function 'main':
main.c:9:51: error: expected ';' before ':' token
9 | for(j=0;j<k;j++) sum+=a[j]:
| ^
| ;
main.c:13:22: error: 'w' undeclared (first use in this function)
13 | u[v]=w,v++;
| ^
main.c:13:22: note: each undeclared identifier is reported only once for each function it appears in
|
s511828544 | p00439 | C | #include<stdio.h>
int main()
{
int n,k,i,sum,max;
int a[100000];
while(scanf("%d%d",&n,&k),n+k){
max=0;
for(i=0;i<n;i++) scanf("%d",&a[i]);
for(i=0;i<n-k;i++){
sum=0;
for(j=i;j<i+k;j++){
sum+=a[j];
if(max<sum) max=sum;
}
}
printf("%d\n",max);
return 0;
} | main.c: In function 'main':
main.c:15:17: error: 'j' undeclared (first use in this function)
15 | for(j=i;j<i+k;j++){
| ^
main.c:15:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:1: error: expected declaration or statement at end of input
23 | }
| ^
|
s676334099 | p00439 | C | #include <stdio.h>
#include <stdlib.h>
#define INFILE "input.txt"
#define???OUTFILE "output.txt"
signed int a[100000],ans;
unsigned int n,k;
FILE*fp,*fq;
void solve(void){
int i,diff;
ans = 0;
for(i = 0;i < k;i++)ans += a[i];
diff = 0;
while(i < n){
diff += a[i];
diff -= a[i - k];
if(diff > 0){
ans += diff;
diff = 0;
}
i++;
}
return;
}
int inp(void){
int i;
fscanf("%d%d",&n,&k);
if(!n)return 0;
for(i = 0;i < n;i++)scanf("%d",a+i);
return 1;
}
void oup(void){
fprintf(fq,"%d\n",ans);
return;
}
int main(void){
fp = fopen(INFILE,"r");
fq = fopen(OUTFILE,"w");
while(inp()){
solve();
oup();
}
fclose(fp);
fclose(fq);
return 0;
} | main.c:4:8: error: macro names must be identifiers
4 | #define???OUTFILE "output.txt"
| ^
main.c: In function 'inp':
main.c:29:16: error: passing argument 1 of 'fscanf' from incompatible pointer type [-Wincompatible-pointer-types]
29 | fscanf("%d%d",&n,&k);
| ^~~~~~
| |
| char *
In file included from main.c:1:
/usr/include/stdio.h:422:37: note: expected 'FILE *' but argument is of type 'char *'
422 | extern int fscanf (FILE *__restrict __stream,
| ~~~~~~~~~~~~~~~~~^~~~~~~~
main.c:29:23: error: passing argument 2 of 'fscanf' from incompatible pointer type [-Wincompatible-pointer-types]
29 | fscanf("%d%d",&n,&k);
| ^~
| |
| unsigned int *
/usr/include/stdio.h:423:43: note: expected 'const char *' but argument is of type 'unsigned int *'
423 | const char *__restrict __format, ...) __wur __nonnull ((1));
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
main.c: In function 'main':
main.c:42:20: error: 'OUTFILE' undeclared (first use in this function); did you mean 'FILE'?
42 | fq = fopen(OUTFILE,"w");
| ^~~~~~~
| FILE
main.c:42:20: note: each undeclared identifier is reported only once for each function it appears in
|
s474258053 | p00439 | C | #include <stdio.h>
#include <stdlib.h>
#define INFILE "input.txt"
#define???OUTFILEPYON "output.txt"
signed int a[100000],ans;
unsigned int n,k;
FILE*fp,*fq;
void solve(void){
int i,diff;
ans = 0;
for(i = 0;i < k;i++)ans += a[i];
diff = 0;
while(i < n){
diff += a[i];
diff -= a[i - k];
if(diff > 0){
ans += diff;
diff = 0;
}
i++;
}
return;
}
int inp(void){
int i;
fscanf("%d%d",&n,&k);
if(!n)return 0;
for(i = 0;i < n;i++)scanf("%d",a+i);
return 1;
}
void oup(void){
fprintf(fq,"%d\n",ans);
return;
}
int main(void){
fp = fopen(INFILE,"r");
fq = fopen(OUTFILEPYON,"w");
while(inp()){
solve();
oup();
}
fclose(fp);
fclose(fq);
return 0;
} | main.c:4:8: error: macro names must be identifiers
4 | #define???OUTFILEPYON "output.txt"
| ^
main.c: In function 'inp':
main.c:29:16: error: passing argument 1 of 'fscanf' from incompatible pointer type [-Wincompatible-pointer-types]
29 | fscanf("%d%d",&n,&k);
| ^~~~~~
| |
| char *
In file included from main.c:1:
/usr/include/stdio.h:422:37: note: expected 'FILE *' but argument is of type 'char *'
422 | extern int fscanf (FILE *__restrict __stream,
| ~~~~~~~~~~~~~~~~~^~~~~~~~
main.c:29:23: error: passing argument 2 of 'fscanf' from incompatible pointer type [-Wincompatible-pointer-types]
29 | fscanf("%d%d",&n,&k);
| ^~
| |
| unsigned int *
/usr/include/stdio.h:423:43: note: expected 'const char *' but argument is of type 'unsigned int *'
423 | const char *__restrict __format, ...) __wur __nonnull ((1));
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
main.c: In function 'main':
main.c:42:20: error: 'OUTFILEPYON' undeclared (first use in this function)
42 | fq = fopen(OUTFILEPYON,"w");
| ^~~~~~~~~~~
main.c:42:20: note: each undeclared identifier is reported only once for each function it appears in
|
s300612122 | p00439 | C | #include <stdio.h>
int c[100000],d[100000]
int main(){
int a,b,e,i,j;
while(1){
scanf("%d %d",&a,&b);
if(a==0&&b==0){
return 0;
}
for(i=0;i<a;i++){
scanf("%d",&c[i]);
}
for(i=0;i<a-b+1;i++){
d[i]=0;
for(j=i;j<b+i;j++){
d[i]+=c[j];
}
}
for(i=0;i<a-b+1;i++){
for(j=0;j<a-b-1;j++){
if(c[j]<=c[j+1]){
e=d[j];
d[j]=d[j+1];
d[j+1]=e;
}
}
}
printf("%d\n",d[0]);
}
return 0;
} | main.c:3:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
3 | int main(){
| ^~~
|
s271799160 | p00439 | C | #include<stdio.h>
int solve(void){
int a,i,k,n,kei=0,ans=-1000000000;
static int wa[100001]={0};
scanf("%d %d",&n,&k);
if(n==0){return 1;}
for(i=1;i<=N;i++){
scanf("%d",&a);
kei+=a;
wa[i]=kei;
}
for(i=0;i<=n-k;i++){
a=wa[i+k]-wa[i];
if(ans<a){ans=a;}
}
printf("%d\n",ans);
return 0;
}
int main(void){
while(solve()==0){}
return 0;
} | main.c: In function 'solve':
main.c:7:12: error: 'N' undeclared (first use in this function)
7 | for(i=1;i<=N;i++){
| ^
main.c:7:12: note: each undeclared identifier is reported only once for each function it appears in
|
s829631969 | p00439 | C | #include <stdio.h>
#define rep(i,j,k) for(i = j;i <= k;i++)
int main(){
int n,k,a[100000],max,temp;
while(1){
int i,j;
scanf("%d%d",&n,&k);
rep(i,0,n-1){
scanf("%d",&a[i]);
}
max = 0;
temp = 0;
rep(i,0,k-1){
max += a[i]
}
rep(i,1,n-k){
rep(j,i,i+k-1){
temp += a[j];
}
if(max < temp) max = temp;
}
printf("%d\n",max);
}
return 0;
} | main.c: In function 'main':
main.c:17:20: error: expected ';' before '}' token
17 | max += a[i]
| ^
| ;
18 | }
| ~
|
s810040849 | p00439 | C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int i,j;
__int64 n,k,a[100005],x,ans;
int comp(const void *p,const void *q){
return *(int *)p-*(int *)q;
}
int main(){
scanf("%lld %lld",&n,&k);
while(n!=0 && k!=0){
a[0]=0,a[1]=0;
for(i=1;i<=n;i++){
scanf("%lld",&x);
a[i]+=x;
if(i<n)a[i+1]=a[i];
}
ans=a[k];
for(i=k;i<=n;i++)if(a[i]-a[i-k]>ans)ans=a[i]-a[i-k];
printf("%lld",ans);
scanf("%lld %lld",&n,&k);
}
return 0;
} | main.c:6:1: error: unknown type name '__int64'; did you mean '__int64_t'?
6 | __int64 n,k,a[100005],x,ans;
| ^~~~~~~
| __int64_t
|
s561174923 | p00439 | C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int i,j;
__int64 n,k,a[100005],x,ans;
int comp(const void *p,const void *q){
return *(int *)p-*(int *)q;
}
int main(){
scanf("%lld %lld",&n,&k);
while(n!=0 && k!=0){
a[0]=0,a[1]=0;
for(i=1;i<=n;i++){
scanf("%lld",&x);
a[i]+=x;
if(i<n)a[i+1]=a[i];
}
ans=a[k];
for(i=k;i<=n;i++)if(a[i]-a[i-k]>ans)ans=a[i]-a[i-k];
printf("%lld",ans);
scanf("%lld %lld",&n,&k);
}
return 0;
} | main.c:6:1: error: unknown type name '__int64'; did you mean '__int64_t'?
6 | __int64 n,k,a[100005],x,ans;
| ^~~~~~~
| __int64_t
|
s774284004 | p00439 | C | #include<stdio.h>
#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
int max(int,int);
int main(void){
int i,n,k,a[100001],sum;
while(scanf("%d %d",&n,&k),n,k){
sum=0;
rep(i,n)scanf("%d",&a[i]);
rep(i,k)sum+=a[i];
for(i=1;m<k;i++,m++)
ans=(ans>sum+=a[m]-a[i])?ans:sum+=a[m]-a[i];
}
return 0;
} | main.c: In function 'main':
main.c:13:13: error: 'm' undeclared (first use in this function)
13 | for(i=1;m<k;i++,m++)
| ^
main.c:13:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:7: error: 'ans' undeclared (first use in this function)
14 | ans=(ans>sum+=a[m]-a[i])?ans:sum+=a[m]-a[i];
| ^~~
|
s789431129 | p00439 | C | #include <iostream>
#include <algorithm>
using namespace std;
int main( void )
{
int n, k, input[5000];
while(cin >> n >> k, n | k) {
int sum = 0;
for(int i=0; i < n; ++i) {
cin >> input[i];
if(i < k) sum += input[i];
}
int i, j, ans = sum;
i = 0; j = k-1;
while(j < n-1) {
sum -= input[i++];
sum += input[++j];
ans = max(ans, sum);
}
cout << ans << endl;
}
return 0;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s514225861 | p00439 | C | #include<stdio.h>
int main(){
int n,k,max=0;
int val;
int sumArray[1000003];
scanf("%d %d",&n,&k);
for(int i=0;i<n;i++){
scanf("%d",&val);
if(i == 0)sumArray[i]=val;
else sumArray[i]=sumArray[i-1]+val;
}
max = sumArray[k-1];
for(int i=k;i<n;i++){
if(sumArray[i]-sumArray[i-k] > max)max=sumArray[i]-sumArray[i-k];
}
printf("%d\",&max);
return 0;
} | main.c: In function 'main':
main.c:21:8: warning: missing terminating " character
21 | printf("%d\",&max);
| ^
main.c:21:8: error: missing terminating " character
21 | printf("%d\",&max);
| ^~~~~~~~~~~~
main.c:22:1: error: expected expression before 'return'
22 | return 0;
| ^~~~~~
main.c:22:10: error: expected ';' before '}' token
22 | return 0;
| ^
| ;
23 | }
| ~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.