submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s021787633 | p00534 | C++ | #import<cstdio>
#define k ff
#define r(a) for(int i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) a<b?a:b
int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:2:11: error: 'ff' was not declared in this scope
2 | #define k ff
| ^~
a.cc:6:13: note: in expansion of macro 'k'
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:2:11: error: 'ff' was not declared in this scope
2 | #define k ff
| ^~
a.cc:6:18: note: in expansion of macro 'k'
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:2:11: error: 'ff' was not declared in this scope
2 | #define k ff
| ^~
a.cc:6:23: note: in expansion of macro 'k'
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:6:26: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^~~~
a.cc: In function 'int main()':
a.cc:6:49: error: 'd' was not declared in this scope
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:4:25: note: in definition of macro 's'
4 | #define s(a) scanf("%d",a);
| ^
a.cc:6:59: error: 'c' was not declared in this scope
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:4:25: note: in definition of macro 's'
4 | #define s(a) scanf("%d",a);
| ^
a.cc:6:67: error: 'p' was not declared in this scope
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:6:88: error: 'p' was not declared in this scope
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:6:107: error: 'c' was not declared in this scope
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:5:18: note: in definition of macro 'm'
5 | #define m(a,b) a<b?a:b
| ^
a.cc:6:114: error: 'd' was not declared in this scope
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:5:18: note: in definition of macro 'm'
5 | #define m(a,b) a<b?a:b
| ^
a.cc:6:138: error: 'p' was not declared in this scope
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,p[w]=m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
|
s301641766 | p00534 | C++ | #import<cstdio>
#define k 1024
#define r(a) for(int i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) a>b?a=b,
int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:6:26: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^~~~
a.cc: In function 'int main()':
a.cc:6:118: error: expected primary-expression before ';' token
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:6:118: error: expected ':' before ';' token
a.cc:6:118: error: expected primary-expression before ';' token
|
s507018403 | p00534 | C++ | #import<cstdio>
#define k 1024
#define r(a) for(int i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) a>b?a=b:
int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:6:26: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^~~~
a.cc: In function 'int main()':
a.cc:6:118: error: expected primary-expression before ';' token
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
|
s927165532 | p00534 | C++ | #import<cstdio>
#define k 1024
#define r(a) for(int i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) a>b?a=b
int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:6:26: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^~~~
a.cc: In function 'int main()':
a.cc:6:118: error: expected ':' before ';' token
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:6:118: error: expected primary-expression before ';' token
|
s956758035 | p00534 | C++ | #import<cstdio>
#define k 1024
#define r(a) for(int i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) if(a>b)a=b
int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:6:26: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^~~~
a.cc: In function 'int main()':
a.cc:5:16: error: expected primary-expression before 'if'
5 | #define m(a,b) if(a>b)a=b
| ^~
a.cc:6:88: note: in expansion of macro 'm'
6 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
|
s585600512 | p00534 | C++ | #define k 1024
#define r(a) for(int i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) a=a<b?a:b
main(w,n,m,c[],d[],p[]){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);} | a.cc:5:5: error: expected constructor, destructor, or type conversion before '(' token
5 | main(w,n,m,c[],d[],p[]){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
|
s747422212 | p00534 | C++ | #define k 1024
#define r(a) for(int i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) a=a<b?a:b
int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);} | a.cc:5:26: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^~~~
a.cc: In function 'int main()':
a.cc:3:14: error: 'scanf' was not declared in this scope
3 | #define s(a) scanf("%d",a);
| ^~~~~
a.cc:5:33: note: in expansion of macro 's'
5 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^
a.cc:5:119: error: 'printf' was not declared in this scope
5 | int w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]);}
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | #define k 1024
|
s624840260 | p00534 | C++ | #define k 1024
#define r(a) for(i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) a=a<b?a:b
i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;} | a.cc:5:1: error: 'i' does not name a type
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:5:24: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^~~~
a.cc: In function 'int main()':
a.cc:5:34: error: 'n' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:3:14: error: 'scanf' was not declared in this scope
3 | #define s(a) scanf("%d",a);
| ^~~~~
a.cc:5:31: note: in expansion of macro 's'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:5:39: error: 'm' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:41: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:5:47: error: 'd' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:51: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:5:57: error: 'c' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:61: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:5:65: error: 'p' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:74: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:5:80: error: 'w' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:5:88: error: 'p' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:4:16: note: in definition of macro 'm'
4 | #define m(a,b) a=a<b?a:b
| ^
a.cc:5:100: error: 'c' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:4:20: note: in definition of macro 'm'
4 | #define m(a,b) a=a<b?a:b
| ^
a.cc:5:107: error: 'd' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:4:20: note: in definition of macro 'm'
4 | #define m(a,b) a=a<b?a:b
| ^
a.cc:5:131: error: 'p' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^
a.cc:5:117: error: 'printf' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),0;}
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | #define k 1024
|
s026409152 | p00534 | C++ | #define k 1024
#define r(a) for(i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) a=a<b?:b
i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);} | a.cc:5:1: error: 'i' does not name a type
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:24: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^~~~
a.cc: In function 'int main()':
a.cc:5:34: error: 'n' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:3:14: error: 'scanf' was not declared in this scope
3 | #define s(a) scanf("%d",a);
| ^~~~~
a.cc:5:31: note: in expansion of macro 's'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:39: error: 'm' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:41: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:47: error: 'd' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:51: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:57: error: 'c' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:61: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:65: error: 'p' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:74: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:80: error: 'w' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:88: error: 'p' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:4:16: note: in definition of macro 'm'
4 | #define m(a,b) a=a<b?:b
| ^
a.cc:5:100: error: 'c' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:4:20: note: in definition of macro 'm'
4 | #define m(a,b) a=a<b?:b
| ^
a.cc:5:107: error: 'd' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:4:20: note: in definition of macro 'm'
4 | #define m(a,b) a=a<b?:b
| ^
a.cc:5:131: error: 'p' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:117: error: 'printf' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | #define k 1024
a.cc:5:137: error: 'exit' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^~~~
a.cc:1:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
+++ |+#include <cstdlib>
1 | #define k 1024
|
s278853830 | p00534 | C++ | #define k 1024
#define r(a) for(i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) a=a<b?a:b
i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);} | a.cc:5:1: error: 'i' does not name a type
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:24: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^~~~
a.cc: In function 'int main()':
a.cc:5:34: error: 'n' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:3:14: error: 'scanf' was not declared in this scope
3 | #define s(a) scanf("%d",a);
| ^~~~~
a.cc:5:31: note: in expansion of macro 's'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:39: error: 'm' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:41: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:47: error: 'd' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:51: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:57: error: 'c' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:3:25: note: in definition of macro 's'
3 | #define s(a) scanf("%d",a);
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:61: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:65: error: 'p' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:2:18: error: 'i' was not declared in this scope
2 | #define r(a) for(i=0;i<a;i++)
| ^
a.cc:5:74: note: in expansion of macro 'r'
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:80: error: 'w' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:88: error: 'p' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:4:16: note: in definition of macro 'm'
4 | #define m(a,b) a=a<b?a:b
| ^
a.cc:5:100: error: 'c' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:4:20: note: in definition of macro 'm'
4 | #define m(a,b) a=a<b?a:b
| ^
a.cc:5:107: error: 'd' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:4:20: note: in definition of macro 'm'
4 | #define m(a,b) a=a<b?a:b
| ^
a.cc:5:131: error: 'p' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
a.cc:5:117: error: 'printf' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | #define k 1024
a.cc:5:137: error: 'exit' was not declared in this scope
5 | i,w,n,m,c[k],d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^~~~
a.cc:1:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
+++ |+#include <cstdlib>
1 | #define k 1024
|
s350557158 | p00534 | C++ | #define k 1024
#define r(a) for(i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define m(a,b) a=a<b?a:b
main(i,w,n,m,c[k],d[k],p[k]){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);} | a.cc:5:5: error: expected constructor, destructor, or type conversion before '(' token
5 | main(i,w,n,m,c[k],d[k],p[k]){s(&n)s(&m)r(n)s(d+i)r(m)s(c+i)r(n)p[i]=1e9;r(m*n)w=i%n,m(p[w],p[w+1]+c[i/n]*d[n-w-1]);printf("%d\n",p[0]),exit(0);}
| ^
|
s332582799 | p00534 | C++ | #import<cstdio>
#define k 1024
#define r(a) for(int i=0;i<a;i++)
#define s(a) scanf("%d",a);
#define c(a,b) a=a<b?a:b
int w,n,m,d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(n)p[i]=1e9;r(m){s(&w)r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",p[0]),exit(0);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:6:21: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | int w,n,m,d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(n)p[i]=1e9;r(m){s(&w)r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",p[0]),exit(0);}
| ^~~~
a.cc: In function 'int main()':
a.cc:6:122: error: 'exit' was not declared in this scope
6 | int w,n,m,d[k],p[k];main(){s(&n)s(&m)r(n)s(d+i)r(n)p[i]=1e9;r(m){s(&w)r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",p[0]),exit(0);}
| ^~~~
a.cc:2:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
1 | #import<cstdio>
+++ |+#include <cstdlib>
2 | #define k 1024
|
s089893181 | p00534 | C++ | #import<cstdio>
#define r(a) for(int i=0;i<a;i++)
#define s scanf("%d",&w),w;
#define c(a,b) a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=sm=ssr(n)d[i]=sr(n)p[i]=1e9;r(m){sr(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:5:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | int w,n,m,d[999],p[999];main(){n=sm=ssr(n)d[i]=sr(n)p[i]=1e9;r(m){sr(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^~~~
a.cc: In function 'int main()':
a.cc:5:34: error: 'sm' was not declared in this scope; did you mean 'm'?
5 | int w,n,m,d[999],p[999];main(){n=sm=ssr(n)d[i]=sr(n)p[i]=1e9;r(m){sr(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^~
| m
a.cc:5:37: error: 'ssr' was not declared in this scope
5 | int w,n,m,d[999],p[999];main(){n=sm=ssr(n)d[i]=sr(n)p[i]=1e9;r(m){sr(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^~~
a.cc:5:67: error: 'sr' was not declared in this scope; did you mean 'r'?
5 | int w,n,m,d[999],p[999];main(){n=sm=ssr(n)d[i]=sr(n)p[i]=1e9;r(m){sr(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^~
| r
|
s057348875 | p00534 | C++ | #import<cstdio>
#define r(a) for(int i=0;i<a;i++)
#define s (scanf("%d",&w),w)
#define c(a,b) a=a<b?a:b
int w,n,m,d[999],p[];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:5:18: error: storage size of 'p' isn't known
5 | int w,n,m,d[999],p[];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
a.cc:5:22: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | int w,n,m,d[999],p[];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^~~~
|
s103932073 | p00534 | C++ | #import<cstdio>
#define r(a) for(int i=0;i<a;i++)
#define s (scanf("%d",&w),w)
#define c(a,b) a=a<b?a:b
int d[999],p[999];main(w,n,m){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:5:23: error: expected constructor, destructor, or type conversion before '(' token
5 | int d[999],p[999];main(w,n,m){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
|
s295069796 | p00534 | C++ | #import<cstdio>
#define r(a)for(int i=0;i<a;i++)
#define s(scanf("%d",&w),w)
#define c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:3:16: error: expected ',' or ')', found "("
3 | #define s(scanf("%d",&w),w)
| ^
a.cc:5:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^~~~
a.cc: In function 'int main()':
a.cc:5:34: error: 's' was not declared in this scope
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
|
s867432828 | p00534 | C++ | #import<cstdio>#define r(a)for(int i=0;i<a;i++)#define s (scanf("%d",&w),w)#define c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>#define r(a)for(int i=0;i<a;i++)#define s (scanf("%d",&w),w)#define c(a,b)a=a<b?a:b
| ^~~~~~
a.cc:1:16: warning: extra tokens at end of #import directive
1 | #import<cstdio>#define r(a)for(int i=0;i<a;i++)#define s (scanf("%d",&w),w)#define c(a,b)a=a<b?a:b
| ^
a.cc:2:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^~~~
a.cc: In function 'int main()':
a.cc:2:34: error: 's' was not declared in this scope
2 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
a.cc:2:40: error: 'r' was not declared in this scope
2 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
|
s603013977 | p00534 | C++ | #define r(a,i)for(i=0;i<a;i++)
#define s (scanf("%d",&w),w)
#define c(a,b)a=a<b?a:b
d[999],p[99];main(i,j,w,n,m){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);} | a.cc:4:1: error: 'd' does not name a type
4 | d[999],p[99];main(i,j,w,n,m){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
| ^
a.cc:4:18: error: expected constructor, destructor, or type conversion before '(' token
4 | d[999],p[99];main(i,j,w,n,m){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
| ^
|
s732184015 | p00534 | C++ | #define r(a,i)for(i=0;i<a;i++)
#define s (scanf("%d",&w),w)
#define c(a,b)a<b?:a=b
d[999],p[999];main(i,j,w,n,m){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);} | a.cc:4:1: error: 'd' does not name a type
4 | d[999],p[999];main(i,j,w,n,m){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
| ^
a.cc:4:19: error: expected constructor, destructor, or type conversion before '(' token
4 | d[999],p[999];main(i,j,w,n,m){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
| ^
|
s595264784 | p00534 | C++ | #import<cstdio>
#define D #define
D r(a)for(int i=0;i<a;i++)
D s (scanf("%d",&w),w)
D c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:2:11: error: stray '#' in program
2 | #define D #define
| ^
a.cc:3:1: note: in expansion of macro 'D'
3 | D r(a)for(int i=0;i<a;i++)
| ^
a.cc:2:11: error: stray '#' in program
2 | #define D #define
| ^
a.cc:4:1: note: in expansion of macro 'D'
4 | D s (scanf("%d",&w),w)
| ^
a.cc:2:11: error: stray '#' in program
2 | #define D #define
| ^
a.cc:5:1: note: in expansion of macro 'D'
5 | D c(a,b)a=a<b?a:b
| ^
a.cc:2:12: error: 'define' does not name a type
2 | #define D #define
| ^~~~~~
a.cc:3:1: note: in expansion of macro 'D'
3 | D r(a)for(int i=0;i<a;i++)
| ^
a.cc:3:19: error: 'i' does not name a type
3 | D r(a)for(int i=0;i<a;i++)
| ^
a.cc:3:23: error: 'i' does not name a type
3 | D r(a)for(int i=0;i<a;i++)
| ^
a.cc:6:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^~~~
a.cc: In function 'int main()':
a.cc:6:32: error: 'n' was not declared in this scope
6 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
a.cc:6:34: error: 's' was not declared in this scope
6 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
a.cc:6:36: error: 'm' was not declared in this scope
6 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
a.cc:6:40: error: 'r' was not declared in this scope
6 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
a.cc:6:117: error: 'p' was not declared in this scope
6 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
|
s033720220 | p00534 | C++ | #import<iostream>
#define r(a)for(int i=0;i<a;i++)
#define s w<<std::cin;
#define c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<iostream>
| ^~~~~~
a.cc:5:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^~~~
a.cc: In function 'int main()':
a.cc:3:12: error: no match for 'operator<<' (operand types are 'int' and 'std::istream' {aka 'std::basic_istream<char>'})
3 | #define s w<<std::cin;
| ~^~~~~~~~~~
| | |
| int std::istream {aka std::basic_istream<char>}
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
a.cc:3:12: note: candidate: 'operator<<(int, int)' (built-in)
3 | #define s w<<std::cin;
| ~^~~~~~~~~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
a.cc:3:12: note: no known conversion for argument 2 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
3 | #define s w<<std::cin;
| ~^~~~~~~~~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:3:19: note: mismatched types 'std::basic_ostream<_CharT, _Traits>' and 'int'
3 | #define s w<<std::cin;
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:3:19: note: mismatched types 'std::basic_ostream<_CharT, _Traits>' and 'int'
3 | #define s w<<std::cin;
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:3:11: note: cannot convert 'w' (type 'int') to type 'std::byte'
3 | #define s w<<std::cin;
| ^
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:3:19: note: mismatched types 'std::basic_ostream<_CharT, _Traits>' and 'int'
3 | #define s w<<std::cin;
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:3:19: note: mismatched types 'std::basic_ostream<_CharT, _Traits>' and 'int'
3 | #define s w<<std::cin;
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:3:19: note: mismatched types 'std::basic_ostream<_CharT, _Traits>' and 'int'
3 | #define s w<<std::cin;
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:3:19: note: mismatched types 'std::basic_ostream<char, _Traits>' and 'int'
3 | #define s w<<std::cin;
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:3:19: note: mismatched types 'std::basic_ostream<char, _Traits>' and 'int'
3 | #define s w<<std::cin;
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:3:19: note: mismatched types 'std::basic_ostream<char, _Traits>' and 'int'
3 | #define s w<<std::cin;
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:3:19: note: mismatched types 'std::basic_ostream<_CharT, _Traits>' and 'int'
3 | #define s w<<std::cin;
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:3:19: note: mismatched types 'std::basic_ostream<_CharT, _Traits>' and 'int'
3 | #define s w<<std::cin;
| ^~~
a.cc:5:34: note: in expan |
s041016995 | p00534 | C++ | #import<iostream>
#define r(a)for(int i=0;i<a;i++)
#define s std::cin>>w;
#define c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<iostream>
| ^~~~~~
a.cc:5:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^~~~
a.cc: In function 'int main()':
a.cc:3:19: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' in assignment
3 | #define s std::cin>>w;
| ~~~~~~~~^~~
| |
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
a.cc:3:19: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' in assignment
3 | #define s std::cin>>w;
| ~~~~~~~~^~~
| |
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:5:38: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
a.cc:3:19: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' in assignment
3 | #define s std::cin>>w;
| ~~~~~~~~^~~
| |
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:5:49: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*p);}
| ^
|
s634769229 | p00534 | C++ | #import<map>
#define r(a)for(int i=0;i<a;i++)
#define s (std::cin>>w,w)
#define c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<endl;} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<map>
| ^~~~~~
a.cc:5:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<endl;}
| ^~~~
a.cc: In function 'int main()':
a.cc:3:17: error: 'cin' is not a member of 'std'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<endl;}
| ^
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #import<map>
+++ |+#include <iostream>
2 | #define r(a)for(int i=0;i<a;i++)
a.cc:3:17: error: 'cin' is not a member of 'std'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:38: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<endl;}
| ^
a.cc:3:17: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:38: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<endl;}
| ^
a.cc:3:17: error: 'cin' is not a member of 'std'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:49: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<endl;}
| ^
a.cc:3:17: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:49: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<endl;}
| ^
a.cc:3:17: error: 'cin' is not a member of 'std'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:69: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<endl;}
| ^
a.cc:3:17: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:69: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<endl;}
| ^
a.cc:5:102: error: 'cout' was not declared in this scope
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<endl;}
| ^~~~
a.cc:5:112: error: 'endl' was not declared in this scope
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<endl;}
| ^~~~
|
s893541770 | p00534 | C++ | #import<algo.h>
#define r(a)for(int i=0;i<a;i++)
#define s (cin>>w,w)
#define c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<"\n";} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<algo.h>
| ^~~~~~
a.cc:1:8: fatal error: algo.h: No such file or directory
1 | #import<algo.h>
| ^~~~~~~~
compilation terminated.
|
s075387796 | p00534 | C++ | #import<ios>
#define r(a)for(int i=0;i<a;i++)
#define s (cin>>w,w)
#define c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<"\n";} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<ios>
| ^~~~~~
a.cc:5:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<"\n";}
| ^~~~
a.cc: In function 'int main()':
a.cc:3:12: error: 'cin' was not declared in this scope
3 | #define s (cin>>w,w)
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<"\n";}
| ^
a.cc:5:102: error: 'cout' was not declared in this scope
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}cout<<*p<<"\n";}
| ^~~~
|
s376664542 | p00534 | C++ | #import<ios>
#define r(a)for(int i=0;i<a;i++)
#define s (std::cin>>w,w)
#define c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}std::cout<<*p<<"\n";} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<ios>
| ^~~~~~
a.cc:5:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}std::cout<<*p<<"\n";}
| ^~~~
a.cc: In function 'int main()':
a.cc:3:17: error: 'cin' is not a member of 'std'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:34: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}std::cout<<*p<<"\n";}
| ^
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #import<ios>
+++ |+#include <iostream>
2 | #define r(a)for(int i=0;i<a;i++)
a.cc:3:17: error: 'cin' is not a member of 'std'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:38: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}std::cout<<*p<<"\n";}
| ^
a.cc:3:17: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:38: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}std::cout<<*p<<"\n";}
| ^
a.cc:3:17: error: 'cin' is not a member of 'std'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:49: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}std::cout<<*p<<"\n";}
| ^
a.cc:3:17: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:49: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}std::cout<<*p<<"\n";}
| ^
a.cc:3:17: error: 'cin' is not a member of 'std'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:69: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}std::cout<<*p<<"\n";}
| ^
a.cc:3:17: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #define s (std::cin>>w,w)
| ^~~
a.cc:5:69: note: in expansion of macro 's'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}std::cout<<*p<<"\n";}
| ^
a.cc:5:107: error: 'cout' is not a member of 'std'
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}std::cout<<*p<<"\n";}
| ^~~~
a.cc:5:107: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s459861812 | p00534 | C++ | #import<ios>
#define r(a)for(int i=0;i<a;i++)
#define s (scanf("%d",&w),w)
#define c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*w);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<ios>
| ^~~~~~
a.cc:5:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*w);}
| ^~~~
a.cc: In function 'int main()':
a.cc:5:116: error: invalid type argument of unary '*' (have 'int')
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i],p[i+1]+w*d[n-i-1]);}printf("%d\n",*w);}
| ^~
|
s557344565 | p00534 | C++ | #import<cstdio>
#define r(a)for(int i=0;i++<a;)
#define s (scanf("%d",&w),w)
#define c(a,b)a=a<b?a:b
int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i-1],p[i]+w*d[n-i+1]);}printf("%d\n",*w);} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:5:25: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i-1],p[i]+w*d[n-i+1]);}printf("%d\n",*w);}
| ^~~~
a.cc: In function 'int main()':
a.cc:5:116: error: invalid type argument of unary '*' (have 'int')
5 | int w,n,m,d[999],p[999];main(){n=s;m=s;r(n)d[i]=s;r(n)p[i]=1e9;r(m){s;r(n)c(p[i-1],p[i]+w*d[n-i+1]);}printf("%d\n",*w);}
| ^~
|
s501549714 | p00534 | C++ | #include <iostream>
#include<math.h>
using namespace std;
int kyori[1000];
int tennki[1000];
long long int dp[1000];
int main() {
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>kyori[i];
}
for(int i=0;i<m;i++){
cin>>tennki[i];
}
for(int i=0;i<1000;i++){
dp[i]=-1;
}
for(int day=0;day<m;day++){
for(int city =n-1;city>=0;city--){
if(city==0){
if(dp[city]==-1){dp[city]=kyori[city]*tennki[day];}
else{dp[city]=min(dp[city],kyori[city]*tennki[day]);}
}
else{
if(dp[city]==-1&&dp[city-1]!=-1){dp[city]=dp[city-1]+(kyori[city]*tennki[day]);}
else{dp[city]=min(dp[city],dp[city-1]+(kyori[city]*tennki[day]));}
}
}
}
cout<<dp[n-1]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:50: error: no matching function for call to 'min(long long int&, int)'
23 | else{dp[city]=min(dp[city],kyori[city]*tennki[day]);}
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:23:50: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
23 | else{dp[city]=min(dp[city],kyori[city]*tennki[day]);}
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
|
s247887462 | p00534 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef lli long long int;
int d[1000], c[1000];
int n, m;
lli memo[1000][1000];
lli rec(int i, int j)
{
if (j == n) return 0;
if (memo[i][j] >= 0) return memo[i][j];
lli res;
if (m - j >= n - i) {
res = rec(i + 1, j + 1) + d[i] * c[i];
} else {
res = min(rec(i + 1, j + 1) + d[i] * c[i], rec(i + 1, j));
}
return dp[i][j] = res;
}
int main()
{
cin >> n >> m;
for (int i = 0; i < n; ++i) cin >> d[i];
for (int i = 0; i < m; ++i) cin >> c[i];
memset(memo, -1, sizeof(memo));
printf("%lldd\n", rec(0, 0));
} | a.cc:5:9: error: 'lli' does not name a type
5 | typedef lli long long int;
| ^~~
a.cc:10:1: error: 'lli' does not name a type
10 | lli memo[1000][1000];
| ^~~
a.cc:12:1: error: 'lli' does not name a type
12 | lli rec(int i, int j)
| ^~~
a.cc: In function 'int main()':
a.cc:37:16: error: 'memo' was not declared in this scope
37 | memset(memo, -1, sizeof(memo));
| ^~~~
a.cc:39:27: error: 'rec' was not declared in this scope
39 | printf("%lldd\n", rec(0, 0));
| ^~~
|
s262328390 | p00534 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int d[1000], c[1000];
int n, m;
lli memo[1000][1000];
lli rec(int i, int j)
{
if (j == n) return 0;
if (memo[i][j] >= 0) return memo[i][j];
lli res;
if (m - j >= n - i) {
res = rec(i + 1, j + 1) + d[i] * c[i];
} else {
res = min(rec(i + 1, j + 1) + d[i] * c[i], rec(i + 1, j));
}
return dp[i][j] = res;
}
int main()
{
cin >> n >> m;
for (int i = 0; i < n; ++i) cin >> d[i];
for (int i = 0; i < m; ++i) cin >> c[i];
memset(memo, -1, sizeof(memo));
printf("%lldd\n", rec(0, 0));
} | a.cc: In function 'lli rec(int, int)':
a.cc:26:16: error: 'dp' was not declared in this scope; did you mean 'dup'?
26 | return dp[i][j] = res;
| ^~
| dup
|
s831770954 | p00534 | C++ | #include <bits/stdc++.h>
using namespace std;
int n, m;
int d[1000];
int c[1000];
int memo[1000][1000];
int rec(int day, int now)
{
if (now == n) return 0;
if (memo[day][now] >= 0) return memo[day][now];
lli res;
if (n - now < m - day) {
res = min(rec(day + 1, now + 1) + d[now] * c[day], rec(day + 1, now));
} else {
res = rec(day + 1, now + 1) + d[now] * c[day];
}
return memo[day][now] = res;
}
int main()
{
cin >> n >> m;
for (int i = 0; i < n; ++i) {
cin >> d[i];
}
for (int i = 0; i < m; ++i) {
cin >> c[i];
}
memset(memo, -1, sizeof(memo));
printf("%d\n", rec(0, 0));
} | a.cc: In function 'int rec(int, int)':
a.cc:17:9: error: 'lli' was not declared in this scope
17 | lli res;
| ^~~
a.cc:20:17: error: 'res' was not declared in this scope; did you mean 'rec'?
20 | res = min(rec(day + 1, now + 1) + d[now] * c[day], rec(day + 1, now));
| ^~~
| rec
a.cc:22:17: error: 'res' was not declared in this scope; did you mean 'rec'?
22 | res = rec(day + 1, now + 1) + d[now] * c[day];
| ^~~
| rec
a.cc:25:33: error: 'res' was not declared in this scope; did you mean 'rec'?
25 | return memo[day][now] = res;
| ^~~
| rec
|
s407986558 | p00534 | C++ | #include <stdio.h>
#include <algorithm>
using namespace std;
const int MAX_N=1000;
const int MAX_M=1000;
const int INF=10000000;
int dp[MAX_M+1][MAX_N+1];
int dis[MAX_N];
int wea[MAX_M];
int n,m;
int rec(int i,int j){
if(dp[i][j]>=0){
return dp[i][j];
}
int res;
if(j==n){
return 0;
}
if(i==m){
return INF;
}
else{
res=min(rec(i+1,j),rec(i+1,j+1)+wea[i]*dis[j]);
}
return dp[i][j]=res;
}
int main(){
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++){
scanf("%d",&dis[i]);
}
for(int i=0;i<m;i++){
scanf("%d",&wea[i]);
}
memset(dp,-1,sizeof(dp));
printf("%d\n",rec(0,0));
return 0;
} | a.cc: In function 'int main()':
a.cc:36:9: error: 'memset' was not declared in this scope
36 | memset(dp,-1,sizeof(dp));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <algorithm>
+++ |+#include <cstring>
3 | using namespace std;
|
s378295617 | p00534 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<n; ++i)
using namespace std;
int dp[1003][1003];
int main()
{
int N, M;
scanf("%d%d", &N, &M);
int D[1000], C[1000];
REP(i, N) scanf("%d", &D[i]);
REP(i, M) scanf("%d", &C[i]);
memset(dp, 0x3f, sizeof(dp));
dp[0][0] = 0;
for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + C[j]*D[i]);
}
}
printf("%d", dp[N][M]);
return 0;
} | a.cc:19:49: error: stray '\32' in program
19 | for(int i=0; i<=N; i++){/%??????BY??????<U+001A>[??<U+0008><U+001A>??L<U+30BD><U+30BD><U+001A><U+30BD><U+30BD>SN??<U+001A>??????^??????<U+0011>
| ^~~~~~~~
a.cc:19:53: error: stray '\10' in program
19 | for(int i=0; i<=N; i++){/%??????BY??????<U+001A>[??<U+0008><U+001A>??L<U+30BD><U+30BD><U+001A><U+30BD><U+30BD>SN??<U+001A>??????^??????<U+0011>
| ^~~~~~~~
a.cc:19:54: error: stray '\32' in program
19 | for(int i=0; i<=N; i++){/%??????BY??????<U+001A>[??<U+0008><U+001A>??L<U+30BD><U+30BD><U+001A><U+30BD><U+30BD>SN??<U+001A>??????^??????<U+0011>
| ^~~~~~~~
a.cc:19:62: error: stray '\32' in program
19 | for(int i=0; i<=N; i++){/%??????BY??????<U+001A>[??<U+0008><U+001A>??L<U+30BD><U+30BD><U+001A><U+30BD><U+30BD>SN??<U+001A>??????^??????<U+0011>
| ^~~~~~~~
a.cc:19:71: error: stray '\32' in program
19 | for(int i=0; i<=N; i++){/%??????BY??????<U+001A>[??<U+0008><U+001A>??L<U+30BD><U+30BD><U+001A><U+30BD><U+30BD>SN??<U+001A>??????^??????<U+0011>
| ^~~~~~~~
a.cc:19:85: error: stray '\21' in program
19 | for(int i=0; i<=N; i++){/%??????BY??????<U+001A>[??<U+0008><U+001A>??L<U+30BD><U+30BD><U+001A><U+30BD><U+30BD>SN??<U+001A>??????^??????<U+0011>
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:19:33: error: expected primary-expression before '/' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:34: error: expected primary-expression before '%' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:35: error: expected primary-expression before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:36: error: expected primary-expression before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:37: error: expected primary-expression before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:38: error: expected primary-expression before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:39: error: expected primary-expression before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:40: error: expected primary-expression before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:41: error: 'BY' was not declared in this scope
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^~
a.cc:19:44: error: expected primary-expression before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:45: error: expected primary-expression before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:46: error: expected primary-expression before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:47: error: expected primary-expression before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:48: error: expected primary-expression before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:19:51: error: expected identifier before '?' token
19 | for(int i=0; i<=N; i++){/%??????BY??????[????LソソソソSN????????^??????
| ^
a.cc:20:65: error: expected ']' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| ]
a.cc: In lambda function:
a.cc:20:65: error: expected '{' before ';' token
a.cc: In function 'int main()':
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:20:65: error: expected ':' before ';' token
20 | dp[i][j+1] = min(dp[i][j + 1], dp[i][j]);
| ^
| :
a.cc:20:65: error: expected primary-expression before ';' token
a.cc:21:33: error: 'j' was not declared in this scope
21 | dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + C[j]*D[i]);
| ^
a.cc: At global scope:
a.cc:25:15: error: expected constructor, destructor, or type conversion before '(' token
25 | printf("%d", dp[N][M]);
| ^
a.cc:27:9: error: expected unqualified-id before 'return'
27 | return 0;
| ^~~~~~
a.cc:28:1: error: expected declaration before '}' token
28 | }
| ^
|
s300796439 | p00534 | C++ | #include <iostream>
using namespace std;
#include <cstring>
#include <algorithm>
#define INF 1<<29
int dp[1000][1000];
int main(void){
int n, m;
cin >> n >> m;
int d[1000];
for (int i = 0; i < n; i++)
cin >> d[i];
int c[1000];
for (int i = 0; i < m; i++)
cin >> c[i];
for (int i = 0; i <= m; i++) dp[0][i] = 0;
for (int i = 0; i <= n; i++) dp[i][0] = INF;
for (int i = 1; i <= n; i++){
for (int j = 1; j <= m; j++){
do[i][j] = INF;
dp[i][j] = min(dp[i][j - 1], dp[i - 1][j - 1] + d[i - 1] * c[j - 1]);
}
}
cout << dp[n][m] << endl;
} | a.cc: In lambda function:
a.cc:25:30: error: expected '{' before '[' token
25 | do[i][j] = INF;
| ^
a.cc: In function 'int main()':
a.cc:25:30: error: no match for 'operator[]' (operand types are 'main()::<lambda()>' and 'int')
a.cc:26:25: error: expected 'while' before 'dp'
26 | dp[i][j] = min(dp[i][j - 1], dp[i - 1][j - 1] + d[i - 1] * c[j - 1]);
| ^~
a.cc:26:25: error: expected '(' before 'dp'
26 | dp[i][j] = min(dp[i][j - 1], dp[i - 1][j - 1] + d[i - 1] * c[j - 1]);
| ^~
| (
a.cc:26:93: error: expected ')' before ';' token
26 | dp[i][j] = min(dp[i][j - 1], dp[i - 1][j - 1] + d[i - 1] * c[j - 1]);
| ~~ ^
| )
|
s697590792 | p00534 | C++ | #include<stdio.h>
long long int as[1001][1001];
int main(void)
{
long long int a,b,x[1001],s[1001],A=9223372036854775800,min=9223372036854775800,i,j;
scanf("%lld %lld",&a,&b);
for(i=1;i<=a;i++){
scanf("%lld",&x[i]);
}
for(i=1;i<=b;i++){
scanf("%lld",&s[i]);
}
for(i=0;i<=b;i++){
for(j=0;j<=a;j++){
as[i][j]=A;
}
}
as[0][0]=0;
for(i=0;i<b;i++){
for(j=0;j<=a;j++){
if(as[i][j]!=A){
if(as[i+1][j]>as[i][j]){
as[i+1][j]=as[i][j];
}
if(as[i+1][j+1]>as[i][j]+x[j+1]*s[i+1]){
as[i+1][j+1]=as[i][j]+x[j+1]*s[i+1];
}
}
}
}
/* for(i=0;i<=b;i++){
for(j=0;j<=a;j++) printf("%d ",as[i][j]);
printf("\n");
}*/
for(i=0;i<=b;i++){
if(as[i][a]<min){
min=as[i][a];
}
}
printf("%lld\n",min);
return 0; | a.cc: In function 'int main()':
a.cc:41:18: error: expected '}' at end of input
41 | return 0;
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s505203096 | p00534 | C++ | #include<iostream>
#include<algorithm>
using namespaces td;
int n,m,a[1000],b[1000],dp[1000][1000];
int main(){
for(int i=0;i<1000000;i++)dp[i/1000][i%1000]=1000000007;
cin>>n>>m;for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<m;i++)cin>>b[i];
dp[0][0]=0;
for(int i=0;i<m;i++){
for(int j=0;j<=n;j++){
dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+a[i]*b[j]);
dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
}
}
cout<<dp[m][n]<<endl;
return 0;
} | a.cc:3:7: error: expected nested-name-specifier before 'namespaces'
3 | using namespaces td;
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin>>n>>m;for(int i=0;i<n;i++)cin>>a[i];
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:12:38: error: 'min' was not declared in this scope; did you mean 'std::min'?
12 | dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+a[i]*b[j]);
| ^~~
| std::min
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
a.cc:16:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
16 | cout<<dp[m][n]<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:16:25: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
16 | cout<<dp[m][n]<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s619434311 | p00534 | C++ | lude <bits/stdc++.h>
#define MAX 100000000;
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
int qa,b;
cin>>a>>b;
int dp[a+1][b+1],a1[a+1],b1[b+1];
r(i,a)cin>>a1[i+1];
r(i,b)cin>>b1[i+1];
r(i,a+1)(j,b+1)dp[i][j]=MAX;
for(int i=1;i<=a;i++)
for(int j=1;j<=b;j++){
dp[i][j]=min(dp[i-1][j-1]+a1[i]*b1[j],dp[i][j-1]);
}
cout<<dp[a][b]<<endl;
} | a.cc:1:1: error: 'lude' does not name a type
1 | lude <bits/stdc++.h>
| ^~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
7 | cin>>a>>b;
| ^~~
a.cc:7:14: error: 'a' was not declared in this scope
7 | cin>>a>>b;
| ^
a.cc:9:20: error: 'a1' was not declared in this scope; did you mean 'b1'?
9 | r(i,a)cin>>a1[i+1];
| ^~
| b1
a.cc:11:18: error: 'j' was not declared in this scope
11 | r(i,a+1)(j,b+1)dp[i][j]=MAX;
| ^
a.cc:14:25: error: 'dp' was not declared in this scope
14 | dp[i][j]=min(dp[i-1][j-1]+a1[i]*b1[j],dp[i][j-1]);
| ^~
a.cc:14:51: error: 'a1' was not declared in this scope; did you mean 'b1'?
14 | dp[i][j]=min(dp[i-1][j-1]+a1[i]*b1[j],dp[i][j-1]);
| ^~
| b1
a.cc:14:34: error: 'min' was not declared in this scope; did you mean 'main'?
14 | dp[i][j]=min(dp[i-1][j-1]+a1[i]*b1[j],dp[i][j-1]);
| ^~~
| main
a.cc:16:9: error: 'cout' was not declared in this scope
16 | cout<<dp[a][b]<<endl;
| ^~~~
a.cc:16:15: error: 'dp' was not declared in this scope
16 | cout<<dp[a][b]<<endl;
| ^~
a.cc:16:25: error: 'endl' was not declared in this scope
16 | cout<<dp[a][b]<<endl;
| ^~~~
|
s153541446 | p00534 | C++ | #include <bits/stdc++.h>
#define MAX 100000000;
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
int qa,b;
cin>>a>>b;
int dp[a+1][b+1],a1[a+1],b1[b+1];
r(i,a)cin>>a1[i+1];
r(i,b)cin>>b1[i+1];
r(i,a+1)(j,b+1)dp[i][j]=MAX;
for(int i=1;i<=a;i++)
for(int j=1;j<=b;j++){
dp[i][j]=min(dp[i-1][j-1]+a1[i]*b1[j],dp[i][j-1]);
}
cout<<dp[a][b]<<endl;
} | a.cc: In function 'int main()':
a.cc:7:14: error: 'a' was not declared in this scope
7 | cin>>a>>b;
| ^
a.cc:9:20: error: 'a1' was not declared in this scope; did you mean 'b1'?
9 | r(i,a)cin>>a1[i+1];
| ^~
| b1
a.cc:11:18: error: 'j' was not declared in this scope
11 | r(i,a+1)(j,b+1)dp[i][j]=MAX;
| ^
a.cc:14:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
14 | dp[i][j]=min(dp[i-1][j-1]+a1[i]*b1[j],dp[i][j-1]);
| ^~
| dup
a.cc:14:51: error: 'a1' was not declared in this scope; did you mean 'b1'?
14 | dp[i][j]=min(dp[i-1][j-1]+a1[i]*b1[j],dp[i][j-1]);
| ^~
| b1
a.cc:16:15: error: 'dp' was not declared in this scope; did you mean 'dup'?
16 | cout<<dp[a][b]<<endl;
| ^~
| dup
|
s929181172 | p00534 | C++ | #include <bits/stdc++.h>
#define MAX 100000000;
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
int a,b;
cin>>a>>b;
int dp[a+1][b+1],a1[a+1],b1[b+1];
r(i,a)cin>>a1[i+1];
r(i,b)cin>>b1[i+1];
r(i,a+1)(j,b+1)dp[i][j]=MAX;
for(int i=1;i<=a;i++)
for(int j=1;j<=b;j++){
dp[i][j]=min(dp[i-1][j-1]+a1[i]*b1[j],dp[i][j-1]);
}
cout<<dp[a][b]<<endl;
} | a.cc: In function 'int main()':
a.cc:11:18: error: 'j' was not declared in this scope
11 | r(i,a+1)(j,b+1)dp[i][j]=MAX;
| ^
|
s989608417 | p00534 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int dp[1050][1050];
int N,M;
int C[1050],D[1050];
int main()
{
for(int i=0;i<1050;i++)
{
for(int j=0;j<1050;j++)
{
dp[i][j]=INF;
}
}
cin >> N >> M;
for(int i=0;i<N;i++)cin >> D[i];
for(int i=0;i<M;i++)cin >> C[i];
dp[0][0]=0;
for(int i=0;i<M;i++)
{
for(int j=0;j<N;j++)
{
if(dp[i][j]==INF)continue;
dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+C[i]*D[j]);
dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
}
}
int ans = INF;
for(int i=0;i<=M;i++)ans = min(ans,dp[i][N]);
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:34: error: 'INF' was not declared in this scope
15 | dp[i][j]=INF;
| ^~~
a.cc:26:38: error: 'INF' was not declared in this scope
26 | if(dp[i][j]==INF)continue;
| ^~~
a.cc:31:19: error: 'INF' was not declared in this scope
31 | int ans = INF;
| ^~~
|
s107445004 | p00534 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int dp[1050][1050];
int N,M;
int C[1050],D[1050];
int main()
{
for(int i=0;i<1050;i++)
{
for(int j=0;j<1050;j++)
{
dp[i][j]=INF;
}
}
cin >> N >> M;
for(int i=0;i<N;i++)cin >> D[i];
for(int i=0;i<M;i++)cin >> C[i];
dp[0][0]=0;
for(int i=0;i<M;i++)
{
for(int j=0;j<N;j++)
{
if(dp[i][j]==INF)continue;
dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+C[i]*D[j]);
dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
}
}
int ans = INF;
for(int i=0;i<=M;i++)ans = min(ans,dp[i][N]);
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:34: error: 'INF' was not declared in this scope
15 | dp[i][j]=INF;
| ^~~
a.cc:26:38: error: 'INF' was not declared in this scope
26 | if(dp[i][j]==INF)continue;
| ^~~
a.cc:31:19: error: 'INF' was not declared in this scope
31 | int ans = INF;
| ^~~
|
s508351334 | p00534 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int dp[1050][1050];
int N,M;
int C[1050],D[1050];
int main()
{
for(int i=0;i<1050;i++)
{
for(int j=0;j<1050;j++)
{
dp[i][j]=INF;
}
}
cin >> N >> M;
for(int i=0;i<N;i++)cin >> D[i];
for(int i=0;i<M;i++)cin >> C[i];
dp[0][0]=0;
for(int i=0;i<M;i++)
{
for(int j=0;j<N;j++)
{
if(dp[i][j]==INF)continue;
dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+C[i]*D[j]);
dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
}
}
int ans = INF;
for(int i=0;i<=M;i++)ans = min(ans,dp[i][N]);
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:34: error: 'INF' was not declared in this scope
15 | dp[i][j]=INF;
| ^~~
a.cc:26:38: error: 'INF' was not declared in this scope
26 | if(dp[i][j]==INF)continue;
| ^~~
a.cc:31:19: error: 'INF' was not declared in this scope
31 | int ans = INF;
| ^~~
|
s215756745 | p00534 | C++ | #include"bits/stdc++.h"
//typedef ll long long
using namespace std;
int d[1001],c[1001];
int n,m;
int minx=9999999;
void sugii(int,long long,int,int);
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>d[i];
}
for(int i=1;i<=m;i++){
cin>>c[i];
}
sugii(1,0,1,1);
cout<<minx<<endl;
}
void sugii(int sumnichi,long long hirou ,int n2,int m2){
if(n2==n+1){
minx=min(minx,hirou);
//cout<<hirou<<endl;
}
if(m2<=m&&n2<=n){
sugii(sumnichi+1, hirou+(d[n2]*c[m2]),n2+1,m2+1);
sugii(sumnichi+1,hirou,n2,m2+1);
}
} | a.cc: In function 'void sugii(int, long long int, int, int)':
a.cc:22:25: error: no matching function for call to 'min(int&, long long int&)'
22 | minx=min(minx,hirou);
| ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:22:25: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
22 | minx=min(minx,hirou);
| ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:22:25: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
22 | minx=min(minx,hirou);
| ~~~^~~~~~~~~~~~
|
s381263073 | p00534 | C++ | #include"bits/stdc++.h"
using namespace std;
int d[1001],c[1001];
int n,m;
int minx=9999999;
void sugii(int,int,int,int);
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>d[i];
}
for(int i=1;i<=m;i++){
cin>>c[i];
}
sugii(1,0,1,1);
cout<<minx<<endl;
}
void sugii(int sumnichi,int hirou ,int n2,int m2){
if(m-m2<n2)continue;
if(n2==n+1){
minx=min(minx,hirou);
//cout<<hirou<<endl;
}
if(m2<=m&&n2<=n){
sugii(sumnichi+1, hirou+(d[n2]*c[m2]),n2+1,m2+1);
sugii(sumnichi+1,hirou,n2,m2+1);
}
} | a.cc: In function 'void sugii(int, int, int, int)':
a.cc:20:20: error: continue statement not within a loop
20 | if(m-m2<n2)continue;
| ^~~~~~~~
|
s238358445 | p00534 | C++ | #include"bits/stdc++.h"
using namespace std;
int d[1001],c[1001];
int n,m;
int minx=9999999;
void sugii(int,int,int,int);
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>d[i];
}
for(int i=1;i<=m;i++){
cin>>c[i];
}
sugii(1,0,1,1);
cout<<minx<<endl;
}
void sugii(int sumnichi,int hirou ,int n2,int m2){
if(m-m2<n2)continue;
if(n2==n+1){
minx=min(minx,hirou);
//cout<<hirou<<endl;
}
if(m2<=m&&n2<=n){
sugii(sumnichi+1, hirou+(d[n2]*c[m2]),n2+1,m2+1);
sugii(sumnichi+1,hirou,n2,m2+1);
}
}
if(m-m2<n2)continue; | a.cc: In function 'void sugii(int, int, int, int)':
a.cc:20:20: error: continue statement not within a loop
20 | if(m-m2<n2)continue;
| ^~~~~~~~
a.cc: At global scope:
a.cc:31:9: error: expected unqualified-id before 'if'
31 | if(m-m2<n2)continue;
| ^~
|
s120046198 | p00534 | C++ | $routes=[]
$distance=[]
$condition=[]
def counter
count = 0
->{
count += 1
return count
}
end
def get_fatigue (now,m,n,now_place)
inner=[]
now.upto(m-n+now) do |i|
inner.push($distance[now_place]*$condition[i-1])#疲労度
end
$routes.push(inner)
end
a=gets.split("\s")
n=a[0].to_i
m=a[1].to_i
n.times do $distance.push(gets.chomp.to_i) end
m.times do $condition.push(gets.chomp.to_i) end
c=counter
n.times do |i|
get_fatigue(c.call,m,n,i)
end
0.upto(m-n) do |y|
0.upto(n-1) do |x|
if x>0 && y>0 then
if $routes[x-1][y]+$routes[x][y]>$routes[x][y-1] then
$routes[x][y]=$routes[x][y-1]
else
$routes[x][y]+= $routes[x-1][y]
end
elsif x>0
$routes[x][y]+=$routes[x-1][y]
else
end
end
end
p $routes[n-1].min
| a.cc:15:53: error: stray '#' in program
15 | inner.push($distance[now_place]*$condition[i-1])#疲労度
| ^
a.cc:1:1: error: '$routes' does not name a type
1 | $routes=[]
| ^~~~~~~
a.cc:10:1: error: 'end' does not name a type
10 | end
| ^~~
|
s428558611 | p00535 | Java | import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}
public staitc void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
int cnt=0;
while(true){
if(bfs(h,w,map)) cnt++;
else break;
}
out.println(cnt);
out.flush();
}
}
private static boolean bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new Pair(i,j));
}
}
}
while(!que.isEmpty()){
Pair p=que.pollFirst();
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt=0;
int[] d={-1,0,1};
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt++;
}
}
if(cnt>=hmap[x][y]){
map[x][y]=INF;
update=true;
}
}
return update;
}
} | Main.java:19: error: <identifier> expected
public staitc void main(String[] args) throws IOException{
^
1 error
|
s965343827 | p00535 | Java | import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
int cnt=0;
while(true){
if(bfs(h,w,map)) cnt++;
else break;
}
out.println(cnt);
out.flush();
}
}
private static boolean bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new Pair(i,j));
}
}
}
while(!que.isEmpty()){
Pair p=que.pollFirst();
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt=0;
int[] d={-1,0,1};
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt++;
}
}
if(cnt>=hmap[x][y]){
map[x][y]=INF;
update=true;
}
}
return update;
}
} | Main.java:51: error: non-static variable this cannot be referenced from a static context
que.offerLast(new Pair(i,j));
^
1 error
|
s293555662 | p00535 | Java | import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};
static class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
int cnt=0;
while(true){
if(bfs(h,w,map)) cnt++;
else break;
}
out.println(cnt);
out.flush();
}
}
private static boolean bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new Pair(i,j));
}
}
}
while(!que.isEmpty()){
Pair p=que.pollFirst();
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt=0;
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j=1) continue loop;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt++;
if(cnt>=hmap[x][y]){
map[x][y]=INF;
update=true;
break loop;
}
}
}
}
return update;
}
} | Main.java:66: error: bad operand types for binary operator '&&'
if(i==1&&j=1) continue loop;
^
first type: boolean
second type: int
1 error
|
s524984084 | p00535 | Java | import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};
static class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
int cnt=0;
while(true){
if(bfs(h,w,map)) cnt++;
else break;
}
out.println(cnt);
out.flush();
}
}
private static boolean bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new Pair(i,j));
}
}
}
while(!que.isEmpty()){
Pair p=que.pollFirst();
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int hxy=hmap[x][y];
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hxy==INF) cnt1++;
else cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
update=true;
break loop;
}
if(cnt2+hxy<8) break loop;
}
}
}
return update;
}
} | Main.java:71: error: cannot find symbol
else cnt2++;
^
symbol: variable cnt2
location: class Main
Main.java:77: error: cannot find symbol
if(cnt2+hxy<8) break loop;
^
symbol: variable cnt2
location: class Main
2 errors
|
s110869314 | p00535 | Java | import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};
static class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
int cnt=0;
while(true){
if(bfs(h,w,map)) cnt++;
else break;
}
out.println(cnt);
out.flush();
}
}
private static boolean bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new Pair(i,j));
}
}
}
while(!que.isEmpty()){
Pair p=que.pollFirst();
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(h[nx][ny]==INF) cnt1++;
else cnt2++;
if(cnt1>=h[x][y]){
map[x][y]=INF;
update=true;
break loop;
}
if(cnt2+h[x][y]<8) break loop;
}
}
}
return update;
}
} | Main.java:70: error: array required, but int found
if(h[nx][ny]==INF) cnt1++;
^
Main.java:72: error: array required, but int found
if(cnt1>=h[x][y]){
^
Main.java:77: error: array required, but int found
if(cnt2+h[x][y]<8) break loop;
^
3 errors
|
s376115425 | p00535 | Java | import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};
static class Pair{
int x;
int y;
Pair(int x,int y){
this.x=x; this.y=y;
}
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
int cnt=0;
while(true){
if(bfs(h,w,map)) cnt++;
else break;
}
out.println(cnt);
out.flush();
}
}
private static boolean bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new Pair(i,j));
}
}
}
while(!que.isEmpty()){
Pair p=que.pollFirst();
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
int hxy=hmap[x][y]
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt1++;
if(hmap[nx][ny]<INF) cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
update=true;
break loop;
}
if(cnt2>8-hxy) break loop;
}
}
}
return update;
}
} | Main.java:64: error: ';' expected
int hxy=hmap[x][y]
^
1 error
|
s557912412 | p00535 | Java | import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};
static class TPair{
int t;
int x;
int y;
TPair(int t,int x,int y){
this.t=t; this.x=x; this.y=y;
}
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
out.println(bfs(h,w,map));
out.flush();
}
}
private static int bfs(int h,int w,int[][] map){
Deque<Pair> que=new ArrayDeque<Pair>();
int[][] hmap=new int[h][];
int ans=-1;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF){
que.offerLast(new TPair(0,i,j));
}
}
}
while(!que.isEmpty()){
TPair p=que.pollFirst();
if(ans!=p.t){
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
ans=p.t;
}
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
int hxy=hmap[x][y];
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt1++;
if(hmap[nx][ny]<INF) cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
break loop;
}
if(cnt2>8-hxy){
que,offerLast(new TPair(ans+1,x,y));
break loop;
}
}
}
return ans;
}
} | Main.java:78: error: not a statement
que,offerLast(new TPair(ans+1,x,y));
^
Main.java:78: error: ';' expected
que,offerLast(new TPair(ans+1,x,y));
^
Main.java:85: error: reached end of file while parsing
}
^
3 errors
|
s868693783 | p00535 | Java | import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};
static class TPair{
int t;
int x;
int y;
TPair(int t,int x,int y){
this.t=t; this.x=x; this.y=y;
}
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
out.println(bfs(h,w,map));
out.flush();
}
}
private static int bfs(int h,int w,int[][] map){
Deque<TPair> que=new ArrayDeque<TPair>();
int[][] hmap=new int[h][];
int ans=-1;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF) que.offerLast(new TPair(0,i,j));
}
}
while(!que.isEmpty()){
TPair p=que.pollFirst();
if(ans!=p.t){
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
ans=p.t;
}
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
int hxy=hmap[x][y];
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt1++;
if(hmap[nx][ny]<INF) cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
break loop;
}
if(cnt2>8-hxy){
que,offerLast(new TPair(ans+1,x,y));
break loop;
}
}
}
return ans;
}
} | Main.java:76: error: not a statement
que,offerLast(new TPair(ans+1,x,y));
^
Main.java:76: error: ';' expected
que,offerLast(new TPair(ans+1,x,y));
^
Main.java:83: error: reached end of file while parsing
}
^
3 errors
|
s086055645 | p00535 | Java | import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};
static class TPair{
int t;
int x;
int y;
TPair(int t,int x,int y){
this.t=t; this.x=x; this.y=y;
}
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
out.println(bfs(h,w,map));
out.flush();
}
}
private static int bfs(int h,int w,int[][] map){
Deque<TPair> que=new ArrayDeque<TPair>();
int[][] hmap=new int[h][];
int ans=-1;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF) que.offerLast(new TPair(0,i,j));
}
}
while(!que.isEmpty()){
TPair p=que.pollFirst();
if(ans!=p.t){
if(update){
boolean update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
ans=p.t;
}
else return ans;
}
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
int hxy=hmap[x][y];
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt1++;
if(hmap[nx][ny]<INF) cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
update=true;
break loop;
}
if(cnt2>8-hxy){
que.offerLast(new TPair(ans+1,x,y));
break loop;
}
}
}
}
}
} | Main.java:52: error: cannot find symbol
if(update){
^
symbol: variable update
location: class Main
Main.java:76: error: cannot find symbol
update=true;
^
symbol: variable update
location: class Main
2 errors
|
s680701206 | p00535 | Java | import java.io.*;
import java.util.StringTokenizer;
import java.util.Deque;
import java.util.ArrayDeque;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;
static int[] d={-1,0,1};
static class TPair{
int t;
int x;
int y;
TPair(int t,int x,int y){
this.t=t; this.x=x; this.y=y;
}
}
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[][] map=new int[h][w];
for(int i=0;i<h;i++){
line=br.readLine();
for(int j=0;j<w;j++){
map[i][j]=(line.charAt(j)=='.')?INF:(int)(line.charAt(j)-'0');
}
}
out.println(bfs(h,w,map));
out.flush();
}
}
private static int bfs(int h,int w,int[][] map){
Deque<TPair> que=new ArrayDeque<TPair>();
int[][] hmap=new int[h][];
boolean update=true;
int ans=-1;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(map[i][j]!=INF) que.offerLast(new TPair(0,i,j));
}
}
while(!que.isEmpty()){
TPair p=que.pollFirst();
if(ans!=p.t){
if(update){
update=false;
for(int i=0;i<h;i++) hmap[i]=map[i].clone();
ans=p.t;
}
else return ans;
}
int x=p.x;
int y=p.y;
int nx;
int ny;
int cnt1=0;
int cnt2=0;
int hxy=hmap[x][y];
loop:
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i==1&&j==1) continue;
nx=x+d[i];
ny=y+d[j];
if(hmap[nx][ny]==INF) cnt1++;
if(hmap[nx][ny]<INF) cnt2++;
if(cnt1>=hxy){
map[x][y]=INF;
update=true;
break loop;
}
if(cnt2>8-hxy){
que.offerLast(new TPair(ans+1,x,y));
break loop;
}
}
}
}
}
} | Main.java:87: error: missing return statement
}
^
1 error
|
s267023045 | p00535 | C | #include<stdio.h>
int h ,w ;
int mx[] = { 1 ,1 ,1 ,-1 ,-1 ,-1 ,0 ,0 } ;
int my[] = { 1 ,-1 ,0 ,1 ,-1 ,0 ,1 ,-1 } ;
char castle[ 1000 ][ 1000 ] ;
char castles[ 1000 ][ 1000 ] ;
char sand[ 1000 ][ 1000 ] ;
int dead ;
char del[ 999 * 999 ][ 2 ] ;
int DEL ;
#define x j + mx[ k ]
#define y i + my[ k ]
#define dy [ 0 ]
#define dx [ 1 ]
void make9( int i ,int j )
{
int k ;
for( k = 0 ; k < 8 ; ++k )
{
int kale = castle[ y ][ x ] ;
if( kale < 9 && kale > -1 )
{
++castle[ y ][ x ] ;
if( castle[ y ][ x ] == 9 )
{
make9( y ,x ) ;
}
}
}
}
void look9( int H ,int W )
{
int i ,j ;
for( i = 1 ; i < H ; ++i )
{
for( j = 1 ; j < W ; ++j )
{
if( castle[ i ][ j ] == 9 )
{
make9( i ,j ) ;
}
}
}
}
void input_del( int i ,int j )
{
int minus = 0 ;
int k ;
for( k = 0 ; k < 8 ; ++k )
{
minus += castles[ y ][ x ] ;
}
if( castle[ i ][ j ] <= -minus )
{
castle[ i ][ j ] = 0 ;
del[ DEL ] dy = i ;
del[ DEL ] dx = j ;
++DEL ;
}
}
void undo( int H ,int W )
{
int i ,j ;
for( i = 1 ; i < H ; ++i )
{
for( j = 1 ; j < W ; ++j )
{
if( castle[ i ][ j ] < 9 )
{
castle[ i ][ j ] = castles[ i ][ j ] ;
}
if( castle[ i ][ j ] > 0 )
{
castles[ i ][ j ] = 0 ;
if( castle[ i ][ j ] == 9 )
{
--dead ;
}
}
}
}
}
void update( int i ,int j )
{
--dead ;
castles[ i ][ j ] = -1 ;
int k ;
for( k = 0 ; k < 8 ; ++k )
{
if( castle[ y ][ x ] < 9 && castle[ y ][ x ] > 0 )
{
input_del( y ,x ) ;
}
}
}
// castle checker
void check( int i = 0 ,int j = 0 )
{
puts( "" ) ;
while( i < h )
{
while( j < w )
{
printf( "%2d" ,castle[ i ][ j++ ] ) ;
}
++i ; j = 0 ;
puts( "" ) ;
}
puts( "" ) ;
}
// castles checker
void checks( int i = 0 ,int j = 0 )
{
puts( "" ) ;
while( i < h )
{
while( j < w )
{
printf( "%2d" ,castles[ i ][ j++ ] ) ;
}
++i ; j = 0 ;
puts( "" ) ;
}
puts( "" ) ;
}
int main()
{
scanf( "%d %d" ,&h ,&w ) ;
int i ,j ;
for( i = 0 ; i < h ; ++i )
{
getchar() ;
for( j = 0 ; j < w ; ++j )
{
char c = getchar() ;
if( c == '.' )
{
castles[ i ][ j ] = castle[ i ][ j ] = -1 ;
}
else
{
++dead ;
castles[ i ][ j ] = castle[ i ][ j ] = c - '0' ;
}
}
}
look9( h - 1 ,w - 1 ) ;
undo( h - 1 ,w - 1 ) ;
for( i = 1 ; i < h - 1 ; ++i )
{
for( j = 1 ; j < w - 1 ; ++j )
{
if( castle[ i ][ j ] > 0 && castle[ i ][ j ] < 9 )
{
input_del( i ,j ) ;
}
}
}
int ans = 0 ;
int next_del = 0 ;
while( dead )
{
++ans ;
int limit = DEL ;
for( i = next_del ,next_del = limit ; i < limit ; ++i )
{
if( del[ i ] dy > 0 )
{
update( del[ i ] dy ,del[ i ] dx ) ;
}
}
}
printf( "%d\n" ,ans ) ;
return 0 ;
} | main.c:127:19: error: expected ';', ',' or ')' before '=' token
127 | void check( int i = 0 ,int j = 0 )
| ^
main.c:147:20: error: expected ';', ',' or ')' before '=' token
147 | void checks( int i = 0 ,int j = 0 )
| ^
|
s598572415 | p00535 | C++ | #include<iostream>
#include<string>
using namespace std;
string S[2000];
int x[2000][2000];
int z[2000][2000];
int main() {
int n, m;
char T[10] = { '.','1','2','3','4','5','6','7','8','9' };
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> S[i];
for (int j = 0; j < m; j++) {
for (int k = 0; k < 10; k++) {
if (S[i][j] == T[k]) {
x[i][j] = k;
}
}
}
}
int t = 1;
int p = 0;
int sum=0;
while (t != 0) {
memset(z, 0, sizeof(z));
t = 0;
sum++;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (x[i][j] >= 1) {
p = 0;
for (int k = -1; k <= 1; k++) {
for (int l = -1; l <= 1; l++) {
if (x[i + k][j + l] == 0) {
p++;
}
}
}
if (p >= x[i][j]) {
z[i][j] = 1;
t++;
}
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (z[i][j] == 1) {
x[i][j] = 0;
}
}
}
}
cout << sum-1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:27:17: error: 'memset' was not declared in this scope
27 | memset(z, 0, sizeof(z));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | #include<string>
|
s051511199 | p00535 | C++ | // JOI14-quest5.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include <stdio.h>
#include <stdlib.h>
#include <queue>
int height, width;
int beach[1000][1000] = { 0 };
using namespace std;
queue<int> que_i, que_j;
int power(int i, int j) {
int count = 0;
if (beach[i - 1][j] == 0) {
count++;
}
if (beach[i][j + 1] == 0) {
count++;
}
if (beach[i + 1][j] == 0) {
count++;
}
if (beach[i][j - 1] == 0) {
count++;
}
if (beach[i - 1][j + 1] == 0) {
count++;
}
if (beach[i + 1][j + 1] == 0) {
count++;
}
if (beach[i + 1][j - 1] == 0) {
count++;
}
if (beach[i - 1][j - 1] == 0) {
count++;
}
return count;
}
void around(int i, int j) {
if (beach[i - 1][j] != 0) {
if (beach[i - 1][j] <= power(i - 1, j)) {
que_i.push(i - 1);
que_j.push(j);
}
}
if (beach[i][j + 1] != 0) {
if (beach[i][j + 1] <= power(i, j + 1)) {
que_i.push(i);
que_j.push(j + 1);
}
}
if (beach[i + 1][j] != 0) {
if (beach[i + 1][j] <= power(i + 1, j)) {
que_i.push(i + 1);
que_j.push(j);
}
}
if (beach[i][j - 1] != 0) {
if (beach[i][j - 1] <= power(i, j - 1)) {
que_i.push(i);
que_j.push(j - 1);
}
}
if (beach[i - 1][j + 1] != 0) {
if (beach[i - 1][j + 1] <= power(i - 1, j + 1)) {
que_i.push(i - 1);
que_j.push(j + 1);
}
}
if (beach[i + 1][j + 1] != 0) {
if (beach[i + 1][j + 1] <= power(i + 1, j + 1)) {
que_i.push(i + 1);
que_j.push(j + 1);
}
}
if (beach[i + 1][j - 1] != 0) {
if (beach[i + 1][j - 1] <= power(i + 1, j - 1)) {
que_i.push(i + 1);
que_j.push(j - 1);
}
}
if (beach[i - 1][j - 1] != 0) {
if (beach[i - 1][j - 1] <= power(i - 1, j - 1)) {
que_i.push(i - 1);
que_j.push(j - 1);
}
}
}
int _tmain(int argc, _TCHAR* argv[])
{
scanf("%d %d", &height, &width);
char c;
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
c = getchar();
if (c == '\n') {
j--;
continue;
}
else if (c == '.') {
beach[i][j] = 0;
}
else {
beach[i][j] = c - 48;
}
}
}
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
if (beach[i][j] != 0) {
if (beach[i][j] <= power(i, j)) {
que_i.push(i);
que_j.push(j);
}
}
}
}
int wave = 0, x[1000], y[1000], count, save, size;
while (que_i.empty() == false) {
wave++;
count = 0;
size = que_i.size();
for (int i = 0; i < size; i++) {
if (beach[que_i.front()][que_j.front()] != 0) {
beach[que_i.front()][que_j.front()] = 0;
y[count] = que_i.front();
x[count] = que_j.front();
count++;
}
que_i.pop();
que_j.pop();
}
for (int i = 0; i < count; i++) {
around(y[i], x[i]);
}
}
printf("%d\n", wave);
return 0;
} | a.cc:98:22: error: '_TCHAR' has not been declared
98 | int _tmain(int argc, _TCHAR* argv[])
| ^~~~~~
|
s486486582 | p00535 | C++ | #include <iostream>
#include <cstdlib>
#include <queue>
#include <Windows.h>
using namespace std;
int x, y;
char m[1024][1024];
int map[1024][1024];
queue<pair<int, pair<int, int> > > q;
pair<int, pair<int, int> > temp;
int dx[8] = { 0, 0, 1, -1, 1, -1, 1, -1 }, dy[8] = { 1, -1, 0, 0, -1, -1, 1, 1 };
void check_map() {
for (int i = 0; i < y; i++) {
for (int i1 = 0; i1 < x; i1++) {
int cnt = 0;
if (m[i][i1] == '.') {
map[i][i1] = 0;
q.push(make_pair(0, make_pair(i, i1)));
}
else {
map[i][i1] = m[i][i1] - '0';
}
}
}
}
int main()
{
int cnt = 0;
cin >> y >> x;
for (int i = 0; i < y; i++) {
for (int i1 = 0; i1 < x; i1++) {
cin >> m[i][i1];
}
}
check_map();
while (!q.empty()) {
temp = q.front();
q.pop();
cnt = temp.first;
for (int i = 0; i < 8; i++) {
if ((map[temp.second.first + dy[i]][temp.second.second + dx[i]] -= 1) == 0)
q.push(make_pair(temp.first + 1, make_pair(temp.second.first + dy[i], temp.second.second + dx[i])));
}
}
cout << cnt << endl;
return 0;
} | a.cc:4:10: fatal error: Windows.h: No such file or directory
4 | #include <Windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s115027162 | p00535 | C++ | #include <queue>
#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#pragma warning(disable : 4996)
#define INF 1000000000
using namespace std;
const vector<int> dx = { 0, 1, 1, 1, 0, -1, -1, -1 };
const vector<int> dy = { -1, -1, 0, 1, 1, 1, 0, -1 };
int H, W; vector<string> M;
vector<vector<int> > state;
int check(int x, int y, int s)
{
int ret = 0;
for (int dir = 0; dir < 8; dir++)
{
if (state[y + dy[dir]][x + dx[dir]] < s || M[y + dy[dir]][x + dx[dir]] == '.')
{
ret++;
}
}
return ret;
}
int main()
{
scanf("%d", &H);
scanf("%d", &W);
M = vector<string>(H);
for (int i = 0; i < H; i++) cin >> M[i];
state = vector<vector<int> >(H, vector<int>(W, INF));
queue<pair<int, int> > que;
for (int i = 1; i < H - 1; i++)
{
for (int j = 1; j < W - 1; j++)
{
if (check(j, i, 1) >= M[i][j] - 48 && M[i][j] != '.')
{
que.push(make_pair(j, i)); state[i][j] = 1;
}
}
}
while (!que.empty())
{
int x = que.front().first;
int y = que.front().second; que.pop();
for (int dir = 0; dir < 8; dir++)
{
int x2 = x + dx[dir];
int y2 = y + dy[dir];
if (state[y2][x2] == INF && M[y2][x2] != '.' && check(x2, y2) >= M[y2][x2])
{
state[y2][x2] = state[y][x] + 1;
que.push(make_pair(x2, y2));
}
}
}
int ret = 0;
for (int i = 1; i < H - 1; i++)
{
for (int j = 1; j < W - 1; j++)
{
if (state[i][j] != INF)
{
ret = max(ret, state[i][j]);
}
}
}
printf("%d\n", ret);
return 0;
} | a.cc: In function 'int main()':
a.cc:70:78: error: too few arguments to function 'int check(int, int, int)'
70 | if (state[y2][x2] == INF && M[y2][x2] != '.' && check(x2, y2) >= M[y2][x2])
| ~~~~~^~~~~~~~
a.cc:21:5: note: declared here
21 | int check(int x, int y, int s)
| ^~~~~
|
s840614350 | p00535 | C++ | #include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
int main(){
scanf("%d%d", &h, &w);
for(int i = 0; i < h; i++){
scanf("%s", &beach[i]);
}
queue< pair<int, int> > Q;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(beach[i][j] == '.'){
Q.push(P(i, j));
} else{
castle[i][j] = beach[i][j] - '0';
}
}
}
while(Q.size()){
P p = Q.front();
Q.pop();
ans = max(ans, times[p.first][p.second]);
for(int i = 0; i < 8; i++){
int y = p.first + dy[i], x = p.second + dx[i];
if(y < 0 || y >= h || x < 0 || x >= w){
continue;
}
castle[y][x]--;
if(castle[y][x] == 0){
Q.push(P(y, x));
times[y][x] = times[p.first][p.second] + 1;
}
}
}
printf("%d\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:21:24: error: 'P' was not declared in this scope
21 | Q.push(P(i, j));
| ^
a.cc:29:9: error: 'P' was not declared in this scope
29 | P p = Q.front();
| ^
a.cc:31:30: error: 'p' was not declared in this scope
31 | ans = max(ans, times[p.first][p.second]);
| ^
a.cc:35:35: error: 'x' was not declared in this scope
35 | if(y < 0 || y >= h || x < 0 || x >= w){
| ^
a.cc:39:23: error: 'x' was not declared in this scope
39 | castle[y][x]--;
| ^
|
s900367172 | p00535 | C++ | #include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
int main(){
scanf("%d%d", &h, &w);
for(int i = 0; i < h; i++){
scanf("%s", &beach[i]);
}
queue< pair<int, int> > Q;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(beach[i][j] == '.'){
Q.push(P(i, j));
} else{
castle[i][j] = beach[i][j] - '0';
}
}
}
while(Q.size()){
P p = Q.front();
Q.pop();
ans = max(ans, times[p.first][p.second]);
for(int i = 0; i < 8; i++){
int y = p.first + dy[i], x = p.second + dx[i];
if(y < 0 || y >= h || x < 0 || x >= w){
continue;
}
castle[y][x]--;
if(castle[y][x] == 0){
Q.push(P(y, x));
times[y][x] = times[p.first][p.second] + 1;
}
}
}
printf("%d\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:21:24: error: 'P' was not declared in this scope
21 | Q.push(P(i, j));
| ^
a.cc:29:9: error: 'P' was not declared in this scope
29 | P p = Q.front();
| ^
a.cc:31:30: error: 'p' was not declared in this scope
31 | ans = max(ans, times[p.first][p.second]);
| ^
a.cc:35:35: error: 'x' was not declared in this scope
35 | if(y < 0 || y >= h || x < 0 || x >= w){
| ^
a.cc:39:23: error: 'x' was not declared in this scope
39 | castle[y][x]--;
| ^
|
s547051404 | p00535 | C++ | #include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
int main(){
scanf("%d%d", &h, &w);
for(int i = 0; i < h; i++){
scanf("%s", &beach[i]);
}
queue< pair<int, int> > Q;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(beach[i][j] == '.'){
Q.push(P(i, j));
} else{
castle[i][j] = beach[i][j] - '0';
}
}
}
while(Q.size()){
pair<int, int> p = Q.front();
Q.pop();
ans = max(ans, times[p.first][p.second]);
for(int i = 0; i < 8; i++){
int y = p.first + dy[i], x = p.second + dx[i];
if(y < 0 || y >= h || x < 0 || x >= w){
continue;
}
castle[y][x]--;
if(castle[y][x] == 0){
Q.push(P(y, x));
times[y][x] = times[p.first][p.second] + 1;
}
}
}
printf("%d\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:21:24: error: 'P' was not declared in this scope
21 | Q.push(P(i, j));
| ^
a.cc:41:24: error: 'P' was not declared in this scope
41 | Q.push(P(y, x));
| ^
|
s137631815 | p00535 | C++ | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int H, W; char s[1009][1009]; bool vis[1009][1009];
int main() {
????????scanf("%d%d", &H, &W);
????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
????????vector<pair<int, int> > v;
????????for (int i = 0; i < H; i++) {
????????????????for (int j = 0; j < W; j++) {
????????????????????????if (s[i][j] == '.' || s[i][j] == '9') continue;
????????????????????????int cnt = 0;
????????????????????????for (int k = -1; k <= 1; k++) {
????????????????????????????????for (int l = -1; l <= 1; l++) {
????????????????????????????????????????int tx = j + l, ty = i + k;
????????????????????????????????????????if (0 <= tx && tx < W && 0 <= ty && ty < H && s[ty][tx] == '.') cnt++;
????????????????????????????????}
????????????????????????}
????????????????????????if (cnt >= s[i][j] - 48) v.push_back(make_pair(j, i));
????????????????}
????????}
????????int ret = 0;
????????for (; !v.empty(); ret++) {
????????????????for (pair<int, int> i : v) s[i.second][i.first] = '.';
????????????????vector<pair<int, int> > w;
????????????????for (pair<int, int> i : v) {
????????????????????????int sx = i.first, sy = i.second;
????????????????????????for (int j = -1; j <= 1; j++) {
????????????????????????????????for (int k = -1; k <= 1; k++) {
????????????????????????????????????????int tx = sx + k, ty = sy + j;
????????????????????????????????????????if (!(0 <= tx && tx < W && 0 <= ty && ty < H)) continue;
????????????????????????????????????????if (s[ty][tx] == '.' || s[ty][tx] == '9' || vis[ty][tx]) continue;
????????????????????????????????????????int cnt = 0;
????????????????????????????????????????for (int l = -1; l <= 1; l++) {
????????????????????????????????????????????????for (int m = -1; m <= 1; m++) {
????????????????????????????????????????????????????????int ux = tx + m, uy = ty + l;
????????????????????????????????????????????????????????if (0 <= ux && ux < W && 0 <= uy && uy < H && s[uy][ux] == '.') cnt++;
????????????????????????????????????????????????}
????????????????????????????????????????}
????????????????????????????????????????if (cnt >= s[ty][tx] - 48) w.push_back(make_pair(tx, ty)), vis[ty][tx] = true;
????????????????????????????????}
????????????????????????}
????????????????}
????????????????for (pair<int, int> i : w) vis[i.second][i.first] = false;
????????????????v = w;
????????}
????????printf("%d\n", ret);
????????return 0;
} | a.cc: In function 'int main()':
a.cc:7:1: error: expected primary-expression before '?' token
7 | ????????scanf("%d%d", &H, &W);
| ^
a.cc:7:2: error: expected primary-expression before '?' token
7 | ????????scanf("%d%d", &H, &W);
| ^
a.cc:7:3: error: expected primary-expression before '?' token
7 | ????????scanf("%d%d", &H, &W);
| ^
a.cc:7:4: error: expected primary-expression before '?' token
7 | ????????scanf("%d%d", &H, &W);
| ^
a.cc:7:5: error: expected primary-expression before '?' token
7 | ????????scanf("%d%d", &H, &W);
| ^
a.cc:7:6: error: expected primary-expression before '?' token
7 | ????????scanf("%d%d", &H, &W);
| ^
a.cc:7:7: error: expected primary-expression before '?' token
7 | ????????scanf("%d%d", &H, &W);
| ^
a.cc:7:8: error: expected primary-expression before '?' token
7 | ????????scanf("%d%d", &H, &W);
| ^
a.cc:7:30: error: expected ':' before ';' token
7 | ????????scanf("%d%d", &H, &W);
| ^
| :
a.cc:7:30: error: expected primary-expression before ';' token
a.cc:7:30: error: expected ':' before ';' token
7 | ????????scanf("%d%d", &H, &W);
| ^
| :
a.cc:7:30: error: expected primary-expression before ';' token
a.cc:7:30: error: expected ':' before ';' token
7 | ????????scanf("%d%d", &H, &W);
| ^
| :
a.cc:7:30: error: expected primary-expression before ';' token
a.cc:7:30: error: expected ':' before ';' token
7 | ????????scanf("%d%d", &H, &W);
| ^
| :
a.cc:7:30: error: expected primary-expression before ';' token
a.cc:7:30: error: expected ':' before ';' token
7 | ????????scanf("%d%d", &H, &W);
| ^
| :
a.cc:7:30: error: expected primary-expression before ';' token
a.cc:7:30: error: expected ':' before ';' token
7 | ????????scanf("%d%d", &H, &W);
| ^
| :
a.cc:7:30: error: expected primary-expression before ';' token
a.cc:7:30: error: expected ':' before ';' token
7 | ????????scanf("%d%d", &H, &W);
| ^
| :
a.cc:7:30: error: expected primary-expression before ';' token
a.cc:7:30: error: expected ':' before ';' token
7 | ????????scanf("%d%d", &H, &W);
| ^
| :
a.cc:7:30: error: expected primary-expression before ';' token
a.cc:8:1: error: expected primary-expression before '?' token
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^
a.cc:8:2: error: expected primary-expression before '?' token
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^
a.cc:8:3: error: expected primary-expression before '?' token
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^
a.cc:8:4: error: expected primary-expression before '?' token
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^
a.cc:8:5: error: expected primary-expression before '?' token
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^
a.cc:8:6: error: expected primary-expression before '?' token
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^
a.cc:8:7: error: expected primary-expression before '?' token
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^
a.cc:8:8: error: expected primary-expression before '?' token
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^
a.cc:8:9: error: expected primary-expression before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
a.cc:8:9: error: expected ':' before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
a.cc:8:9: error: expected ':' before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
a.cc:8:9: error: expected ':' before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
a.cc:8:9: error: expected ':' before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
a.cc:8:9: error: expected ':' before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
a.cc:8:9: error: expected ':' before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
a.cc:8:9: error: expected ':' before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
a.cc:8:9: error: expected ':' before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
| :
a.cc:8:9: error: expected primary-expression before 'for'
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^~~
a.cc:8:25: error: 'i' was not declared in this scope
8 | ????????for (int i = 0; i < H; i++) scanf("%s", s[i]);
| ^
a.cc:9:1: error: expected primary-expression before '?' token
9 | ????????vector<pair<int, int> > v;
| ^
a.cc:9:2: error: expected primary-expression before '?' token
9 | ????????vector<pair<int, int> > v;
| ^
a.cc:9:3: error: expected primary-expression before '?' token
9 | ????????vector<pair<int, int> > v;
| ^
a.cc:9:4: error: expected primary-expression before '?' token
9 | ????????vector<pair<int, int> > v;
| ^
a.cc:9:5: error: expected primary-expression before '?' token
9 | ????????vector<pair<int, int> > v;
| ^
a.cc:9:6: error: expected primary-expression before '?' token
9 | ????????vector<pair<int, int> > v;
| ^
a.cc:9:7: error: expected primary-expression before '?' token
9 | ????????vector<pair<int, int> > v;
| ^
a.cc:9:8: error: expected primary-expression before '?' token
9 | ????????vector<pair<int, int> > v;
| ^
a.cc:9:33: error: expected primary-expression before 'v'
9 | ????????vector<pair<int, int> > v;
| ^
a.cc:9:32: error: expected ':' before 'v'
9 | ????????vector<pair<int, int> > v;
| ^~
| :
a.cc:9:33: error: 'v' was not declared in this scope
9 | ????????vector<pair<int, int> > v;
| ^
a.cc:9:34: error: expected ':' before ';' token
9 | ????????vector<pair<int, int> > v;
| ^
| :
a.cc:9:34: error: expected primary-expression before ';' token
a.cc:9:34: error: expected ':' before ';' token
9 | ????????vector<pair<int, int> > v;
| ^
| :
a.cc:9:34: error: expected primary-expression before ';' token
a.cc:9:34: error: expected ':' before ';' token
9 | ????????vector<pair<int, int> > v;
| ^
| :
a.cc:9:34: error: expected primary-expression before ';' token
a.cc:9:34: error: expected ':' before ';' token
9 | ????????vector<pair<int, int> > v;
| ^
| :
a.cc:9:34: error: expected primary-expression before ';' token
a.cc:9:34: error: expected ':' before ';' token
9 | ????????vector<pair<int, int> > v;
| ^
| :
a.cc:9:34: error: expected primary-expression before ';' token
a.cc:9:34: error: expected ':' before ';' token
9 | ????????vector<pair<int, int> > v;
| ^
| :
a.cc:9:34: error: expected primary-expression before ';' token
a.cc:9:34: error: expected ':' before ';' token
9 | ????????vector<pair<int, int> > v;
| ^
| :
a.cc:9:34: error: expected primary-expression before ';' token
a.cc:10:1: error: expected primary-expression before '?' token
10 | ????????for (int i = 0; i < H; i++) {
| ^
a.cc:10:2: error: expected primary-expression before '?' token
10 | ????????for (int i = 0; i < H; i++) {
| ^
a.cc:10:3: error: expected primary-expression before '?' token
10 | ????????for (int i = 0; i < H; i++) {
| ^
a.cc:10:4: error: expected primary-expression before '?' token
10 | ????????for (int i = 0; i < H; i++) {
| ^
a.cc:10:5: error: expected primary-expression before '?' token
10 | ????????for (int i = 0; i < H; i++) {
| ^
a.cc:10:6: error: expected primary-expression before '?' token
10 | ????????for (int i = 0; i < H; i++) {
|
s648537431 | p00535 | C++ | #include "iostream"
#include "queue"
#include "Utility"
#include "math.h"
using namespace std;
int H, W;
char status[1002][1002];
int field[1002][1002];
pair<int, int> dir[8] = {make_pair(0,1),make_pair(1,1),make_pair(1,0),make_pair(1,-1),make_pair(0,-1),make_pair(-1,-1),make_pair(-1,0),make_pair(-1,1)};
queue<pair<int,int> > Q;
queue<pair<int, int> >del;
int ans = 0;
int box = 0;
int num = 0;
int x, y;
int main() {
cin >> H >>W;
for (int i = 1; i <= H; i++) {
for (int j = 1; j <= W; j++) {
cin >> status[i][j];
if (status[i][j] == '.') {
field[i][j] = 0;
}
else {
field[i][j] = status[i][j] - '0';
}
}
}
/*for (int i = 1; i <= H; i++) {
for (int j = 1; j <= W; j++) {
cout << field[i][j];
}
cout << "\n";
}
cout << "\n";*/
for (int i = 1; i <= H; i++) {
for (int j = 1; j <= W; j++) {
box = 0;
if (field[i][j] != 0) {
for (int k = 0; k < 8; k++) {
if (field[i + dir[k].first][j + dir[k].second] == 0)box++;
}
if (box >= field[i][j]) {
Q.push(make_pair(i, j));
ans = 1;
}
}
}
}
del = Q;
while (!del.empty()) {
y = del.front().first;
x = del.front().second;
field[y][x] = 0;
del.pop();
}
while (1) {
/*for (int i = 1; i <= H; i++) {
for (int j = 1; j <= W; j++) {
cout << field[i][j];
}
cout << "\n";
}
cout << "\n";*/
num = Q.size();
for (int i = 0; i < num; i++) {
y = Q.front().first;
x = Q.front().second;
for (int j = 0; j < 8; j++) {
if (field[y + dir[j].first][x + dir[j].second] != 0) {
box = 0;
for (int k = 0; k < 8; k++) {
if (field[y + dir[j].first + dir[k].first][x + dir[j].second + dir[k].second] == 0)box++;
}
if (box >= field[y + dir[j].first][x + dir[j].second]) {
Q.push(make_pair(y + dir[j].first, x + dir[j].second));
}
}
}
Q.pop();
}
if (Q.empty())break;
ans++;
del = Q;
while (!del.empty()) {
y = del.front().first;
x = del.front().second;
field[y][x] = 0;
del.pop();
}
}
cout << ans << "\n";
return 0;
} | a.cc:3:10: fatal error: Utility: No such file or directory
3 | #include "Utility"
| ^~~~~~~~~
compilation terminated.
|
s307290633 | p00535 | C++ | #include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
inline int input(){
int temp;
scanf("%d", &temp);
return temp;
}
int main(){
h = input();
w = input();
for(int i = 0; i < h; i++){
beach[i] = input();
}
queue<P> Q;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(beach[i][j] == '.'){
Q.push(P(i, j));
} else{
castle[i][j] = beach[i][j] - '0';
}
}
}
while(Q.size()){
P p = Q.front();
Q.pop();
ans = max(ans, times[p.first][p.second]);
for(int i = 0; i < 8; i++){
int y = p.first + dy[i], x = p.second + dx[i];
if(y < 0 || y >= h || x < 0 || x >= w){
continue;
}
castle[y][x]--;
if(castle[y][x] == 0){
Q.push(P(y, x));
times[y][x] = times[p.first][p.second] + 1;
}
}
}
printf("%d\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:22:18: error: incompatible types in assignment of 'int' to 'char [1001]'
22 | beach[i] = input();
| ~~~~~~~~~^~~~~~~~~
|
s741892807 | p00535 | C++ | #include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
inline int input_i(){
int temp;
scanf("%d", &temp);
return temp;
}
inline char input_c(){
char temp;
scanf("%c", &temp);
return temp;
}
int main(){
h = input_i();
w = input_i();
for(int i = 0; i < h; i++){
beach[i] = input_c();
}
queue<P> Q;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(beach[i][j] == '.'){
Q.push(P(i, j));
} else{
castle[i][j] = beach[i][j] - '0';
}
}
}
while(Q.size()){
P p = Q.front();
Q.pop();
ans = max(ans, times[p.first][p.second]);
for(int i = 0; i < 8; i++){
int y = p.first + dy[i], x = p.second + dx[i];
if(y < 0 || y >= h || x < 0 || x >= w){
continue;
}
castle[y][x]--;
if(castle[y][x] == 0){
Q.push(P(y, x));
times[y][x] = times[p.first][p.second] + 1;
}
}
}
printf("%d\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:29:18: error: incompatible types in assignment of 'char' to 'char [1001]'
29 | beach[i] = input_c();
| ~~~~~~~~~^~~~~~~~~~~
|
s660629903 | p00535 | C++ | #include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
inline int input_i(){
int temp;
scanf("%d", &temp);
return temp;
}
inline string input_c(){
string temp;
scanf("%s", temp);
return temp;
}
int main(){
h = input_i();
w = input_i();
for(int i = 0; i < h; i++){
beach[i] = input_s();
}
queue<P> Q;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(beach[i][j] == '.'){
Q.push(P(i, j));
} else{
castle[i][j] = beach[i][j] - '0';
}
}
}
while(Q.size()){
P p = Q.front();
Q.pop();
ans = max(ans, times[p.first][p.second]);
for(int i = 0; i < 8; i++){
int y = p.first + dy[i], x = p.second + dx[i];
if(y < 0 || y >= h || x < 0 || x >= w){
continue;
}
castle[y][x]--;
if(castle[y][x] == 0){
Q.push(P(y, x));
times[y][x] = times[p.first][p.second] + 1;
}
}
}
printf("%d\n", ans);
return 0;
} | a.cc:18:8: error: 'string' does not name a type; did you mean 'stdin'?
18 | inline string input_c(){
| ^~~~~~
| stdin
a.cc: In function 'int main()':
a.cc:29:20: error: 'input_s' was not declared in this scope; did you mean 'input_i'?
29 | beach[i] = input_s();
| ^~~~~~~
| input_i
|
s468548139 | p00535 | C++ | #include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
inline int input_i(){
int temp;
scanf("%d", &temp);
return temp;
}
inline string input_s(){
string temp;
scanf("%s", temp);
return temp;
}
int main(){
h = input_i();
w = input_i();
for(int i = 0; i < h; i++){
beach[i] = input_s();
}
queue<P> Q;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(beach[i][j] == '.'){
Q.push(P(i, j));
} else{
castle[i][j] = beach[i][j] - '0';
}
}
}
while(Q.size()){
P p = Q.front();
Q.pop();
ans = max(ans, times[p.first][p.second]);
for(int i = 0; i < 8; i++){
int y = p.first + dy[i], x = p.second + dx[i];
if(y < 0 || y >= h || x < 0 || x >= w){
continue;
}
castle[y][x]--;
if(castle[y][x] == 0){
Q.push(P(y, x));
times[y][x] = times[p.first][p.second] + 1;
}
}
}
printf("%d\n", ans);
return 0;
} | a.cc:18:8: error: 'string' does not name a type; did you mean 'stdin'?
18 | inline string input_s(){
| ^~~~~~
| stdin
a.cc: In function 'int main()':
a.cc:29:20: error: 'input_s' was not declared in this scope; did you mean 'input_i'?
29 | beach[i] = input_s();
| ^~~~~~~
| input_i
|
s431982546 | p00535 | C++ | #include <cstdio>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int, int> P;
int h, w, ans;
int castle[1001][1001], times[1001][1001];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
char beach[1001][1001];
inline int input_i(){
int temp;
scanf("%d", &temp);
return temp;
}
inline string input_s(){
string temp;
scanf("%s", temp);
return temp;
}
int main(){
h = input_i();
w = input_i();
for(int i = 0; i < h; i++){
beach[i] = input_s();
}
queue<P> Q;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(beach[i][j] == '.'){
Q.push(P(i, j));
} else{
castle[i][j] = beach[i][j] - '0';
}
}
}
while(Q.size()){
P p = Q.front();
Q.pop();
ans = max(ans, times[p.first][p.second]);
for(int i = 0; i < 8; i++){
int y = p.first + dy[i], x = p.second + dx[i];
if(y < 0 || y >= h || x < 0 || x >= w){
continue;
}
castle[y][x]--;
if(castle[y][x] == 0){
Q.push(P(y, x));
times[y][x] = times[p.first][p.second] + 1;
}
}
}
printf("%d\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:30:18: error: incompatible types in assignment of 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char [1001]'
30 | beach[i] = input_s();
| ~~~~~~~~~^~~~~~~~~~~
|
s744152774 | p00535 | C++ | #include <queue>
#include <string>
#include <iostream>
using namespace std;
struct state { int x, y; };
int dx[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
int dy[] = { 1, 1, 0, -1, -1, -1, 0, 1 };
int H, W, dist[1009][1009]; string s[1009];
int main() {
ios::sync_with_stdio(false);
cin >> H >> W;
queue<state> que;
for (int i = 0; i < H; i++) {
cin >> s[i];
for (int j = 0; j < W; j++) {
if (s[i][j] == '.') {
dist[i][j] = 0;
que.push(state{ i, j });
}
else dist[i][j] = -1;
}
}
int ret = 0;
while (!que.empty()) {
state u = que.front(); que.pop();
ret = max(ret, dist[u.x][u.y]);
for (int i = 0; i < 8; i++) {
int tx = u.x + dx[i], ty = u.y + dy[i];
if (0 <= tx && tx < H && 0 <= ty && ty < W && dist[tx][ty] == -1) {
vector<int> v;
for (int j = 0; j < 8; j++) {
int rx = tx + dx[j], ry = ty + dy[j];
if (0 <= rx && rx < H && 0 <= ry && ry < W && dist[rx][ry] != -1) {
v.push_back(dist[rx][ry]);
}
}
sort(v.begin(), v.end());
if (v.size() >= s[tx][ty] - 48) {
dist[tx][ty] = v[s[tx][ty] - 49] + 1;
que.push(state{ tx, ty });
}
}
}
}
cout << ret << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:37:33: error: 'sort' was not declared in this scope; did you mean 'short'?
37 | sort(v.begin(), v.end());
| ^~~~
| short
|
s428141033 | p00535 | C++ | int main() {
int h, w;
cin >> h >> w;
vector<string> vec;
for (int i = 0; i < h; i++) {
string t;
cin >> t;
vec.emplace_back(t);
}
set<pair<int, int>> se;
for (int i = 1; i < h - 1; i++) {
for (int j = 1; j < w - 1; j++) {
if (vec[i][j] == '.')continue;
int cnt = 0;
for (int k = -1; k <= 1; k++) {
for (int l = -1; l <= 1; l++) {
if (i == 0 && j == 0)continue;
if (vec[i + k][j + l] == '.') {
cnt++;
}
}
}
if (cnt >= vec[i][j] - '0') {
se.insert(make_pair(i, j));
}
}
}
for (auto i : se) {
vec[i.first][i.second] = '.';
}
int ans = 0;
for (;; ans++) {
if (se.empty())break;
set<pair<int, int>> temp;
for (auto i : se) {
for (int j = -1; j <= 1; j++) {
for (int k = -1; k <= 1; k++) {
if (j == 0 && k == 0)continue;
int x = i.first + j, y = i.second + k;
if (vec[x][y] == '.')continue;
int cnt = 0;
for (int l = -1; l <= 1; l++) {
for (int m = -1; m <= 1; m++) {
if (l == 0 && m == 0)continue;
if (vec[x + l][y + m] == '.') {
cnt++;
}
}
}
if (cnt >= vec[x][y] - '0') {
temp.insert(make_pair(x, y));
}
}
}
}
se = temp;
for (auto i : se) {
vec[i.first][i.second] = '.';
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:3:9: error: 'cin' was not declared in this scope
3 | cin >> h >> w;
| ^~~
a.cc:4:9: error: 'vector' was not declared in this scope
4 | vector<string> vec;
| ^~~~~~
a.cc:4:16: error: 'string' was not declared in this scope
4 | vector<string> vec;
| ^~~~~~
a.cc:4:24: error: 'vec' was not declared in this scope
4 | vector<string> vec;
| ^~~
a.cc:6:23: error: expected ';' before 't'
6 | string t;
| ^~
| ;
a.cc:7:24: error: 't' was not declared in this scope
7 | cin >> t;
| ^
a.cc:10:9: error: 'set' was not declared in this scope
10 | set<pair<int, int>> se;
| ^~~
a.cc:10:13: error: 'pair' was not declared in this scope
10 | set<pair<int, int>> se;
| ^~~~
a.cc:10:18: error: expected primary-expression before 'int'
10 | set<pair<int, int>> se;
| ^~~
a.cc:24:33: error: 'se' was not declared in this scope
24 | se.insert(make_pair(i, j));
| ^~
a.cc:24:43: error: 'make_pair' was not declared in this scope
24 | se.insert(make_pair(i, j));
| ^~~~~~~~~
a.cc:28:23: error: 'se' was not declared in this scope
28 | for (auto i : se) {
| ^~
a.cc:33:21: error: 'se' was not declared in this scope
33 | if (se.empty())break;
| ^~
a.cc:34:26: error: expected primary-expression before 'int'
34 | set<pair<int, int>> temp;
| ^~~
a.cc:35:31: error: 'se' was not declared in this scope
35 | for (auto i : se) {
| ^~
a.cc:40:52: error: 'y' was not declared in this scope
40 | if (vec[x][y] == '.')continue;
| ^
a.cc:45:72: error: 'y' was not declared in this scope
45 | if (vec[x + l][y + m] == '.') {
| ^
a.cc:50:59: error: 'y' was not declared in this scope
50 | if (cnt >= vec[x][y] - '0') {
| ^
a.cc:51:49: error: 'temp' was not declared in this scope
51 | temp.insert(make_pair(x, y));
| ^~~~
a.cc:51:61: error: 'make_pair' was not declared in this scope
51 | temp.insert(make_pair(x, y));
| ^~~~~~~~~
a.cc:56:17: error: 'se' was not declared in this scope
56 | se = temp;
| ^~
a.cc:56:22: error: 'temp' was not declared in this scope
56 | se = temp;
| ^~~~
a.cc:61:9: error: 'cout' was not declared in this scope
61 | cout << ans << endl;
| ^~~~
a.cc:61:24: error: 'endl' was not declared in this scope
61 | cout << ans << endl;
| ^~~~
|
s255320228 | p00535 | C++ | #include <iostream>
#include <utility>
#include <vector>
using namespace std;
int h,w;
char bch[1003][1003];
int bfs ()
{
int ans=0, cas[1003][1003],c;
vector<pair<int, int>> que, vec;
for (int i=1; i<h-1; i++)
{
for (int j=1; j<w-1; j++)
{
if (bch[i][j]!='.')
{
c=0;
if (bch[i-1][j-1]=='.') c++;
if (bch[i-1][j]=='.') c++;
if (bch[i-1][j+1]=='.') c++;
if (bch[i][j-1]=='.') c++;
if (bch[i][j+1]=='.') c++;
if (bch[i+1][j-1]=='.') c++;
if (bch[i+1][j]=='.') c++;
if (bch[i+1][j+1]=='.') c++;
cas[i][j]=cbch[i][j]-'0'-c;
if (cas[i][j]<=0) que.push_back({i, j});
}
}
}
while (1)
{
if (que.empty())
{
ans++;
for (auto u : vec)
{
int i=u.first, j=u.second;
if (bch[i-1][j-1]!='.') { cas[i-1][j-1]--; if (cas[i-1][j-1]==0) que.push_back({i-1, j-1}); }
if (bch[i-1][j]!='.') { cas[i-1][j]--; if (cas[i-1][j]==0) que.push_back({i-1, j}); }
if (bch[i-1][j+1]!='.') { cas[i-1][j+1]--; if (cas[i-1][j+1]==0) que.push_back({i-1, j+1}); }
if (bch[i][j-1]!='.') { cas[i][j-1]--; if (cas[i][j-1]==0) que.push_back({i, j-1}); }
if (bch[i][j+1]!='.') { cas[i][j+1]--; if (cas[i][j+1]==0) que.push_back({i, j+1}); }
if (bch[i+1][j-1]!='.') { cas[i+1][j-1]--; if (cas[i+1][j-1]==0) que.push_back({i+1, j-1}); }
if (bch[i+1][j]!='.') { cas[i+1][j]--; if (cas[i+1][j]==0) que.push_back({i+1, j}); }
if (bch[i+1][j+1]!='.') { cas[i+1][j+1]--; if (cas[i+1][j+1]==0) que.push_back({i+1, j+1}); }
}
vec.clear();
}
if (que.empty()) break;
vec.swap(que);
}
return ans;
}
int main()
{
cin>>h>>w;
for (int i=0; i<h; i++) for (int j=0; j<w; j++) cin>>bch[i][j];
cout<<bfs()<<'\n';
return 0;
}
| a.cc: In function 'int bfs()':
a.cc:29:27: error: 'cbch' was not declared in this scope; did you mean 'bch'?
29 | cas[i][j]=cbch[i][j]-'0'-c;
| ^~~~
| bch
|
s305355795 | p00536 | C++ | #include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775807
#define LL_MAX 9223372036854775807
#define PI 3.14159265359
int N;
LL D;
LL X[30],Y[30];
LL ans;
vector<pair<LL,LL> > mae; //X_b-X_a , Y_b-X_b
void mae_search(int now, LL f, LL s){
if(now == N/2){
mae.push_back(MP(f,s));
return;
}
mae_search(now+1, f, s);
mae_search(now+1, f-X[now], s-Y[now]);
mae_search(now+1, f+X[now], s+Y[now]);
}
void ato_search(int now, LL f, LL s){
if(now == N){
auto a = lower_bound(mae.begin(), mae.end(), MP(-D-f, (LL)0) );
auto b = upper_bound(mae.begin(), mae.end(), MP(D-f, LL_MAX) );
for(auto itr=a; itr!=b; itr++){
ans = max(ans, s+itr->second);
}
return;
}
ato_search(now+1, f, s);
ato_search(now+1, f-X[now], s-Y[now]);
ato_search(now+1, f+X[now], s+Y[now]);
}
int main() {
iostream::sync_with_stdio(false);
cin >> N >> D;
for(int i=0; i<N; i++) cin >> X[i] >> Y[i];
mae_search(0, 0, 0);
sort(mae.begin(), mae.end());
ans = 0;
ato_search(N/2, 0, 0);
cout << ans << endl;
return 0;
}
| In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
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/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_less_iter::operator()(_Value&, _Iterator) const [with _Value = const std::pair<long long int, long int>; _Iterator = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >]':
/usr/include/c++/14/bits/stl_algo.h:1993:14: required from '_ForwardIterator std::__upper_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = pair<long long int, long int>; _Compare = __gnu_cxx::__ops::_Val_less_iter]'
1993 | if (__comp(__val, __middle))
| ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2028:32: required from '_FIter std::upper_bound(_FIter, _FIter, const _Tp&) [with _FIter = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = pair<long long int, long int>]'
2028 | return std::__upper_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
2029 | __gnu_cxx::__ops::__val_less_iter());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:51:23: required from here
51 | auto b = upper_bound(mae.begin(), mae.end(), MP(D-f, LL_MAX) );
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:98:22: error: no match for 'operator<' (operand types are 'const std::pair<long long int, long int>' and 'std::pair<long long int, long long int>')
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<long long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<long long int, long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<long long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<long long int, long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<long long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<long long int, long int>' is not derived from 'const std::move_iterator<_IteratorL>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: deduced conflicting types for parameter '_T2' ('long int' and 'long long int')
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'std::pair<long long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'std::pair<long long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'std::pair<long long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<long long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
98 | { return __val < *__it; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:98:22: note: 'const std::pair<long long int, long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
98 | |
s960697885 | p00536 | C++ | #include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359
//最大値 セグメント木
struct SegmentTree{
private:
vector<LL> nodes;
int n;
public:
void reset(int N){ //初期化する O(N)
nodes.clear();
n = 1;
while(n < N) n *= 2;
n = 2 * n -1;
for(int i=0; i<n; i++) nodes.push_back(LL_MIN);
}
void update(int i, LL x){ //値を変更する O(log N)
i += n / 2;
nodes[i] = x;
while(i > 0){
i = (i-1)/2; //親の取得は(i-1)/2
nodes[i] = max(nodes[i*2+1], nodes[i*2+2]); //子の取得はi*2+1,i*2+2
}
}
LL maximum(int a, int b){ //[a,b)の最大値を求める O(log N)
return query(a, b, 0, 0, n/2+1);
}
private:
LL query(int a, int b, int k, int l, int r){
if(r <= a || b <= l) return LL_MIN; //交差する場合
if(a <= l && r <= b) return nodes[k]; //完全に含む場合
LL valueL = query(a, b, k*2+1, l, (l+r)/2);
LL valueR = query(a, b, k*2+2, (l+r)/2, r);
return max(valueL, valueR);
}
};
int N;
LL D;
LL X[30],Y[30];
SegmentTree st;
LL ans;
vector<pair<LL,LL> > mae; //X_b-X_a , Y_b-X_b
void mae_search(int now, LL f, LL s){
if(now == N/2){
mae.push_back(MP(f,s));
return;
}
mae_search(now+1, f, s);
mae_search(now+1, f-X[now], s-Y[now]);
mae_search(now+1, f+X[now], s+Y[now]);
}
void ato_search(int now, LL f, LL s){
if(now == N){
int a = lower_bound(mae.begin(), mae.end(), MP(-D-f, (LL)0) ) - mae.begin();
int b = upper_bound(mae.begin(), mae.end(), MP(D-f, LL_MAX) ) - mae.begin();
//ans = max(ans, st.maximum(a, b));
for(auto itr=a; itr!=b; itr++){
ans = max(ans, s+itr->second);
}
return;
}
ato_search(now+1, f, s);
ato_search(now+1, f-X[now], s-Y[now]);
ato_search(now+1, f+X[now], s+Y[now]);
}
int main() {
iostream::sync_with_stdio(false);
cin >> N >> D;
for(int i=0; i<N; i++) cin >> X[i] >> Y[i];
mae_search(0, 0, 0);
sort(mae.begin(), mae.end());
st.reset(mae.size());
for(int i=0; i<mae.size(); i++){
st.update(i, mae[i].second);
}
ans = 0;
ato_search(N/2, 0, 0);
cout << ans << endl;
return 0;
}
| a.cc: In function 'void ato_search(int, long long int, long long int)':
a.cc:89:45: error: base operand of '->' is not a pointer
89 | ans = max(ans, s+itr->second);
| ^~
|
s008616833 | p00536 | C++ | #include<stdio.h>
#include<algorithm>
#include<queue>
using namespace std;
long long c[32];
long long d[32];
int pow3[17];
pair<long long,long long>e[14444444];
long long segtree[1<<25];
long long mp;
long long val;
void query(int a,int b,int c,int d,int e){
queue<pair<pair<int,int>,int> > S;
S.push(make_pair(make_pair(a,b),e));
while(S.size()){
int A=S.top().first.first;
int B=S.top().first.second;
int E=S.top().second;
S.pop();
if(d<A||B<c)continue;
if(segtree[E]<=val)continue;
if(c<=A&&B<=d)val=max(segtree[E],val);
else{
S.push(make_pair(make_pair(A,(A+B)/2),E*2));
S.push(make_pair(make_pair((A+B)/2+1,B),E*2+1));
}
}
}
void update(int a,long long b){
a+=(1<<24);
while(a){
segtree[a]=max(segtree[a],b);
a/=2;
}
}
int main(){
int a;
long long b;
scanf("%d%lld",&a,&b);
for(int i=0;i<a;i++)scanf("%lld%lld",c+i,d+i);
int L=a/2;
int R=a-L;
pow3[0]=1;
for(int i=1;i<17;i++)pow3[i]=pow3[i-1]*3;
for(int i=0;i<pow3[L];i++){
for(int j=0;j<L;j++){
int t=i%pow3[j+1]/pow3[j];
if(t==1){e[i].first+=c[j];e[i].second+=d[j];}
if(t==2){e[i].first-=c[j];e[i].second-=d[j];}
}
}
std::sort(e,e+pow3[L]);
for(int i=0;i<(1<<25);i++)segtree[i]=-999999999999999999LL;
for(int i=0;i<pow3[L];i++)update(i,e[i].second);
//for(int i=0;i<pow3[L];i++)printf("%lld %lld\n",e[i].first,e[i].second);
long long ret=-999999999999999999LL;
for(int i=0;i<pow3[R];i++){
long long h=0;
long long w=0;
for(int j=0;j<R;j++){
int t=i%pow3[j+1]/pow3[j];
if(t==1){h+=c[L+j];w+=d[L+j];}
if(t==2){h-=c[L+j];w-=d[L+j];}
}
int left=lower_bound(e,e+pow3[L],make_pair(-b-h,-999999999999999999LL))-e;
int right=lower_bound(e,e+pow3[L],make_pair(b-h,999999999999999999LL))-e-1;
long long mp=ret-w;
val=-999999999999999999LL;
if(left<=right){
query(0,(1<<24)-1,left,right,1);
ret=max(ret,w+val);
}
}
printf("%lld\n",ret);
} | a.cc: In function 'void query(int, int, int, int, int)':
a.cc:16:25: error: 'class std::queue<std::pair<std::pair<int, int>, int> >' has no member named 'top'; did you mean 'pop'?
16 | int A=S.top().first.first;
| ^~~
| pop
a.cc:17:25: error: 'class std::queue<std::pair<std::pair<int, int>, int> >' has no member named 'top'; did you mean 'pop'?
17 | int B=S.top().first.second;
| ^~~
| pop
a.cc:18:25: error: 'class std::queue<std::pair<std::pair<int, int>, int> >' has no member named 'top'; did you mean 'pop'?
18 | int E=S.top().second;
| ^~~
| pop
|
s835496954 | p00536 | C++ | //q6.cpp
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
typedef long long ll;
using namespace std;
#define MAX_N 16777216
long long n,d,xy[40][2],ans,c,f,s,f2;
pair<pair<ll,ll>,ll> seg[MAX_N*2];
ll segq(ll ss,ll sk,int k=0){
ll A=seg[k].first.first;
ll B=seg[k].first.second;
if((-ss-d)<=A && B<=(d-ss)) return seg[k].second+sk;
if(B<(-ss-d) || (d-ss)<A)
return 0;
return max(segq(ss,sk,k*2+1),segq(ss,sk,k*2+2));
}
void dfs1(ll h=0,ll As=0,ll Bs=0,ll Ak=0,ll Bk=0){
if(h==(n+1)/2){
seg[c+MAX_N-1]=make_pair(make_pair(As-Bs,As-Bs),Bk-Ak);
c++;
return;
}
dfs1(a,h+1,As+xy[h][0],Bs,Ak+xy[h][1],Bk);
dfs1(a,h+1,As,Bs+xy[h][0],Ak,Bk+xy[h][1]);
dfs1(a,h+1,As,Bs,Ak,Bk);
return;
}
void dfs2(int a,ll h=0,ll As=0,ll Bs=0,ll Ak=0,ll Bk=0){
if(h==n){
ans=max(ans,segq(As-Bs,Bk-Ak));
return;
}
dfs2(h+1,As+xy[h][0],Bs,Ak+xy[h][1],Bk);
dfs2(h+1,As,Bs+xy[h][0],Ak,Bk+xy[h][1]);
dfs2(h+1,As,Bs,Ak,Bk);
return;
}
int main(){
scanf("%lld%lld",&n,&d);
for(int i=0;i<n;i++)
scanf("%lld%lld",&xy[i][0],&xy[i][1]);
dfs1();
sort(&seg[MAX_N-1],&seg[c+MAX_N-1]);
for(int i=MAX_N-2;i>=0;i--){
f = min(seg[i*2+1].first.first,seg[i*2+2].first.first);
f2 = max(seg[i*2+1].first.second,seg[i*2+2].first.second);
s = max(seg[i*2+1].second,seg[i*2+2].second);
seg[i]=make_pair(make_pair(f,f2),s);
}
dfs2((n+1)/2);
printf("%lld\n",ans);
return 0;
} | a.cc: In function 'void dfs1(ll, ll, ll, ll, ll)':
a.cc:47:10: error: 'a' was not declared in this scope
47 | dfs1(a,h+1,As+xy[h][0],Bs,Ak+xy[h][1],Bk);
| ^
|
s258451171 | p00536 | C++ | //q6.cpp
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
typedef long long ll;
using namespace std;
#define MAX_N 16777216
long long n,d,xy[40][2],ans,c,f,s,f2;
struct NODE{
ll a;
ll b;
ll c;
NODE(ll A,ll B,ll C){
a = A;
b = B;
c = C;
}
bool operator<( const NODE &B) const {
return a==B.a?(b==B.b?c<B.c:b<B.b):a<B.a;
}
};
NODE seg[MAX_N*2];
//pair<pair<ll,ll>,ll> seg[MAX_N*2];
ll segq(ll ss,ll sk,int k=0){
ll A=seg[k].a;
ll B=seg[k].b;
if((-ss-d)<=A && B<=(d-ss)) return seg[k].c+sk;
if(B<(-ss-d) || (d-ss)<A)
return 0;
return max(segq(ss,sk,k*2+1),segq(ss,sk,k*2+2));
}
void dfs1(ll h=0,ll As=0,ll Bs=0,ll Ak=0,ll Bk=0){
if(h==(n+1)/2){
seg[c+MAX_N-1]=NODE(As-Bs,As-Bs,Bk-Ak);
//make_pair(make_pair(As-Bs,As-Bs),Bk-Ak);
c++;
return;
}
h++;
dfs1(h,As+xy[h][0],Bs,Ak+xy[h][1],Bk);
dfs1(h,As,Bs+xy[h][0],Ak,Bk+xy[h][1]);
dfs1(h,As,Bs,Ak,Bk);
return;
}
void dfs2(ll h=0,ll As=0,ll Bs=0,ll Ak=0,ll Bk=0){
if(h==n){
ans=max(ans,segq(As-Bs,Bk-Ak));
return;
}
h++;
dfs2(h,As+xy[h][0],Bs,Ak+xy[h][1],Bk);
dfs2(h,As,Bs+xy[h][0],Ak,Bk+xy[h][1]);
dfs2(h,As,Bs,Ak,Bk);
return;
}
int main(){
scanf("%lld%lld",&n,&d);
for(int i=0;i<n;i++)
scanf("%lld%lld",&xy[i][0],&xy[i][1]);
dfs1();
sort(&seg[MAX_N-1],&seg[c+MAX_N-1]);
for(int i=MAX_N-2;i>=0;i--){
seg[i]=NODE(min(seg[i*2+1].a,seg[i*2+2].a),
max(seg[i*2+1].b,seg[i*2+2].b),
max(seg[i*2+1].c,seg[i*2+2].c));
/*
f = min(seg[i*2+1].a,seg[i*2+2].a);
f2 = max(seg[i*2+1].b,seg[i*2+2].b);
s = max(seg[i*2+1].c,seg[i*2+2].c);
make_pair(make_pair(f,f2),s);
*/
}
dfs2((n+1)/2);
printf("%lld\n",ans);
return 0;
} | a.cc:39:17: error: no matching function for call to 'NODE::NODE()'
39 | NODE seg[MAX_N*2];
| ^
a.cc:28:5: note: candidate: 'NODE::NODE(ll, ll, ll)'
28 | NODE(ll A,ll B,ll C){
| ^~~~
a.cc:28:5: note: candidate expects 3 arguments, 0 provided
a.cc:23:8: note: candidate: 'constexpr NODE::NODE(const NODE&)'
23 | struct NODE{
| ^~~~
a.cc:23:8: note: candidate expects 1 argument, 0 provided
a.cc:23:8: note: candidate: 'constexpr NODE::NODE(NODE&&)'
a.cc:23:8: note: candidate expects 1 argument, 0 provided
|
s324737840 | p00536 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
typedef long long ll;
typedef pair<ll,ll> P;
const int SIZE = 1<<24;
int N;
ll D,end,ind;
ll X[40],Y[40];
int l[SIZE],r[SIZE];
vector<P> v[2];
void rec(int x,ll s,ll k)
{
if(x==end)
{
v[ind].pb(P(s,k));
return;
}
rec(x+1,s+X[x],k-Y[x]);
rec(x+1,s-X[x],k+Y[x]);
rec(x+1,s,k);
}
struct segtree
{
ll seg[SIZE*2];
segtree()
{
for(int i=0;i<SIZE*2;i++)seg[i]=-LLINF;
}
void update(int k,ll x)
{
k += SIZE-1;
seg[k]=x;
while(k>0)
{
k = (k-1)/2;
seg[k]=max(seg[k*2+1],seg[k*2+2]);
}
}
ll query(int a,int b,int k,int l,int r)
{
if(r<=a||b<=l)return -LLINF;
else if(a<=l&&r<=b)return seg[k];
else return max(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));
}
}seg;
int main()
{
cin >> N >> D;
for(int i=0;i<N;i++)cin >> X[i] >> Y[i];
ll ans = 0ll;
int half = N/2;
int rem = N - half;
ind = 0,end = half;
rec(0,0ll,0ll);
ind = 1,end = N;
rec(half,0ll,0ll);
sort(v[1].begin(),v[1].end());
for(int i=0;i<v[0].size();i++)
{
l[i] = lower_bound(v[1].begin(),v[1].end(),P(-D-v[0][i].fi,-LLINF))-v[1].begin();
r[i] = upper_bound(v[1].begin(),v[1].end(),P(D-v[0][i].fi,LLINF))-v[1].begin();
}
for(int i=0;i<v[1].size();i++)seg.update(i,v[1][i].sec);
for(int i=0;i<v[0].size();i++)ans = max(ans,v[0][i].sec + seg.query(l[i],r[i],0,0,SIZE));
cout << ans << endl;
return 0;
} | a.cc:20:16: error: 'll' was not declared in this scope; did you mean 'all'?
20 | typedef vector<ll> vll;
| ^~
| all
a.cc:20:18: error: template argument 1 is invalid
20 | typedef vector<ll> vll;
| ^
a.cc:20:18: error: template argument 2 is invalid
a.cc: In function 'void rec(int, ll, ll)':
a.cc:44:15: error: reference to 'end' is ambiguous
44 | if(x==end)
| ^~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/istream:40,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from a.cc:5:
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
In file included from /usr/include/c++/14/bits/range_access.h:36:
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:38:6: note: 'll end'
38 | ll D,end,ind;
| ^~~
a.cc: In constructor 'segtree::segtree()':
a.cc:58:50: error: 'LLINF' was not declared in this scope; did you mean 'INF'?
58 | for(int i=0;i<SIZE*2;i++)seg[i]=-LLINF;
| ^~~~~
| INF
a.cc: In member function 'll segtree::query(int, int, int, int, int)':
a.cc:72:39: error: 'LLINF' was not declared in this scope; did you mean 'INF'?
72 | if(r<=a||b<=l)return -LLINF;
| ^~~~~
| INF
a.cc: In function 'int main()':
a.cc:84:17: error: reference to 'end' is ambiguous
84 | ind = 0,end = half;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:38:6: note: 'll end'
38 | ll D,end,ind;
| ^~~
a.cc:86:17: error: reference to 'end' is ambiguous
86 | ind = 1,end = N;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:38:6: note: 'll end'
38 | ll D,end,ind;
| ^~~
a.cc:91:77: error: 'LLINF' was not declared in this scope; did you mean 'INF'?
91 | l[i] = lower_bound(v[1].begin(),v[1].end(),P(-D-v[0][i].fi,-LLINF))-v[1].begin();
| ^~~~~
| INF
|
s385412534 | p00536 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 10000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
typedef long long ll;
typedef pair<ll,ll> P;
const int SIZE = 1<<24;
int N;
ll D,end,ind;
ll X[40],Y[40];
int l[SIZE],r[SIZE];
vector<P> v[2];
void rec(int x,ll s,ll k)
{
if(x==end)
{
v[ind].pb(P(s,k));
return;
}
rec(x+1,s+X[x],k-Y[x]);
rec(x+1,s-X[x],k+Y[x]);
rec(x+1,s,k);
}
struct segtree
{
ll seg[SIZE*2];
segtree()
{
for(int i=0;i<SIZE*2;i++)seg[i]=-LLINF;
}
void update(int k,ll x)
{
k += SIZE-1;
seg[k]=x;
while(k>0)
{
k = (k-1)/2;
seg[k]=max(seg[k*2+1],seg[k*2+2]);
}
}
ll query(int a,int b,int k,int l,int r)
{
if(r<=a||b<=l)return -LLINF;
else if(a<=l&&r<=b)return seg[k];
else return max(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));
}
}seg;
int main()
{
cin >> N >> D;
for(int i=0;i<N;i++)cin >> X[i] >> Y[i];
ll ans = 0ll;
int half = N/2;
int rem = N - half;
ind = 0,end = half;
rec(0,0ll,0ll);
ind = 1,end = N;
rec(half,0ll,0ll);
sort(v[1].begin(),v[1].end());
for(int i=0;i<v[0].size();i++)
{
l[i] = lower_bound(v[1].begin(),v[1].end(),P(-D-v[0][i].fi,-LLINF))-v[1].begin();
r[i] = upper_bound(v[1].begin(),v[1].end(),P(D-v[0][i].fi,LLINF))-v[1].begin();
}
for(int i=0;i<v[1].size();i++)seg.update(i,v[1][i].sec);
for(int i=0;i<v[0].size();i++)ans = max(ans,v[0][i].sec + seg.query(l[i],r[i],0,0,SIZE));
cout << ans << endl;
return 0;
} | a.cc:20:16: error: 'll' was not declared in this scope; did you mean 'all'?
20 | typedef vector<ll> vll;
| ^~
| all
a.cc:20:18: error: template argument 1 is invalid
20 | typedef vector<ll> vll;
| ^
a.cc:20:18: error: template argument 2 is invalid
a.cc: In function 'void rec(int, ll, ll)':
a.cc:45:15: error: reference to 'end' is ambiguous
45 | if(x==end)
| ^~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/istream:40,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from a.cc:5:
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
In file included from /usr/include/c++/14/bits/range_access.h:36:
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:39:6: note: 'll end'
39 | ll D,end,ind;
| ^~~
a.cc: In function 'int main()':
a.cc:85:17: error: reference to 'end' is ambiguous
85 | ind = 0,end = half;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:39:6: note: 'll end'
39 | ll D,end,ind;
| ^~~
a.cc:87:17: error: reference to 'end' is ambiguous
87 | ind = 1,end = N;
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:39:6: note: 'll end'
39 | ll D,end,ind;
| ^~~
|
s256871007 | p00536 | C++ | 30 0
21242407673097 114177941238876
9058956712039 655951931783798
1428 120024239739588
4866474754 892147985766111
6004019739993 6730693917855
237175368445382 898689135417047
4100861535205 815351639026202
252865155476730 32521930501690
2854211223592 555151153366642
2609204062 750905089997617
72214127937270 473183477381104
272415780110369 88218456379987
373643071758 154438209909938
3774683223769 50226621331281
453904 413471192511049
252709481240285 104679334788148
129312520648239 543093004658886
112807167267671 987873244818729
16264403825026 73756991486195
32090871994 301802143253310
65986050186 798493834355204
405733943752 160721331360546
360834706810879 692883371708207
41320863559984 592024897561575
7170228169328 116882456385925
129378506698425 901089324563479
6003843841610 833750764925614
90627212565367 778490146598844
842290325864550 953703697013083
782032134209 247519236672731 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 30 0
| ^~
|
s025312205 | p00536 | C++ | #ifndef ___Class_RMQ
#define ___Class_RMQ
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
template <typename Type> class RMQ
{
private:
int size;
vector<Type> minvalue;
vector<Type> maxvalue;
pair<Type, Type> _query(int a, int b, int k, int l, int r)
{
if (r <= a || b <= l) { return make_pair(INF, -INF); }
if (a <= l && r <= b) { return make_pair(minvalue[k], maxvalue[k]); }
pair<Type, Type> vl = _query(a, b, 2 * k + 1, l, (l + r) / 2);
pair<Type, Type> vr = _query(a, b, 2 * k + 2, (l + r) / 2, r);
return make_pair(min(vl.first, vr.first), max(vl.second, vr.second));
}
public:
Type INF;
RMQ(int size_)
{
INF = numeric_limits<Type>::max();
for (size = 1; size < size_;) { size <<= 1; }
minvalue = vector<Type>(size * 2 - 1, INF);
maxvalue = vector<Type>(size * 2 - 1, -INF);
}
void update(int i, const Type& x)
{
i += size - 1;
minvalue[i] = x;
maxvalue[i] = x;
while (i > 0)
{
i = (i - 1) / 2;
minvalue[i] = min(minvalue[2 * i + 1], minvalue[2 * i + 2]);
maxvalue[i] = max(maxvalue[2 * i + 1], maxvalue[2 * i + 2]);
}
}
pair<Type, Type> query(int s, int t)
{
return _query(s, t, 0, 0, size);
}
};
#endif
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int power[16]; power[0] = 1;
for (int i = 1; i < 16; i++)
{
power[i] = power[i - 1] * 3;
}
int N; long long D;
cin >> N >> D;
int mid = N / 2;
vector<long long> X(N);
vector<long long> Y(N);
for (int i = 0; i < N; i++)
{
cin >> X[i] >> Y[i];
}
vector<pair<long long, long long> > D1, D2;
for (int i = 0; i < power[mid]; i++)
{
long long X3 = 0LL, Y3 = 0LL;
for (int j = 0; j < mid; j++)
{
int temp = (i / power[j]) % 3;
switch (temp)
{
case 0: X3 -= X[j]; Y3 -= Y[j]; break; // Anna
case 1: X3 += X[j]; Y3 += Y[j]; break; // Bruno
}
}
D1.push_back(make_pair(X3, Y3));
}
for (int i = 0; i < power[N - mid]; i++)
{
long long X3 = 0LL, Y3 = 0LL;
for (int j = mid; j < N; j++)
{
int temp = (i / power[j - mid]) % 3;
switch (temp)
{
case 0: X3 -= X[j]; Y3 -= Y[j]; break; // Anna
case 1: X3 += X[j]; Y3 += Y[j]; break; // Bruno
}
}
tmp.first = X3;
tmp.second = Y3;
D2.push_back(tmp);
}
sort(D2.begin(), D2.end(), [](pair<long long, long long> x, pair<long long, long long> y) { return x.first < y.first; });
vector<long long> X1;
RMQ<long long> Y1(D2.size());
for (int i = 0; i < D2.size(); i++)
{
X1.push_back(D2[i].first);
Y1.update(i, D2[i].second);
}
long long Ans = -(1LL << 60);
int ptr1, ptr2, it;
for (int i = 0; i < D1.size(); i++)
{
ptr1 = distance(X1.begin(), lower_bound(X1.begin(), X1.end(), -D1[i].first - D));
ptr2 = distance(X1.begin(), upper_bound(X1.begin(), X1.end(), -D1[i].first + D));
long long rmq = Y1.query(ptr1, ptr2).second;
if (rmq != -Y1.INF)
{
Ans = max(D1[i].second + rmq, Ans);
}
}
cout << Ans << endl;
return 0;
} | a.cc: In constructor 'RMQ<Type>::RMQ(int)':
a.cc:36:23: error: 'numeric_limits' was not declared in this scope
36 | INF = numeric_limits<Type>::max();
| ^~~~~~~~~~~~~~
a.cc:36:42: error: expected primary-expression before '>' token
36 | INF = numeric_limits<Type>::max();
| ^
a.cc:36:48: error: no matching function for call to 'max()'
36 | INF = numeric_limits<Type>::max();
| ~~~~~^~
In file included from /usr/include/c++/14/vector:62,
from a.cc:4:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:6:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 0 provided
a.cc: In function 'int main()':
a.cc:133:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
133 | tmp.first = X3;
| ^~~
| tm
|
s169805240 | p00536 | C++ | #ifndef ___Class_RMQ
#define ___Class_RMQ
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
template <typename Type> class RMQ
{
private:
int size;
vector<Type> maxvalue;
Type _query(int a, int b, int k, int l, int r)
{
if (r <= a || b <= l) { return -INF; }
if (a <= l && r <= b) { return maxvalue[k]; }
Type vl = _query(a, b, 2 * k + 1, l, (l + r) / 2);
Type vr = _query(a, b, 2 * k + 2, (l + r) / 2, r);
return max(vl, vr);
}
public:
Type INF;
RMQ(int size_)
{
INF = numeric_limits<Type>::max();
for (size = 1; size < size_;) { size <<= 1; }
maxvalue = vector<Type>(size * 2 - 1, -INF);
}
void update(int i, const Type& x)
{
i += size - 1;
maxvalue[i] = x;
while (i > 0)
{
i = (i - 1) / 2;
maxvalue[i] = max(maxvalue[2 * i + 1], maxvalue[2 * i + 2]);
}
}
Type query(int s, int t)
{
return _query(s, t, 0, 0, size);
}
};
#endif
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int power[16]; power[0] = 1;
for (int i = 1; i < 16; i++)
{
power[i] = power[i - 1] * 3;
}
int N; long long D;
cin >> N >> D;
int mid = N / 2;
vector<long long> X(N);
vector<long long> Y(N);
for (int i = 0; i < N; i++)
{
cin >> X[i] >> Y[i];
}
vector<pair<long long, long long> > D1, D2;
for (int i = 0; i < power[mid]; i++)
{
long long X3 = 0LL, Y3 = 0LL;
for (int j = 0; j < mid; j++)
{
switch ((i / power[j]) % 3)
{
case 0: X3 -= X[j]; Y3 -= Y[j]; break; // Anna
case 1: X3 += X[j]; Y3 += Y[j]; break; // Bruno
}
}
D1.push_back(make_pair(X3, Y3));
}
for (int i = 0; i < power[N - mid]; i++)
{
long long X3 = 0LL, Y3 = 0LL;
for (int j = mid; j < N; j++)
{
switch ((i / power[j - mid]) % 3)
{
case 0: X3 -= X[j]; Y3 -= Y[j]; break; // Anna
case 1: X3 += X[j]; Y3 += Y[j]; break; // Bruno
}
}
D2.push_back(make_pair(X3, Y3));
}
sort(D2.begin(), D2.end(), [](pair<long long, long long> x, pair<long long, long long> y) { return x.first < y.first; });
vector<long long> X1;
RMQ<long long> Y1(D2.size());
for (int i = 0; i < D2.size(); i++)
{
X1.push_back(D2[i].first);
Y1.update(i, D2[i].second);
}
long long Ans = -(1LL << 60), rmq;
int ptr1, ptr2;
for (int i = 0; i < D1.size(); i++)
{
ptr1 = distance(X1.begin(), lower_bound(X1.begin(), X1.end(), -D1[i].first - D));
ptr2 = distance(X1.begin(), upper_bound(X1.begin(), X1.end(), -D1[i].first + D));
rmq = Y1.query(ptr1, ptr2);
if (rmq != -Y1.INF)
{
Ans = max(D1[i].second + rmq, Ans);
}
}
cout << Ans << endl;
return 0;
} | a.cc: In constructor 'RMQ<Type>::RMQ(int)':
a.cc:35:23: error: 'numeric_limits' was not declared in this scope
35 | INF = numeric_limits<Type>::max();
| ^~~~~~~~~~~~~~
a.cc:35:42: error: expected primary-expression before '>' token
35 | INF = numeric_limits<Type>::max();
| ^
a.cc:35:48: error: no matching function for call to 'max()'
35 | INF = numeric_limits<Type>::max();
| ~~~~~^~
In file included from /usr/include/c++/14/vector:62,
from a.cc:4:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:6:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 0 provided
|
s844904227 | p00536 | C++ | #ifndef ___Class_RMQ
#define ___Class_RMQ
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
template <typename Type> class RMQ
{
private:
int size;
vector<Type> maxvalue;
Type _query(int a, int b, int k, int l, int r)
{
if (r <= a || b <= l) { return -INF; }
if (a <= l && r <= b) { return maxvalue[k]; }
Type vl = _query(a, b, 2 * k + 1, l, (l + r) / 2);
Type vr = _query(a, b, 2 * k + 2, (l + r) / 2, r);
return make_pair(max(vl, vr));
}
public:
Type INF;
RMQ(int size_)
{
INF = numeric_limits<Type>::max() / 2;
for (size = 1; size < size_;) { size <<= 1; }
maxvalue = vector<Type>(size * 2 - 1, -INF);
}
void update(int i, const Type& x)
{
i += size - 1;
maxvalue[i] = x;
while (i > 0)
{
i = (i - 1) / 2;
maxvalue[i] = max(maxvalue[2 * i + 1], maxvalue[2 * i + 2]);
}
}
Type query(int s, int t)
{
return _query(s, t, 0, 0, size);
}
};
#endif
#include <iostream>
int main()
{
int i, j;
int power[16]; power[0] = 1;
for (i = 1; i < 16; i++)
{
power[i] = power[i - 1] * 3;
}
int N; long long D;
cin >> N >> D;
int mid = N / 2;
vector<long long> X(N);
vector<long long> Y(N);
for (i = 0; i < N; i++)
{
cin >> X[i] >> Y[i];
}
vector<pair<long long, long long> > D1, D2;
long long X3, Y3;
for (i = 0; i < power[mid]; i++)
{
X3 = 0LL;
Y3 = 0LL;
for (j = 0; j < mid; j++)
{
switch ((i / power[j]) % 3)
{
case 0: X3 -= X[j]; Y3 -= Y[j]; break; // Anna
case 1: X3 += X[j]; Y3 += Y[j]; break; // Bruno
}
}
D1.push_back(make_pair(X3, Y3));
}
for (i = 0; i < power[N - mid]; i++)
{
X3 = 0LL;
Y3 = 0LL;
for (j = mid; j < N; j++)
{
switch ((i / power[j - mid]) % 3)
{
case 0: X3 -= X[j]; Y3 -= Y[j]; break; // Anna
case 1: X3 += X[j]; Y3 += Y[j]; break; // Bruno
}
}
D2.push_back(make_pair(X3, Y3));
}
sort(D2.begin(), D2.end(), [](pair<long long, long long> x, pair<long long, long long> y) { return x.first < y.first; });
int D1_size = D1.size();
int D2_size = D2.size();
vector<long long> X1, Y1;
RMQ<long long> rmq(N != 30 ? D2_size : 0);
for (i = 0; i < D2_size; i++)
{
X1.push_back(D2[i].first);
if (N != 30)
{
rmq.update(i, D2[i].second);
}
else
{
Y1.push_back(D2[i].second);
}
}
long long Ans = numeric_limits<long long>::min() / 2;
int ptr1, ptr2;
for (i = 0; i < D1_size; i++)
{
ptr1 = distance(X1.begin(), lower_bound(X1.begin(), X1.end(), -D1[i].first - D));
ptr2 = distance(X1.begin(), upper_bound(X1.begin(), X1.end(), -D1[i].first + D));
if (N != 30)
{
Ans = max(D1[i].second + rmq.query(ptr1, ptr2), Ans);
}
else
{
for (j = ptr1; j < ptr2; j++)
{
Ans = max(D1[i].second + Y1[j], Ans);
}
}
}
cout << Ans << endl;
return 0;
} | a.cc: In constructor 'RMQ<Type>::RMQ(int)':
a.cc:35:23: error: 'numeric_limits' was not declared in this scope
35 | INF = numeric_limits<Type>::max() / 2;
| ^~~~~~~~~~~~~~
a.cc:35:42: error: expected primary-expression before '>' token
35 | INF = numeric_limits<Type>::max() / 2;
| ^
a.cc:35:48: error: no matching function for call to 'max()'
35 | INF = numeric_limits<Type>::max() / 2;
| ~~~~~^~
In file included from /usr/include/c++/14/vector:62,
from a.cc:4:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:6:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 0 provided
a.cc: In function 'int main()':
a.cc:153:25: error: 'numeric_limits' was not declared in this scope
153 | long long Ans = numeric_limits<long long>::min() / 2;
| ^~~~~~~~~~~~~~
a.cc:153:40: error: expected primary-expression before 'long'
153 | long long Ans = numeric_limits<long long>::min() / 2;
| ^~~~
a.cc: In instantiation of 'Type RMQ<Type>::_query(int, int, int, int, int) [with Type = long long int]':
a.cc:58:10: required from 'Type RMQ<Type>::query(int, int) [with Type = long long int]'
58 | return _query(s, t, 0, 0, size);
| ^~~~~~
a.cc:164:38: required from here
164 | Ans = max(D1[i].second + rmq.query(ptr1, ptr2), Ans);
| ~~~~~~~~~^~~~~~~~~~~~
a.cc:26:33: error: no matching function for call to 'make_pair(const long long int&)'
26 | return make_pair(max(vl, vr));
| ~~~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: candidate: 'template<class _T1, class _T2> constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&)'
1132 | make_pair(_T1&& __x, _T2&& __y)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: candidate expects 2 arguments, 1 provided
|
s114975892 | p00536 | C++ | #include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<utility>
using namespace std;
#define MAX_N 100000000
long long x_1[MAX_N];
long long y_1[MAX_N];
pair<long long, long long>x2[MAX_N];
long long y2[MAX_N];
int main() {
long long x[15][2], y[15][2], d;
int n, e, f;
int mid;
long long int MAX = 0;
int a[15];
memset(x_1, 0, sizeof(x_1));
memset(y_1, 0, sizeof(y_1));
cin >> n >> d;
mid = n / 2;
for (int i = 0; i < mid; i++) {
cin >> x[i][0] >> y[i][0];
}
for (int i = mid; i < n; i++) {
cin >> x[i - mid][1] >> y[i - mid][1];
}
for (int i = 0; i < (int)pow(3, mid); i++) {
for (int j = 0; j < mid; j++) {
a[j] = (i / (int)pow(3, j)) % 3;
if (a[j] == 0) {
x_1[i] -= x[j][0];
y_1[i] -= y[j][0];
}
if (a[j] == 1) {
x_1[i] += x[j][0];
y_1[i] += y[j][0];
}
}
}
for (int i = 0; i < (int)pow(3, n - mid); i++) {
for (int j = 0; j < n - mid; j++) {
a[j] = (i / (int)pow(3, j)) % 3;
if (a[j] == 0) {
x2[i].first -= x[j][1];
x2[i].second -= y[j][1];
}
if (a[j] == 1) {
x2[i].first += x[j][1];
x2[i].second += y[j][1];
}
}
}
sort(x2, x2 + (int)pow(3, n - mid));
for (int i = 0; i < (int)pow(3, n - mid); i++) {
y2[i] = x2[i].first;
}
for (int i = 0; i < (int)pow(3, mid); i++) {
e = distance(y2, lower_bound(y2, y2 + (int)pow(3, n - mid), -x_1[i] - d));
f = distance(y2, upper_bound(y2, y2 + (int)pow(3, n - mid), -x_1[i] + d));
for (int j = e; j < f; j++) {
MAX = max(MAX, y_1[i] + x2[j].second);
}
}
cout << MAX << endl;
return 0;
} | /tmp/ccUUMZbZ.o: in function `main':
a.cc:(.text+0x597): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x624): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x639): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x648): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x6c7): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x6dc): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x6eb): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
collect2: error: ld returned 1 exit status
|
s942207945 | p00536 | C++ | #include<vector>
using namespace std;
template <typename Type> class RMQ
{
private:
int size;
vector<Type> maxvalue;
Type _query(int a, int b, int k, int l, int r)
{
if (r <= a || b <= l) { return INF; }
if (a <= l && r <= b) { return maxvalue[k]; }
Type vl = _query(a, b, 2 * k, l, (l + r) / 2);
Type vr = _query(a, b, 2 * k + 1, (l + r) / 2, r);
return max(vl, vr);
}
public:
Type INF;
RMQ(int size_)
{
INF = numeric_limits<Type>::min();
for (size = 1; size < size_;) { size <<= 1; }
maxvalue = vector<Type>(size * 2, INF);
}
void update(int i, const Type& x)
{
i += size;
maxvalue[i] = x;
while (i > 1)
{
i = i / 2;
maxvalue[i] = max(maxvalue[2 * i], maxvalue[2 * i + 1]);
}
}
Type query(int s, int t)
{
return _query(s, t, 1, 0, size);
}
};
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<utility>
#define MAX_N 20000000
long long x_1[MAX_N];
long long y_1[MAX_N];
pair<long long, long long>x2[MAX_N];
long long y2[MAX_N];
RMQ<long long> r(14348907);
int main() {
long long x[15][2], y[15][2], d;
int power[16] = { 1,3,9,27,81,243,729,2187,6561,19683,59049,177147,531441,1594323,4782969,14348907 };
int n, e, f;
int mid;
long long int MAX = 0;
int a[15];
memset(x_1, 0, sizeof(x_1));
memset(y_1, 0, sizeof(y_1));
cin >> n >> d;
mid = n / 2;
for (int i = 0; i < mid; i++) {
cin >> x[i][0] >> y[i][0];
}
for (int i = mid; i < n; i++) {
cin >> x[i - mid][1] >> y[i - mid][1];
}
for (int i = 0; i < power[mid]; i++) {
for (int j = 0; j < mid; j++) {
a[j] = (i / power[j]) % 3;
if (a[j] == 0) {
x_1[i] -= x[j][0];
y_1[i] -= y[j][0];
}
if (a[j] == 1) {
x_1[i] += x[j][0];
y_1[i] += y[j][0];
}
}
}
for (int i = 0; i < power[n - mid]; i++) {
for (int j = 0; j < n - mid; j++) {
a[j] = (i / power[j]) % 3;
if (a[j] == 0) {
x2[i].first -= x[j][1];
x2[i].second -= y[j][1];
}
if (a[j] == 1) {
x2[i].first += x[j][1];
x2[i].second += y[j][1];
}
}
}
sort(x2, x2 + power[n - mid]);
for (int i = 0; i < power[n - mid]; i++) {
y2[i] = x2[i].first;
r.update(i, x2[i].second);
}
for (int i = 0; i < power[mid]; i++) {
e = distance(y2, lower_bound(y2, y2 + power[n - mid], -x_1[i] - d));
f = distance(y2, upper_bound(y2, y2 + power[n - mid], -x_1[i] + d));
MAX = max(MAX, r.query(e, f) + y_1[i]);
}
cout << MAX << endl;
return 0;
} | a.cc: In constructor 'RMQ<Type>::RMQ(int)':
a.cc:28:23: error: 'numeric_limits' was not declared in this scope
28 | INF = numeric_limits<Type>::min();
| ^~~~~~~~~~~~~~
a.cc:28:42: error: expected primary-expression before '>' token
28 | INF = numeric_limits<Type>::min();
| ^
a.cc:28:48: error: no matching function for call to 'min()'
28 | INF = numeric_limits<Type>::min();
| ~~~~~^~
In file included from /usr/include/c++/14/vector:62,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 0 provided
|
s887077706 | p00536 | C++ | #include<vector>
using namespace std;
template <typename Type> class RMQ
{
private:
int size;
vector<Type> maxvalue;
Type _query(int a, int b, int k, int l, int r)
{
if (r <= a || b <= l) { return INF; }
if (a <= l && r <= b) { return maxvalue[k]; }
Type vl = _query(a, b, 2 * k, l, (l + r) / 2);
Type vr = _query(a, b, 2 * k + 1, (l + r) / 2, r);
return max(vl, vr);
}
public:
Type INF;
RMQ(int size_)
{
INF = numeric_limits<Type>::min();
for (size = 1; size < size_;) { size <<= 1; }
maxvalue = vector<Type>(size * 2, INF);
}
void update(int i, const Type& x)
{
i += size;
maxvalue[i] = x;
while (i > 1)
{
i = i / 2;
maxvalue[i] = max(maxvalue[2 * i], maxvalue[2 * i + 1]);
}
}
Type query(int s, int t)
{
return _query(s, t, 1, 0, size);
}
};
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<utility>
#define MAX_N 20000000
long long x_1[MAX_N];
long long y_1[MAX_N];
pair<long long, long long>x2[MAX_N];
long long y2[MAX_N];
RMQ<long long> r(14348907);
int main() {
long long x[15][2], y[15][2], d;
int power[16] = { 1,3,9,27,81,243,729,2187,6561,19683,59049,177147,531441,1594323,4782969,14348907 };
int n, e, f;
int mid;
long long int MAX = 0;
int a[15];
memset(x_1, 0, sizeof(x_1));
memset(y_1, 0, sizeof(y_1));
cin >> n >> d;
mid = n / 2;
for (int i = 0; i < mid; i++) {
cin >> x[i][0] >> y[i][0];
}
for (int i = mid; i < n; i++) {
cin >> x[i - mid][1] >> y[i - mid][1];
}
for (int i = 0; i < power[mid]; i++) {
for (int j = 0; j < mid; j++) {
a[j] = (i / power[j]) % 3;
if (a[j] == 0) {
x_1[i] -= x[j][0];
y_1[i] -= y[j][0];
}
if (a[j] == 1) {
x_1[i] += x[j][0];
y_1[i] += y[j][0];
}
}
}
for (int i = 0; i < power[n - mid]; i++) {
for (int j = 0; j < n - mid; j++) {
a[j] = (i / power[j]) % 3;
if (a[j] == 0) {
x2[i].first -= x[j][1];
x2[i].second -= y[j][1];
}
if (a[j] == 1) {
x2[i].first += x[j][1];
x2[i].second += y[j][1];
}
}
}
sort(x2, x2 + power[n - mid]);
for (int i = 0; i < power[n - mid]; i++) {
y2[i] = x2[i].first;
r.update(i, x2[i].second);
}
for (int i = 0; i < power[mid]; i++) {
e = distance(y2, lower_bound(y2, y2 + power[n - mid], -x_1[i] - d));
f = distance(y2, upper_bound(y2, y2 + power[n - mid], -x_1[i] + d));
MAX = max(MAX, r.query(e, f) + y_1[i]);
}
cout << MAX << endl;
return 0;
} | a.cc: In constructor 'RMQ<Type>::RMQ(int)':
a.cc:28:23: error: 'numeric_limits' was not declared in this scope
28 | INF = numeric_limits<Type>::min();
| ^~~~~~~~~~~~~~
a.cc:28:42: error: expected primary-expression before '>' token
28 | INF = numeric_limits<Type>::min();
| ^
a.cc:28:48: error: no matching function for call to 'min()'
28 | INF = numeric_limits<Type>::min();
| ~~~~~^~
In file included from /usr/include/c++/14/vector:62,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 0 provided
|
s786867891 | p00536 | C++ | #include<iostream>
#include<string>
#include<Windows.h>
using namespace std;
string S;
int main() {
S = "abcdefghijklmnopqrstuvwxyz";
while (true) {
S += S.substr(0, S.size() / 25);
Sleep(20);
}
} | a.cc:3:9: fatal error: Windows.h: No such file or directory
3 | #include<Windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s276961188 | p00536 | C++ | #include <vector>
#include <iostream>
#include <algorithm>
#define INF (1LL << 60)
using namespace std;
int n, u[2], mode, tar, pl, pr; long long d, x[30], y[30], ret, res, seg[33554432]; long long t[2][2][14348907];
void rec(int pos, long long a, long long b) {
if (pos == tar) {
t[0][mode][u[mode]] = a;
t[1][mode][u[mode]++] = b;
return;
}
rec(pos + 1, a + x[pos], b + y[pos]);
rec(pos + 1, a - x[pos], b - y[pos]);
rec(pos + 1, a, b);
}
long long query(int k, int l, int r) {
if (r <= pl || pr <= l) return INF;
if (pl <= l && r <= pr) return seg[k];
long long lch = query(2 * k, l, (l + r) / 2);
long long rch = query(2 * k + 1, (l + r) / 2, r);
return min(lch, rch);
}
int main() {
scanf("%d%lld", &n, &d);
for (int i = 0; i < n; i++) scanf("%lld%lld", &x[i], &y[i]);
mode = 0; tar = n / 2; rec(0, 0, 0);
mode = 1; tar = n; rec(n / 2, 0, 0);
sort(t[1], t[1] + u[1]);
for (int i = 0; i < 33554432; i++) seg[i] = INF;
for (int i = 0; i < u[1]; i++) seg[i + 16777216] = t[1][1][i];
for (int i = 16777215; i >= 1; i--) seg[i] = min(seg[2 * i], seg[2 * i + 1]);
for (int i = 0; i < u[0]; i++) {
pl = lower_bound(t[1], t[1] + u[1], make_pair(-t[0][0][i] - d, -INF)) - t[1];
pr = upper_bound(t[1], t[1] + u[1], make_pair(-t[0][0][i] + d, INF)) - t[1];
res = query(1, 0, 16777216);
ret = max(ret, -t[1][0][i] - res);
}
printf("%lld\n", ret);
return 0;
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/vector:62,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = long long int (*)[14348907]; _Value = const std::pair<long long int, long long int>]':
/usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = long long int (*)[14348907]; _Tp = pair<long long int, long long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
1504 | if (__comp(__middle, __val))
| ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int (*)[14348907]; _Tp = pair<long long int, long long int>]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:34:19: required from here
34 | pl = lower_bound(t[1], t[1] + u[1], make_pair(-t[0][0][i] - d, -INF)) - t[1];
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'long long int [14348907]' and 'const std::pair<long long int, long long int>')
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'long long int [14348907]'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'long long int [14348907]'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::pair<_T1, _T2>' and 'long long int [14348907]'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int [14348907]'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int [14348907]'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'long long int [14348907]'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'long long int [14348907]'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:2089:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2089 | operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2089:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'long long int [14348907]'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/vector:87:
/usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2600 | operator<(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::tuple<_UTypes ...>' and 'long long int [14348907]'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int*'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int*'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
|
s271894815 | p00536 | C++ | #include <vector>
#include <iostream>
#include <algorithm>
#define INF (1LL << 60)
using namespace std;
int n, u[2], mode, tar; long long d, x[30], y[30], ret, res, seg[33554432], val[14348907]; pair<long long, long long> t[2][14348907];
inline void rec(int pos, long long a, long long b) {
if (pos == tar) {
t[mode][u[mode]++] = make_pair(a, b); return;
}
rec(pos + 1, a + x[pos], b + y[pos]);
rec(pos + 1, a - x[pos], b - y[pos]);
rec(pos + 1, a, b);
}
inline long long query(int a, int b, int k, int l, int r) {
if (r <= a || b <= l) return INF;
if (a <= l && r <= b) return seg[k];
long long lch = query(a, b, 2 * k, l, (l + r) / 2);
long long rch = query(a, b, 2 * k + 1, (l + r) / 2, r);
return min(lch, rch);
}
int main() {
scanf("%d%lld", &n, &d);
for (int i = 0; i < n; i++) scanf("%lld%lld", &x[i], &y[i]);
mode = 0; tar = n / 2; rec(0, 0, 0);
mode = 1; tar = n; rec(n / 2, 0, 0);
sort(t[1], t[1] + u[1]);
for (int i = 0; i < u[1]; i++) val[i] = t[1][i].first;
for (int i = 0; i < 33554432; i++) seg[i] = INF;
for (int i = 0; i < u[1]; i++) seg[i + 16777216] = t[1][i].second;
for (int i = 16777215; i >= 1; i--) seg[i] = min(seg[2 * i], seg[2 * i + 1]);
for (int i = 0; i < u[0]; i++) {
int pl = lower_bound(val[1], val[1] + u[1], -t[0][i].first - d) - t[1];
int pr = upper_bound(val[1], val[1] + u[1], -t[0][i].first + d) - t[1];
res = query(pl, pr, 1, 0, 16777216);
ret = max(ret, -t[0][i].second - res);
}
printf("%lld\n", ret);
return 0;
} | a.cc: In function 'int main()':
a.cc:33:81: error: invalid operands of types 'long long int' and 'std::pair<long long int, long long int> [14348907]' to binary 'operator-'
33 | int pl = lower_bound(val[1], val[1] + u[1], -t[0][i].first - d) - t[1];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~
| | |
| long long int std::pair<long long int, long long int> [14348907]
a.cc:34:81: error: invalid operands of types 'long long int' and 'std::pair<long long int, long long int> [14348907]' to binary 'operator-'
34 | int pr = upper_bound(val[1], val[1] + u[1], -t[0][i].first + d) - t[1];
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~
| | |
| long long int std::pair<long long int, long long int> [14348907]
In file included from /usr/include/c++/14/vector:62,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = long long int; _Tp = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_val]':
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = long long int]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:33:23: required from here
33 | int pl = lower_bound(val[1], val[1] + u[1], -t[0][i].first - d) - t[1];
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1495:9: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>'
1495 | _DistanceType;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1497:42: error: no matching function for call to 'distance(long long int&, long long int&)'
1497 | _DistanceType __len = std::distance(__first, __last);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
148 | distance(_InputIterator __first, _InputIterator __last)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h: In substitution of 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator) [with _InputIterator = long long int]':
/usr/include/c++/14/bits/stl_algobase.h:1497:42: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = long long int; _Tp = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
1497 | _DistanceType __len = std::distance(__first, __last);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = long long int]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:33:23: required from here
33 | int pl = lower_bound(val[1], val[1] + u[1], -t[0][i].first - d) - t[1];
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>'
148 | distance(_InputIterator __first, _InputIterator __last)
| ^~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_ForwardIterator std::__upper_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = long long int; _Tp = long long int; _Compare = __gnu_cxx::__ops::_Val_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:2028:32: required from '_FIter std::upper_bound(_FIter, _FIter, const _Tp&) [with _FIter = long long int; _Tp = long long int]'
2028 | return std::__upper_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
2029 | __gnu_cxx::__ops::__val_less_iter());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:34:23: required from here
34 | int pr = upper_bound(val[1], val[1] + u[1], -t[0][i].first + d) - t[1];
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1984:9: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>'
1984 | _DistanceType;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1986:42: error: no matching function for call to 'distance(long long int&, long long int&)'
1986 | _DistanceType __len = std::distance(__first, __last);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
148 | distance(_InputIterator __first, _InputIterator __last)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h: In substitution of 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator) [with _InputIterator = long long int]':
/usr/include/c++/14/bits/stl_algo.h:1986:42: required from '_ForwardIterator std::__upper_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = long long int; _Tp = long long int; _Compare = __gnu_cxx::__ops::_Val_less_iter]'
1986 | _DistanceType __len = std::distance(__first, __last);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2028:32: required from '_FIter std::upper_bound(_FIter, _FIter, const _Tp&) [with _FIter = long long int; _Tp = long long int]'
2028 | return std::__upper_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
2029 | __gnu_cxx::__ops::__val_less_iter());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:34:23: required from here
34 | int pr = upper_bound(val[1], val[1] + u[1], -t[0][i].first + d) - t[1];
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>'
148 | distance(_InputIterator __first, _InputIterator __last)
| ^~~~~~~~
|
s935893896 | p00536 | C++ | #include <vector>
#include <iostream>
#include <algorithm>
#define INF (1LL << 60)
using namespace std;
int n, u[2], mode, tar; long long d, x[30], y[30], ret, res, seg[33554432], val[14348907]; pair<long long, long long> t[2][14348907];
inline void rec(int pos, long long a, long long b) {
if (pos == tar) {
t[mode][u[mode]++] = make_pair(a, b); return;
}
rec(pos + 1, a + x[pos], b + y[pos]);
rec(pos + 1, a - x[pos], b - y[pos]);
rec(pos + 1, a, b);
}
inline long long query(int a, int b, int k, int l, int r) {
if (r <= a || b <= l) return INF;
if (a <= l && r <= b) return seg[k];
long long lch = query(a, b, 2 * k, l, (l + r) / 2);
long long rch = query(a, b, 2 * k + 1, (l + r) / 2, r);
return min(lch, rch);
}
int main() {
scanf("%d%lld", &n, &d);
for (int i = 0; i < n; i++) scanf("%lld%lld", &x[i], &y[i]);
mode = 0; tar = n / 2; rec(0, 0, 0);
mode = 1; tar = n; rec(n / 2, 0, 0);
sort(t[1], t[1] + u[1]);
for (int i = 0; i < u[1]; i++) val[i] = t[1][i].first;
for (int i = 0; i < 33554432; i++) seg[i] = INF;
for (int i = 0; i < u[1]; i++) seg[i + 16777216] = t[1][i].second;
for (int i = 16777215; i >= 1; i--) seg[i] = min(seg[2 * i], seg[2 * i + 1]);
for (int i = 0; i < u[0]; i++) {
int pl = lower_bound(val[1], val[1] + u[1], -t[0][i].first - d) - val[1];
int pr = upper_bound(val[1], val[1] + u[1], -t[0][i].first + d) - val[1];
res = query(pl, pr, 1, 0, 16777216);
ret = max(ret, -t[0][i].second - res);
}
printf("%lld\n", ret);
return 0;
} | In file included from /usr/include/c++/14/vector:62,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = long long int; _Tp = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_val]':
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = long long int]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:33:23: required from here
33 | int pl = lower_bound(val[1], val[1] + u[1], -t[0][i].first - d) - val[1];
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1495:9: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>'
1495 | _DistanceType;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1497:42: error: no matching function for call to 'distance(long long int&, long long int&)'
1497 | _DistanceType __len = std::distance(__first, __last);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
148 | distance(_InputIterator __first, _InputIterator __last)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h: In substitution of 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator) [with _InputIterator = long long int]':
/usr/include/c++/14/bits/stl_algobase.h:1497:42: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = long long int; _Tp = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
1497 | _DistanceType __len = std::distance(__first, __last);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = long long int]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:33:23: required from here
33 | int pl = lower_bound(val[1], val[1] + u[1], -t[0][i].first - d) - val[1];
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>'
148 | distance(_InputIterator __first, _InputIterator __last)
| ^~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_ForwardIterator std::__upper_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = long long int; _Tp = long long int; _Compare = __gnu_cxx::__ops::_Val_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:2028:32: required from '_FIter std::upper_bound(_FIter, _FIter, const _Tp&) [with _FIter = long long int; _Tp = long long int]'
2028 | return std::__upper_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
2029 | __gnu_cxx::__ops::__val_less_iter());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:34:23: required from here
34 | int pr = upper_bound(val[1], val[1] + u[1], -t[0][i].first + d) - val[1];
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1984:9: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>'
1984 | _DistanceType;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1986:42: error: no matching function for call to 'distance(long long int&, long long int&)'
1986 | _DistanceType __len = std::distance(__first, __last);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
148 | distance(_InputIterator __first, _InputIterator __last)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h: In substitution of 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator) [with _InputIterator = long long int]':
/usr/include/c++/14/bits/stl_algo.h:1986:42: required from '_ForwardIterator std::__upper_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = long long int; _Tp = long long int; _Compare = __gnu_cxx::__ops::_Val_less_iter]'
1986 | _DistanceType __len = std::distance(__first, __last);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2028:32: required from '_FIter std::upper_bound(_FIter, _FIter, const _Tp&) [with _FIter = long long int; _Tp = long long int]'
2028 | return std::__upper_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
2029 | __gnu_cxx::__ops::__val_less_iter());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:34:23: required from here
34 | int pr = upper_bound(val[1], val[1] + u[1], -t[0][i].first + d) - val[1];
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>'
148 | distance(_InputIterator __first, _InputIterator __last)
| ^~~~~~~~
|
s015022373 | p00536 | C++ | #include <ctime>
#include <vector>
#include <iostream>
#include <algorithm>
#define INF (1LL << 60)
using namespace std;
int n, u[2], mode, tar; long long d, x[30], y[30], ret, seg[16777216], val[8388608]; pair<long long, long long> t[2][8388608];
inline void rec(int pos, long long a, long long b) {
if (pos == tar) {
if(b <= 0) t[mode][u[mode]++] = make_pair(a, b);
return;
}
rec(pos + 1, a + x[pos], b + y[pos]);
rec(pos + 1, a - x[pos], b - y[pos]);
if(N > 10 && rand() % 4 != 0) rec(pos + 1, a, b);
}
inline long long query(int a, int b, int k, int l, int r) {
if (r <= a || b <= l) return INF;
if (a <= l && r <= b) return seg[k];
long long lch = query(a, b, k << 1, l, (l + r) >> 1);
long long rch = query(a, b, (k << 1) + 1, (l + r) >> 1, r);
return min(lch, rch);
}
int main() {
srand((unsigned)time(NULL));
scanf("%d%lld", &n, &d);
for (int i = 0; i < n; i++) scanf("%lld%lld", &x[i], &y[i]);
mode = 0; tar = n / 2; rec(0, 0, 0);
mode = 1; tar = n; rec(n / 2, 0, 0);
sort(t[1], t[1] + u[1]);
for (int i = 0; i < u[1]; i++) val[i] = t[1][i].first;
for (int i = 0; i < u[1]; i++) seg[i + 8388608] = t[1][i].second;
for (int i = u[1]; i < 8388608; i++) seg[i + 8388608] = INF;
for (int i = 8388608; i >= 1; i--) seg[i] = min(seg[2 * i], seg[2 * i + 1]);
for (int i = 0; i < u[0]; i++) {
int pl = lower_bound(val, val + u[1], -t[0][i].first - d) - val;
int pr = upper_bound(val, val + u[1], -t[0][i].first + d) - val;
long long res = query(pl, pr, 1, 0, 8388608);
ret = max(ret, -t[0][i].second - res);
}
printf("%lld\n", ret);
return 0;
} | a.cc: In function 'void rec(int, long long int, long long int)':
a.cc:15:8: error: 'N' was not declared in this scope
15 | if(N > 10 && rand() % 4 != 0) rec(pos + 1, a, b);
| ^
|
s599496628 | p00536 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <tuple>
#include <map>
#define int long long
#define INF 1e18
#define MINF 1e18 * - 1
using namespace std;
typedef pair<int, int> P;
signed main(){
int n, d, ans = 0;
int x[31], y[31];
map<int, int> dp[31];
vector<P> d1, d2;
cin >> n >> d;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
dp[0][0] = 0;
for (int i = 1; i <= 15; i++) {
for (auto itr = dp[i - 1].begin(); itr != dp[i - 1].end(); itr++) {
dp[i][itr->first + x[i]] = max(dp[i][itr->first + x[i]], itr->second + y[i]);
dp[i][itr->first - x[i]] = max(dp[i][itr->first - x[i]], itr->second - y[i]);
dp[i][itr->first] = max(dp[i][itr->first], itr->second);
}
if (n <= i) {
for (auto itr = dp[n].begin(); itr != dp[n].end(); itr++) {
if (itr->first >= -d && itr->first <= d) {
ans = max(itr->second, ans);
}
}
cout << ans << endl;
return 0;
}
}
for (auto itr = dp[15].begin(); itr != dp[15].end(); itr++) {
d1.push_back(make_pair(itr->second, itr->first));
}
for (int i = 1; i <= 15; i++)
dp[i].erase(dp[i].begin(), dp[i].end());
for (int i = 16; i <= n; i++) {
for (auto itr = dp[i - 1].begin(); itr != dp[i - 1].end(); itr++) {
dp[i][itr->first + x[i]] = max(dp[i][itr->first + x[i]], itr->second + y[i]);
dp[i][itr->first - x[i]] = max(dp[i][itr->first - x[i]], itr->second - y[i]);
dp[i][itr->first] = max(dp[i][itr->first], itr->second);
}
}
for (auto itr = dp[15].begin(); itr != dp[15].end(); itr++) {
d2.push_back(make_pair(itr->second, itr->first));
}
sort(d1.begin(), d1.end());
sort(d2.begin(), d2.end());
for (int i = 0; i < d1.size(); i++) {
int itr = lower_bound(d2.begin(), d2.end(), make_pair(d - d1[i].first + 1, -100000000000000000)) - d2.begin();
itr--;
for (; itr >= 0; itr--) {
if(d2[itr].first + d1[i].first >= -d)
ans = max(ans, d2[itr].second + d1[i].second);
}
}
cout << ans << endl;
return 0;
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
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/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Value = const std::pair<long long int, long int>]':
/usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = pair<long long int, long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
1504 | if (__comp(__middle, __val))
| ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = pair<long long int, long int>]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:56:25: required from here
56 | int itr = lower_bound(d2.begin(), d2.end(), make_pair(d - d1[i].first + 1, -100000000000000000)) - d2.begin();
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long long int, long long int>' and 'const std::pair<long long int, long int>')
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: deduced conflicting types for parameter '_T2' ('long long int' and 'long int')
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: n |
s155106199 | p00536 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <tuple>
#include <map>
#define int long long
#define INF 1e18
#define MINF 1e18 * - 1
using namespace std;
typedef pair<int, int> P;
signed main(){
int n, d, ans = 0;
int x[31], y[31];
map<int, int> dp[31];
vector<P> d1, d2;
cin >> n >> d;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
dp[0][0] = 0;
for (int i = 1; i <= 15; i++) {
for (auto itr = dp[i - 1].begin(); itr != dp[i - 1].end(); itr++) {
dp[i][itr->first + x[i]] = max(dp[i][itr->first + x[i]], itr->second + y[i]);
dp[i][itr->first - x[i]] = max(dp[i][itr->first - x[i]], itr->second - y[i]);
dp[i][itr->first] = max(dp[i][itr->first], itr->second);
}
if (n <= i) {
for (auto itr = dp[n].begin(); itr != dp[n].end(); itr++) {
if (itr->first >= -d && itr->first <= d) {
ans = max(itr->second, ans);
}
}
cout << ans << endl;
return 0;
}
}
for (auto itr = dp[15].begin(); itr != dp[15].end(); itr++) {
d1.push_back(make_pair(itr->second, itr->first));
}
for (int i = 1; i <= 15; i++)
dp[i].erase(dp[i].begin(), dp[i].end());
for (int i = 16; i <= n; i++) {
for (auto itr = dp[i - 1].begin(); itr != dp[i - 1].end(); itr++) {
dp[i][itr->first + x[i]] = max(dp[i][itr->first + x[i]], itr->second + y[i]);
dp[i][itr->first - x[i]] = max(dp[i][itr->first - x[i]], itr->second - y[i]);
dp[i][itr->first] = max(dp[i][itr->first], itr->second);
}
}
for (auto itr = dp[15].begin(); itr != dp[15].end(); itr++) {
d2.push_back(make_pair(itr->second, itr->first));
}
sort(d1.begin(), d1.end());
sort(d2.begin(), d2.end());
for (int i = 0; i < d1.size(); i++) {
int itr = lower_bound(d2.begin(), d2.end(), make_pair(d - d1[i].first + 1, -100000000000000000)) - d2.begin();
itr--;
for (; itr >= 0; itr--) {
if(d2[itr].first + d1[i].first >= -d)
ans = max(ans, d2[itr].second + d1[i].second);
}
}
cout << ans << endl;
return 0;
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
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/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Value = const std::pair<long long int, long int>]':
/usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = pair<long long int, long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
1504 | if (__comp(__middle, __val))
| ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = pair<long long int, long int>]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:56:25: required from here
56 | int itr = lower_bound(d2.begin(), d2.end(), make_pair(d - d1[i].first + 1, -100000000000000000)) - d2.begin();
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long long int, long long int>' and 'const std::pair<long long int, long int>')
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: deduced conflicting types for parameter '_T2' ('long long int' and 'long int')
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: n |
s713056182 | p00536 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <tuple>
#include <map>
#define int long long
#define INF 1e18
using namespace std;
typedef pair<int, int> P;
signed main(){
int n, d, ans = 0;
int x[31], y[31];
map<int, int> dp[31];
vector<P> d1, d2;
cin >> n >> d;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
dp[0][0] = 0;
for (int i = 1; i <= 15; i++) {
for (auto itr = dp[i - 1].begin(); itr != dp[i - 1].end(); itr++) {
dp[i][itr->first + x[i]] = max(dp[i][itr->first + x[i]], itr->second + y[i]);
dp[i][itr->first - x[i]] = max(dp[i][itr->first - x[i]], itr->second - y[i]);
dp[i][itr->first] = max(dp[i][itr->first], itr->second);
}
if (n <= i) {
for (auto itr = dp[n].begin(); itr != dp[n].end(); itr++) {
if (itr->first >= -d && itr->first <= d) {
ans = max(itr->second, ans);
}
}
cout << ans << endl;
return 0;
}
}
for (auto itr = dp[15].begin(); itr != dp[15].end(); itr++) {
d1.push_back(make_pair(itr->second, itr->first));
}
for (int i = 1; i <= 15; i++)
dp[i].erase(dp[i].begin(), dp[i].end());
for (int i = 16; i <= n; i++) {
for (auto itr = dp[i - 1].begin(); itr != dp[i - 1].end(); itr++) {
dp[i][itr->first + x[i]] = max(dp[i][itr->first + x[i]], itr->second + y[i]);
dp[i][itr->first - x[i]] = max(dp[i][itr->first - x[i]], itr->second - y[i]);
dp[i][itr->first] = max(dp[i][itr->first], itr->second);
}
}
for (auto itr = dp[15].begin(); itr != dp[15].end(); itr++) {
d2.push_back(make_pair(itr->second, itr->first));
}
sort(d1.begin(), d1.end());
sort(d2.begin(), d2.end());
for (int i = 0; i < d1.size(); i++) {
int itr = lower_bound(d2.begin(), d2.end(), make_pair(d - d1[i].first + 1, -100000000000000000)) - d2.begin();
itr--;
for (; itr >= 0; itr--) {
if(d2[itr].first + d1[i].first >= -d)
ans = max(ans, d2[itr].second + d1[i].second);
}
}
cout << ans << endl;
return 0;
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
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/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Value = const std::pair<long long int, long int>]':
/usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = pair<long long int, long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
1504 | if (__comp(__middle, __val))
| ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = pair<long long int, long int>]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:56:25: required from here
56 | int itr = lower_bound(d2.begin(), d2.end(), make_pair(d - d1[i].first + 1, -100000000000000000)) - d2.begin();
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long long int, long long int>' and 'const std::pair<long long int, long int>')
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: deduced conflicting types for parameter '_T2' ('long long int' and 'long int')
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: n |
s455046016 | p00536 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#define int long long
using namespace std;
typedef pair<int, int> P;
signed main(){
int n, d, ans = 0;
int x[31], y[31];
map<int, int> dp[31];
vector<P> d1, d2;
cin >> n >> d;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
dp[0][0] = 0;
for (int i = 1; i <= 15; i++) {
for (auto itr = dp[i - 1].begin(); itr != dp[i - 1].end(); itr++) {
dp[i][itr->first + x[i]] = max(dp[i][itr->first + x[i]], itr->second + y[i]);
dp[i][itr->first - x[i]] = max(dp[i][itr->first - x[i]], itr->second - y[i]);
dp[i][itr->first] = max(dp[i][itr->first], itr->second);
}
if (n <= i) {
for (auto itr = dp[n].begin(); itr != dp[n].end(); itr++) {
if (itr->first >= -d && itr->first <= d) {
ans = max(itr->second, ans);
}
}
cout << ans << endl;
return 0;
}
}
for (auto itr = dp[15].begin(); itr != dp[15].end(); itr++) {
d1.push_back(make_pair(itr->second, itr->first));
}
for (int i = 1; i <= 15; i++)
dp[i].erase(dp[i].begin(), dp[i].end());
for (int i = 16; i <= n; i++) {
for (auto itr = dp[i - 1].begin(); itr != dp[i - 1].end(); itr++) {
dp[i][itr->first + x[i]] = max(dp[i][itr->first + x[i]], itr->second + y[i]);
dp[i][itr->first - x[i]] = max(dp[i][itr->first - x[i]], itr->second - y[i]);
dp[i][itr->first] = max(dp[i][itr->first], itr->second);
}
}
for (auto itr = dp[15].begin(); itr != dp[15].end(); itr++) {
d2.push_back(make_pair(itr->second, itr->first));
}
sort(d1.begin(), d1.end());
sort(d2.begin(), d2.end());
for (int i = 0; i < d1.size(); i++) {
int itr = lower_bound(d2.begin(), d2.end(), make_pair(d - d1[i].first + 1, -100000000000000000)) - d2.begin();
itr--;
for (; itr >= 0; itr--) {
if(d2[itr].first + d1[i].first >= -d)
ans = max(ans, d2[itr].second + d1[i].second);
}
}
cout << ans << endl;
return 0;
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
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/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Value = const std::pair<long long int, long int>]':
/usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = pair<long long int, long int>; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
1504 | if (__comp(__middle, __val))
| ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _Tp = pair<long long int, long int>]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:53:25: required from here
53 | int itr = lower_bound(d2.begin(), d2.end(), make_pair(d - d1[i].first + 1, -100000000000000000)) - d2.begin();
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<long long int, long long int>' and 'const std::pair<long long int, long int>')
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: deduced conflicting types for parameter '_T2' ('long long int' and 'long int')
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<long long int, long long int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: n |
s352322758 | p00536 | C++ | #include<iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iterator>
#define int long long
#define INF 1e18
using namespace std;
typedef pair<int, int> P;
signed main() {
int n, d, ans = 0;
int x[31], y[31];
map<int, int> dp[2];
vector<P> d1, d2;
cin >> n >> d;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
}
dp[0][0] = 0;
for (int i = 1; i <= 15; i++) {
for (map<int, int>::iterator itr = dp[0].begin(); itr != dp[0].end(); itr++) {
if (!dp[1][itr->first + x[i]] || dp[1][itr->first + x[i]] < itr->second + y[i])
dp[1][itr->first + x[i]] = itr->second + y[i];
if (!dp[1][itr->first - x[i]] || dp[1][itr->first - x[i]] < itr->second - y[i])
dp[1][itr->first - x[i]] = itr->second - y[i];
if (!dp[1][itr->first] || dp[1][itr->first] < itr->second)
dp[1][itr->first] = itr->second;
}
if (n <= i) {
for (map<int, int>::iterator itr = dp[1].begin(); itr != dp[1].end(); itr++) {
if (itr->first >= -d && itr->first <= d) {
ans = max(itr->second, ans);
}
}
cout << ans << endl;
return 0;
}
copy(dp[1].begin(), dp[1].end(), dp[0]);
dp[1].erase(dp[1].begin(), dp[1].end());
}
for (map<int, int>::iterator itr = dp[15].begin(); itr != dp[15].end(); itr++) {
d1.push_back(make_pair(itr->second, itr->first));
}
for (int i = 1; i <= 15; i++)
dp[i].erase(dp[i].begin(), dp[i].end());
for (int i = 16; i <= n; i++) {
for (map<int, int>::iterator itr = dp[0].begin(); itr != dp[0].end(); itr++) {
if (!dp[1][itr->first + x[i]] || dp[1][itr->first + x[i]] < itr->second + y[i])
dp[1][itr->first + x[i]] = itr->second + y[i];
if (!dp[1][itr->first - x[i]] || dp[1][itr->first - x[i]] < itr->second - y[i])
dp[1][itr->first - x[i]] = itr->second - y[i];
if (!dp[1][itr->first] || dp[1][itr->first] < itr->second)
dp[1][itr->first] = itr->second;
}
copy(dp[1].begin(), dp[1].end(), dp[0]);
dp[1].erase(dp[1].begin(), dp[1].end());
}
for (map<int, int>::iterator itr = dp[15].begin(); itr != dp[15].end(); itr++) {
d2.push_back(make_pair(itr->second, itr->first));
}
sort(d1.begin(), d1.end());
sort(d2.begin(), d2.end());
for (int i = 0; i < d1.size(); i++) {
P p = make_pair(d - d1[i].first + 1, -INF);
int itr = lower_bound(d2.begin(), d2.end(), p) - d2.begin();
itr--;
for (; itr >= 0; itr--) {
if (d2[itr].first + d1[i].first >= -d)
ans = max(ans, d2[itr].second + d1[i].second);
}
}
cout << ans << endl;
return 0;
} | 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: In instantiation of 'static _OI std::__copy_move<_IsMove, _IsSimple, _Category>::__copy_m(_II, _II, _OI) [with _II = std::_Rb_tree_iterator<std::pair<const long long int, long long int> >; _OI = std::map<long long int, long long int>; bool _IsMove = false; bool _IsSimple = false; _Category = std::bidirectional_iterator_tag]':
/usr/include/c++/14/bits/stl_algobase.h:521:30: required from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = _Rb_tree_iterator<pair<const long long int, long long int> >; _OI = map<long long int, long long int>]'
520 | return std::__copy_move<_IsMove, __memcpyable<_OI, _II>::__value,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
521 | _Category>::__copy_m(__first, __last, __result);
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:548:42: required from '_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = _Rb_tree_iterator<pair<const long long int, long long int> >; _OI = map<long long int, long long int>]'
548 | { return std::__copy_move_a2<_IsMove>(__first, __last, __result); }
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:556:31: required from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = _Rb_tree_iterator<pair<const long long int, long long int> >; _OI = map<long long int, long long int>]'
556 | std::__copy_move_a1<_IsMove>(std::__niter_base(__first),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
557 | std::__niter_base(__last),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
558 | std::__niter_base(__result)));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:651:7: required from '_OI std::copy(_II, _II, _OI) [with _II = _Rb_tree_iterator<pair<const long long int, long long int> >; _OI = map<long long int, long long int>]'
650 | return std::__copy_move_a<__is_move_iterator<_II>::__value>
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
651 | (std::__miter_base(__first), std::__miter_base(__last), __result);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:39:7: required from here
39 | copy(dp[1].begin(), dp[1].end(), dp[0]);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:370:37: error: no match for 'operator++' (operand type is 'std::map<long long int, long long int>')
370 | for (; __first != __last; ++__result, (void)++__first)
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:371:13: error: no match for 'operator*' (operand type is 'std::map<long long int, long long int>')
371 | *__result = *__first;
| ^~~~~~~~~
|
s654062905 | p00536 | C++ | #include<iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iterator>
#define int long long
#define INF 1e18
using namespace std;
typedef pair<int, int> P;
signed main() {
int n, d, ans = 0, sum[31] = {}, sum2[31] = {};
int x[31], y[31];
map<int, int> dp[2];
vector<P> d1, d2;
cin >> n >> d;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
sum[i] = x[i] + sum[i - 1];
}
dp[0][0] = 0;
for (int i = 1; i <= 15; i++) {
for (map<int, int>::iterator itr = dp[0].begin(); itr != dp[0].end(); itr++) {
if (!dp[1][itr->first + x[i]] || dp[1][itr->first + x[i]] < itr->second + y[i]) {
dp[1][itr->first + x[i]] = itr->second + y[i];
}
if (n <= 15 || itr->first - x[i] + sum[15] - sum[i] > 0) {
if (!dp[1][itr->first - x[i]] || dp[1][itr->first - x[i]] < itr->second - y[i]) {
dp[1][itr->first - x[i]] = itr->second - y[i];
}
}
if (!dp[1][itr->first] || dp[1][itr->first] < itr->second)
dp[1][itr->first] = itr->second;
}
if (n <= i) {
for (map<int, int>::iterator itr = dp[1].begin(); itr != dp[1].end(); itr++) {
if (itr->first >= -d && itr->first <= d) {
ans = max(itr->second, ans);
}
if (-itr->first >= -d && -itr->first <= d) {
ans = max(-itr->second, ans);
}
}
cout << ans << endl;
return 0;
}
for (map<int, int>::iterator itr = dp[1].begin(); itr != dp[1].end(); itr++)
dp[0][itr->first] = itr->second;
dp[1].erase(dp[1].begin(), dp[1].end());
}
for (map<int, int>::iterator itr = dp[0].begin(); itr != dp[0].end(); itr++) {
d1.push_back(make_pair(itr->second * -1, itr->first));
}
dp[0].erase(dp[0].begin(), dp[0].end());
dp[0][0] = 0;
for (int i = 16; i <= n; i++) {
for (map<int, int>::iterator itr = dp[0].begin(); itr != dp[0].end(); itr++) {
if (!dp[1][itr->first + x[i]] || dp[1][itr->first + x[i]] < itr->second + y[i])
dp[1][itr->first + x[i]] = itr->second + y[i];
if (itr->first - x[i] + sum[n] - sum[i] >= 0)
if (!dp[1][itr->first - x[i]] || dp[1][itr->first - x[i]] < itr->second - y[i])
dp[1][itr->first - x[i]] = itr->second - y[i];
if (!dp[1][itr->first] || dp[1][itr->first] < itr->second)
dp[1][itr->first] = itr->second;
}
for (map<int, int>::iterator itr = dp[1].begin(); itr != dp[1].end(); itr++)
dp[0][itr->first] = itr->second;
dp[1].erase(dp[1].begin(), dp[1].end());
}
for (map<int, int>::iterator itr = dp[0].begin(); itr != dp[0].end(); itr++) {
d2.push_back(make_pair(itr->first, itr->second));
}
dp[0].erase(dp[0].begin(), dp[0].begin());
sort(d1.begin(), d1.end());
sort(d2.begin(), d2.end());
for (int i = 0; i < d1.size(); i++) {
P p = make_pair(d + d1[i].second , INF);
int itr = upper_bound(d2.begin(), d2.end(), p) - d2.begin();
int itr2 = itr;
itr--;
for (; itr >= 0; itr--) {
if (d2[itr].first + d1[i].first >= -d)
ans = max(ans, d2[itr].second - d1[i].second);
else
break;
}
p = make_pair(d - d1[i].second, INF);
bool b = 0;
if (p.first < 0) {
p.first *= -1;
b = 1;
}
int itr = upper_bound(d2.begin(), d2.end(), p) - d2.begin();
int itr2 = itr;
itr--;
for (; itr >= 0; itr--) {
if (b) {
if (-d2[itr].first + d1[i].second >= -d)
ans = max(ans, -d2[itr].second + d1[i].first * - 1);
else
break;
}
else {
if (d2[itr].first + d1[i].second >= -d)
ans = max(ans, -d2[itr].second + d1[i].first * - 1);
else
break;
}
}
d2.erase(d2.begin() + itr + 1, d2.begin() + itr2);
}
for (int i = 0; i < d1.size(); i++) {
P p = make_pair(d + d1[i].second, INF);
int itr = upper_bound(d2.begin(), d2.end(), p) - d2.begin();
int itr2 = itr;
itr--;
for (; itr >= 0; itr--) {
if (d2[itr].first + d1[i].first >= -d)
ans = max(ans, d2[itr].second - d1[i].second);
else
break;
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:97:21: error: redeclaration of 'long long int itr'
97 | int itr = upper_bound(d2.begin(), d2.end(), p) - d2.begin();
| ^~~
a.cc:82:21: note: 'long long int itr' previously declared here
82 | int itr = upper_bound(d2.begin(), d2.end(), p) - d2.begin();
| ^~~
a.cc:98:21: error: redeclaration of 'long long int itr2'
98 | int itr2 = itr;
| ^~~~
a.cc:83:21: note: 'long long int itr2' previously declared here
83 | int itr2 = itr;
| ^~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.