submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s737702164 | p00471 | C++ | #include<cstdio>
int n, m, field[11][11], si, sj, num;
int dfs(int x, int y){
int ans = 0;
if(num == 0){
if(x == si || y == sj)return 1;
else return 0;
}
field[x][y] = 0;
for(int i = x + 1;i < m;i++){
if(field[i][y] == 1){
num--;
ans += dfs(i, y);
num++;
break;
}
}
for(int i = x - 1;i >= 0;i--){
if(field[i][y] == 1){
num--;
ans += dfs(i, y);
num++;
break;
}
}
for(int i = y + 1;i < n;i++){
if(field[x][i] == 1){
num--;
ans += dfs(x, i);
num++;
break;
}
}
for(int i = y - 1;i >= 0;i--){
if(field[x][i] == 1){
num--;
ans += dfs(x, i);
num++;
break;
}
}
field[x][y] = 1;
return ans;
}
int main(){
while(1){
scanf("%d%d", &n, &m);
if(n == 0 && m == 0)return 0;
memset(field, 0, sizeof(field));
num = 0;
for(int i = 0;i < m;i++){
for(int j = 0;j < n;j++){
scanf("%d", &field[i][j]);
if(field[i][j] == 2){
si = i;
sj = j;
}
else num += field[i][j];
}
}
printf("%d\n", dfs(si, sj));
}
} | a.cc: In function 'int main()':
a.cc:52:5: error: 'memset' was not declared in this scope
52 | memset(field, 0, sizeof(field));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<cstdio>
+++ |+#include <cstring>
2 |
|
s025236935 | p00471 | C++ | #include <iostream>
using namespace std;
int n, m, field[11][11], si, sj, num;
int dfs(int x, int y){
int ans = 0;
if(num == 0){
if(x == si || y == sj)return 1;
else return 0;
}
field[x][y] = 0;
for(int i = x + 1 ; i < m ; i++){
if(field[i][y] == 1){
num--;
ans += dfs(i, y);
num++;
break;
}
}
for(int i = x - 1 ; i >= 0 ; i--){
if(field[i][y] == 1){
num--;
ans += dfs(i, y);
num++;
break;
}
}
for(int i = y + 1 ; i < n ; i++){
if(field[x][i] == 1){
num--;
ans += dfs(x, i);
num++;
break;
}
}
for(int i = y - 1 ; i >= 0 ; i--){
if(field[x][i] == 1){
num--;
ans += dfs(x, i);
num++;
break;
}
}
field[x][y] = 1;
return ans;
}
int main(void){
while(cin >> n >> m, n + m){
memset(field, 0, sizeof(field));
num = 0;
for(int i = 0;i < m;i++){
for(int j = 0;j < n;j++){
cin >> field[i][j];
if(field[i][j] == 2){
si = i;
sj = j;
}
else num += field[i][j];
}
}
cout << dfs(si, sj) << endl;
}
} | a.cc: In function 'int main()':
a.cc:55:5: error: 'memset' was not declared in this scope
55 | memset(field, 0, sizeof(field));
| ^~~~~~
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 |
|
s106208421 | p00471 | C++ | //Bokann ga bokka--nn!!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
map<P,int>ma;
int f[15][15];
int linkk[15][15];
P za[25];
int n,m;
int val;
int dp(int mask,int cur)
{
int ret=0;
if(ma[mp(mask,cur)]) return ma[mp(mask,cur)];
int x=za[cur].first;
int y=za[cur].second;
if(mask==(1<<val)-1)
{
if(x==za[23].first || y==za[23].second) return 1;
else return 0;
}
for(int i=x-1;i>=0;i--)
{
int s=linkk[i][y];
if(f[i][y]==1 && !((mask>>s)&1))
{
ret+=dp(mask | (1<<link[i][y]),link[i][y]);
break;
}
}
for(int i=x+1;i<m;i++)
{
int s=linkk[i][y];
if(f[i][y]==1 && !((mask>>s)&1))
{
ret+=dp(mask | (1<<link[i][y]),link[i][y]);
break;
}
}
for(int i=y-1;i>=0;i--)
{
int s=linkk[x][i];
if(f[x][i]==1 && !((mask>>s)&1))
{
ret+=dp(mask | (1<<link[x][i]),link[x][i]);
break;
}
}
for(int i=y+1;i<n;i++)
{
int s=linkk[x][i];
if(f[x][i]==1 && !((mask>>s)&1))
{
ret+=dp(mask | (1<<link[x][i]),link[x][i]);
break;
}
}
if(ret) ma[mp(mask,cur)]=ret;
return ret;
}
int main(){
while(1)
{
cin >> n >> m;
ma.clear();
if(!n) return 0;
int num=0; val=0;
for(int i=0;i<15;i++)for(int j=0;j<15;j++) { f[i][j]=INF; linkk[i][j]=-1;}
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cin >> f[i][j];
if(f[i][j]==1) { linkk[i][j]=num; za[num++]=mp(i,j); val++;}
if(f[i][j]==2) za[23]=mp(i,j);
}
}
cout << dp(0,23) << endl;
}
} | a.cc: In function 'int dp(int, int)':
a.cc:46:44: error: 'link' was not declared in this scope; did you mean 'linkk'?
46 | ret+=dp(mask | (1<<link[i][y]),link[i][y]);
| ^~~~
| linkk
a.cc:55:44: error: 'link' was not declared in this scope; did you mean 'linkk'?
55 | ret+=dp(mask | (1<<link[i][y]),link[i][y]);
| ^~~~
| linkk
a.cc:65:44: error: 'link' was not declared in this scope; did you mean 'linkk'?
65 | ret+=dp(mask | (1<<link[x][i]),link[x][i]);
| ^~~~
| linkk
a.cc:74:44: error: 'link' was not declared in this scope; did you mean 'linkk'?
74 | ret+=dp(mask | (1<<link[x][i]),link[x][i]);
| ^~~~
| linkk
|
s336012508 | p00472 | C | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
ll n, m;
cin >> n >> m;
vector<ll> pos(n);
for (int i = 1; i < n; i++) {
cin >> pos[i];
pos[i] += pos[i - 1];
}
ll res = 0, tmp = 0, ai;
while (m--) {
cin >> ai;
res += abs(pos[ai + tmp] - pos[tmp]);
tmp += ai;
}
cout << res << endl;
return 0;
} | main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
1 | #include <bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s132030192 | p00472 | C | #define abs(a) (a>0?a:-a)
int main(){
int n,a,b,i,dist[100000];
scanf("%d%d",&n,&m);
dist[0]=0;
for(i=1;i<=n;i++){
scanf("%d",&a);
dist[i]=dist[i-1]+a;
}
b=i=0;
while(m--){
scanf("%d",&a);
i+=abs(dist[b]-dist[b+a]);
b+=a;
i%=100000;
}
a=!printf("%d",i);
} | main.c: In function 'main':
main.c:5:2: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
5 | scanf("%d%d",&n,&m);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #define abs(a) (a>0?a:-a)
main.c:5:2: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
5 | scanf("%d%d",&n,&m);
| ^~~~~
main.c:5:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:19: error: 'm' undeclared (first use in this function)
5 | scanf("%d%d",&n,&m);
| ^
main.c:5:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
18 | a=!printf("%d",i);
| ^~~~~~
main.c:18:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:18:5: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s310741830 | p00472 | C | n,m,b,a=1e5,t[a],i;
int main(){
for(scanf("%d%*d",&n);i++<n;t[i]=t[i-1]+a)scanf("%d",&a);
for(;~scanf("%d",&a);b%=a){
b+=abs(t[m]-t[m+=a]);
}
n=!printf("%d\n",b);
} | main.c:1:1: warning: data definition has no type or storage class
1 | n,m,b,a=1e5,t[a],i;
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int]
1 | n,m,b,a=1e5,t[a],i;
| ^
main.c:1:5: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
1 | n,m,b,a=1e5,t[a],i;
| ^
main.c:1:7: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
1 | n,m,b,a=1e5,t[a],i;
| ^
main.c:1:13: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
1 | n,m,b,a=1e5,t[a],i;
| ^
main.c:1:13: error: variably modified 't' at file scope
main.c:1:18: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
1 | n,m,b,a=1e5,t[a],i;
| ^
main.c: In function 'main':
main.c:3:13: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
3 | for(scanf("%d%*d",&n);i++<n;t[i]=t[i-1]+a)scanf("%d",&a);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | n,m,b,a=1e5,t[a],i;
main.c:3:13: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
3 | for(scanf("%d%*d",&n);i++<n;t[i]=t[i-1]+a)scanf("%d",&a);
| ^~~~~
main.c:3:13: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:4:15: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
4 | for(;~scanf("%d",&a);b%=a){
| ^~~~~
main.c:4:15: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:20: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
5 | b+=abs(t[m]-t[m+=a]);
| ^~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
+++ |+#include <stdlib.h>
1 | n,m,b,a=1e5,t[a],i;
main.c:7:12: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
7 | n=!printf("%d\n",b);
| ^~~~~~
main.c:7:12: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:7:12: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:7:12: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s691585694 | p00472 | C | #include <stdio.h>
int x[100005],w=1,n,m,a,i;
long s=0;
main(){
scanf("%d %d",&n,&m);
for(i=1;i<n;i++){
scanf("%d",&x[i]);
}
for(i=0;i<m;i++){
scanf("%d",&a);
if(a>0){
for(int j=0;j<a;j++){
s+=x[w+j];
}
}else{
for(int j=a;j<0;j++){
s+=x[w+j];
}
}
w+=a;
}
printf("%ld\n",s%100000);
return 0;
} | main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
4 | main(){
| ^~~~
|
s046510730 | p00472 | C | #include <stdio.h>
int x[100005],w=1,n,m,a,i;
long s=0;
main(){
scanf("%d %d",&n,&m);
for(i=1;i<n;i++){
scanf("%d",&x[i]);
}
for(i=0;i<m;i++){
scanf("%d",&a);
if(a>0){
for(n=0;n<a;n++){
s+=x[w+j];
}
}else{
for(n=a;n<0;n++){
s+=x[w+j];
}
}
w+=a;
}
printf("%ld\n",s%100000);
return 0;
} | main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
4 | main(){
| ^~~~
main.c: In function 'main':
main.c:13:8: error: 'j' undeclared (first use in this function)
13 | s+=x[w+j];
| ^
main.c:13:8: note: each undeclared identifier is reported only once for each function it appears in
|
s492635189 | p00472 | C | #include <stdio.h>
#define MAXN 100000
using namespace std;
int main(void){
int mm=0;
int nn=0;
scanf("%d",&nn);
scanf("%d",&mm);
int i=0;
int n[MAXN]={0};
int m[MAXN]={0};
for(i=0;i<nn-1;i++){
scanf("%d",&(n[i]));
}
for(i=0;i<mm;i++){
scanf("%d",&(m[i]));
}
int ans=0;
int im=0;
int is=0;
for(i=0;i<mm;i++){
im+=m[i];
if(m[i]>0){
while(is!=im){
ans=((ans+(n[is]%MAXN))%MAXN);
is++;
}
}
else{
while(is!=im){
is--;
ans=((ans+(n[is]%MAXN))%MAXN);
}
}
}
printf("%d",ans);
return 0;
} | main.c:3:1: error: unknown type name 'using'
3 | using namespace std;
| ^~~~~
main.c:3:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
3 | using namespace std;
| ^~~
|
s311979012 | p00472 | C++ | #include <iostream>
using namespace std;
int dist[100000];
int main(){
int n,m,i,d;
while(cin>>n>>m){
memset(dist,0,sizeof(dist));
for(i=1;i<n;i++){
cin>>d;
dist[i]=dist[i-1]+d;
}
int sum=0;
int p=0;
for(i=0;i<m;i++){
cin>>d;
sum+=(d>0)?(dist[p+d]-dist[p]):(dist[p]-dist[p+d]);
p+=d;
}
cout<<sum<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:17: error: 'memset' was not declared in this scope
7 | memset(dist,0,sizeof(dist));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s888232015 | p00472 | C++ | //AOJ 0549 A Traveler
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n, m, now, t[MAX_N], p[MAX_M], res = 0;
void solve(int plan){
if (plan > 0){
const int INF = 100000000, MAX_N = 1000000, MAX_M = 1000000;
for (int i = 0; i < plan; i++){
res += t[now + i];
}
}
else{
for (int i = 0; i > plan; i--){
res += t[now + i - 1];
}
}
if (res >= 100000)
res = res % 100000;
}
int main(){
now = 1;
res = 0;
cin >> n >> m;
for (int i = 1; i < n; i++){
cin >> t[i];
}
for (int i = 1; i <= m; i++){
cin >> p[i];
solve(p[i]);
now += p[i];
}
cout << res % 100000 << endl;
return 0;
} | a.cc:6:18: error: 'MAX_N' was not declared in this scope
6 | int n, m, now, t[MAX_N], p[MAX_M], res = 0;
| ^~~~~
a.cc:6:28: error: 'MAX_M' was not declared in this scope
6 | int n, m, now, t[MAX_N], p[MAX_M], res = 0;
| ^~~~~
a.cc: In function 'void solve(int)':
a.cc:11:32: error: 't' was not declared in this scope
11 | res += t[now + i];
| ^
a.cc:16:32: error: 't' was not declared in this scope
16 | res += t[now + i - 1];
| ^
a.cc: In function 'int main()':
a.cc:27:24: error: 't' was not declared in this scope
27 | cin >> t[i];
| ^
a.cc:30:24: error: 'p' was not declared in this scope
30 | cin >> p[i];
| ^
|
s153942086 | p00472 | C++ | //AOJ 0549 A Traveler
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_N=100001,MAX_M=100001
int n, m, now, t[MAX_N], p[MAX_M], res = 0;
void solve(int plan){
if (plan > 0){
const int INF = 100000000, MAX_N = 1000000, MAX_M = 1000000;
for (int i = 0; i < plan; i++){
res += t[now + i];
}
}
else{
for (int i = 0; i > plan; i--){
res += t[now + i - 1];
}
}
if (res >= 100000)
res = res % 100000;
}
int main(){
now = 1;
res = 0;
cin >> n >> m;
for (int i = 1; i < n; i++){
cin >> t[i];
}
for (int i = 1; i <= m; i++){
cin >> p[i];
solve(p[i]);
now += p[i];
}
cout << res % 100000 << endl;
return 0;
} | a.cc:7:1: error: expected ',' or ';' before 'int'
7 | int n, m, now, t[MAX_N], p[MAX_M], res = 0;
| ^~~
a.cc: In function 'void solve(int)':
a.cc:12:25: error: 'res' was not declared in this scope
12 | res += t[now + i];
| ^~~
a.cc:12:32: error: 't' was not declared in this scope
12 | res += t[now + i];
| ^
a.cc:12:34: error: 'now' was not declared in this scope
12 | res += t[now + i];
| ^~~
a.cc:17:25: error: 'res' was not declared in this scope
17 | res += t[now + i - 1];
| ^~~
a.cc:17:32: error: 't' was not declared in this scope
17 | res += t[now + i - 1];
| ^
a.cc:17:34: error: 'now' was not declared in this scope
17 | res += t[now + i - 1];
| ^~~
a.cc:20:13: error: 'res' was not declared in this scope
20 | if (res >= 100000)
| ^~~
a.cc: In function 'int main()':
a.cc:24:9: error: 'now' was not declared in this scope
24 | now = 1;
| ^~~
a.cc:25:9: error: 'res' was not declared in this scope
25 | res = 0;
| ^~~
a.cc:26:16: error: 'n' was not declared in this scope
26 | cin >> n >> m;
| ^
a.cc:26:21: error: 'm' was not declared in this scope; did you mean 'tm'?
26 | cin >> n >> m;
| ^
| tm
a.cc:28:24: error: 't' was not declared in this scope
28 | cin >> t[i];
| ^
a.cc:31:24: error: 'p' was not declared in this scope
31 | cin >> p[i];
| ^
|
s565589263 | p00472 | C++ | #include <bits/stdc++.h>
using namespace std;
//BITを用いる解法O(mlogn)
const int mod=100000;
int n,m;
int bitsize=1<<20;
int s[100010];
int a[100010];
int bit[bitsize];
void makebit(){
while(n>bitsize) bitsize*=2;
for(int i=1;i<n;i++){//扱いやすさの都合上0は用いない
int now=i;
while(now<=bitsize){
(bit[now]+=s[i])%=mod;
now+=(now&-now);
}
}
}
int cntbit(int now){
now--;
int ans=0;
while(now>0){
(ans+=bit[now])%=mod;
now-=now&-now;
}
return ans;
}
int main(){
cin>>n>>m;
for(int i=1;i<n;i++) cin>>s[i];
makebit();
int now=1;
int ans=0;
for(int i=0;i<m;i++){
cin>>a[i];
int next=now+a[i];
(ans+=abs(cntbit(next)-cntbit(now)))%=mod;
now=next;
}
cout<<ans<<endl;
return 0;
} | a.cc:9:9: error: size of array 'bit' is not an integral constant-expression
9 | int bit[bitsize];
| ^~~~~~~
|
s132205396 | p00472 | C++ | #include <iostream>
using namespace std;
int main(){
int n;
int m;
int a;
int pos;
int dis;
int ans = 0;
int x[100010];
scanf("%d %d",&n,&m);
x[0] = 0;
for(int i = 1;i < n;i++){
scanf("%d", &dis);
x[i] = x[i - 1] + dis;
}
while( m-- ){
scanf("%d", &a);
dis = x[pos + a] - x[pos];
pos += dis
if(dis < 0){
dis = (-1) * dis;
}
ans += dis;
}
ans = ans / 100000;
printf("%d\n", result);
} | a.cc: In function 'int main()':
a.cc:21:19: error: expected ';' before 'if'
21 | pos += dis
| ^
| ;
22 | if(dis < 0){
| ~~
a.cc:29:20: error: 'result' was not declared in this scope
29 | printf("%d\n", result);
| ^~~~~~
|
s608694985 | p00472 | C++ | #include <iostream>
using namespace std;
int main(){
int n;
int m;
int a;
int pos;
int dis;
int ans = 0;
int x[100010];
scanf("%d %d",&n,&m);
x[0] = 0;
for(int i = 1;i < n;i++){
scanf("%d", &dis);
x[i] = x[i - 1] + dis;
}
while( m-- ){
scanf("%d", &a);
dis = x[pos + a] - x[pos];
pos += dis
if(dis < 0){
dis = (-1) * dis;
}
ans += dis;
}
ans %= ans / 100000;
printf("%d\n", result);
} | a.cc: In function 'int main()':
a.cc:21:19: error: expected ';' before 'if'
21 | pos += dis
| ^
| ;
22 | if(dis < 0){
| ~~
a.cc:29:20: error: 'result' was not declared in this scope
29 | printf("%d\n", result);
| ^~~~~~
|
s507346305 | p00472 | C++ | #include<iostream>
using namespace std;
int main(){
int n;
int m;
int dis;
int l;
int pos = 0
int ans = 0;
int x[100010];
scanf("%d %d",&n,&m);
x[0] = 0;
for (int i = 1; i < n; i++){
scanf("%d", &x[i]);
x[i] += x[i - 1];
}
while (m--){
scanf("%d", &l);
result += abs(x[pos + l] - x[pos]);
result %= M;
pos += l;
}
printf("%d\n", result);
} | a.cc: In function 'int main()':
a.cc:10:5: error: expected ',' or ';' before 'int'
10 | int ans = 0;
| ^~~
a.cc:21:9: error: 'result' was not declared in this scope
21 | result += abs(x[pos + l] - x[pos]);
| ^~~~~~
a.cc:22:19: error: 'M' was not declared in this scope
22 | result %= M;
| ^
a.cc:25:20: error: 'result' was not declared in this scope
25 | printf("%d\n", result);
| ^~~~~~
|
s750840719 | p00472 | C++ | #include<cstdio>
#include<math.h>
#include <stdlib.h>
#define M 100000
#include<iostream>
using namespace std;
int main(){
int n;
int m;
int dis;
int l;
int pos = 0
int ans = 0;
int x[100010];
scanf("%d %d",&n,&m);
x[0] = 0;
for (int i = 1; i < n; i++){
scanf("%d", &x[i]);
x[i] += x[i - 1];
}
while (m--){
scanf("%d", &l);
result += abs(x[pos + l] - x[pos]);
result %= M;
pos += l;
}
printf("%d\n", result);
} | a.cc: In function 'int main()':
a.cc:15:5: error: expected ',' or ';' before 'int'
15 | int ans = 0;
| ^~~
a.cc:26:9: error: 'result' was not declared in this scope
26 | result += abs(x[pos + l] - x[pos]);
| ^~~~~~
a.cc:30:20: error: 'result' was not declared in this scope
30 | printf("%d\n", result);
| ^~~~~~
|
s713671242 | p00472 | C++ | #include <vector>
#include <iostream>
using namespace std;
int main()
{
int n, m, d, r;
scanf("%d", &n);
scanf("%d", &m);
vector<int> s(n); s[0] = 0;
vector<int> a(m + 1); a[0] = 0;
for(int i = 1; i < n; i++)
{
scanf("%d", &d);
s[i] = d + s[i - 1];
}
long long ret = 0;
for(int i = 1; i <= m; i++)
{
scanf("%d", &r);
a[i] = r + a[i - 1];
ret += sum[a[i]] - sum[a[i - 1]];
}
printf("%lld\n", ret);
return 0;
} | a.cc: In function 'int main()':
a.cc:31:16: error: 'sum' was not declared in this scope
31 | ret += sum[a[i]] - sum[a[i - 1]];
| ^~~
|
s421222453 | p00472 | C++ | #include <cstdio>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
#define mygc getchar_unlocked
inline void reader(int *x) {
int k, m = 0; *x = 0;
while (true) {
mygc(k);
if (k == '-') { m = 1; break; }
if (48 <= k && k <= 57) { *x = k - 48; break; }
}
while (true) {
mygc(k);
if (k < 48 || 57 < k) break;
*x = (*x) * 10 + k - 48;
}
if (m) (*x) = -(*x);
}
int n, m, s[100009], x[100009];
int main() {
reader(&n); reader(&m);
for (int i = 1; i < n; i++) reader(&s[i]), s[i] += s[i - 1];
long long ret = 0;
for (int i = 1; i <= m; i++) {
reader(&x[i]), x[i] += x[i - 1];
if (x[i] < x[i - 1]) ret += s[x[i - 1]] - s[x[i]];
else ret += s[x[i]] - s[x[i - 1]];
}
printf("%d\n", ret % 100000);
return 0;
} | a.cc: In function 'void reader(int*)':
a.cc:10:21: error: too many arguments to function 'int getchar_unlocked()'
10 | mygc(k);
| ^
In file included from /usr/include/c++/14/cstdio:42,
from a.cc:1:
/usr/include/stdio.h:590:12: note: declared here
590 | extern int getchar_unlocked (void);
| ^~~~~~~~~~~~~~~~
a.cc:15:21: error: too many arguments to function 'int getchar_unlocked()'
15 | mygc(k);
| ^
/usr/include/stdio.h:590:12: note: declared here
590 | extern int getchar_unlocked (void);
| ^~~~~~~~~~~~~~~~
|
s127784244 | p00472 | C++ | #include <iostream>
using namespace std;
int n,m,d[100005],nowwhere,imos[100005];
long long int ans=0;
int main(){
cin>>n>>m;
for(int i=1; i<n; i++) cin>>d[i];??¨ nowwhere=1;
int a;
for(int i=1; i<=m; i++){
cin>>a;
if(a>0){
imos[nowwhere]++;
nowwhere+=a;
imos[nowwhere]--;
}else{
imos[nowwhere]--;
nowwhere+=a;
imos[nowwhere]++;
}
}
for(int i=1; i<n; i++) {
imos[i]+=imos[i-1];
}
for(int i=1; i<n; i++) ans+=imos[i]*d[i];
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:8:38: error: expected primary-expression before '?' token
8 | for(int i=1; i<n; i++) cin>>d[i];??¨ nowwhere=1;
| ^
a.cc:8:39: error: expected primary-expression before '?' token
8 | for(int i=1; i<n; i++) cin>>d[i];??¨ nowwhere=1;
| ^
a.cc:8:40: error: '\U000000a8' was not declared in this scope
8 | for(int i=1; i<n; i++) cin>>d[i];??¨ nowwhere=1;
| ^
a.cc:8:41: error: expected ':' before 'nowwhere'
8 | for(int i=1; i<n; i++) cin>>d[i];??¨ nowwhere=1;
| ^ ~~~~~~~~
| :
a.cc:8:55: error: expected ':' before ';' token
8 | for(int i=1; i<n; i++) cin>>d[i];??¨ nowwhere=1;
| ^
| :
a.cc:8:55: error: expected primary-expression before ';' token
|
s101567570 | p00472 | C++ | #include<iostream>
#include<cstdio>
using namespace std;
int dp[100000][100000];
int field[100000];
int method[100000];
int n,m;
void dpcreate(void){
for(int lp=0;lp<n;lp++){
dp[lp][lp]=0;
}
for(int lp=1;lp<n;lp++){
dp[0][lp]=dp[0][lp-1]+field[lp-1];
dp[lp][0]=dp[0][lp];
}
for(int lp1=1;lp1<n-1;lp1++){
for(int lp2=lp1+1;lp2<n;lp2++){
dp[lp1][lp2]=dp[0][lp2]-dp[0][lp1];
dp[lp2][lp1]=dp[lp1][lp2];
}
}
}
int solve(void){
int prevpos=0,nextpos=0;
int answer=0;
for(int day=0;day<m;day++){
nextpos=prevpos+method[day];
answer+=dp[prevpos][nextpos];
prevpos=nextpos;
if(answer>100000){
answer=answer%100000;
}
}
return answer;
}
int main(void){
scanf("%d %d",&n,&m);
for(int lp=0;lp<n-1;lp++){
scanf("%d",&field[lp]);
}
for(int lp=0;lp<m;lp++){
scanf("%d",&method[lp]);
}
dpcreate();
printf("%d",solve());
return 0;
}
| /tmp/ccGeNW8S.o: in function `dpcreate()':
a.cc:(.text+0x2d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x6c): relocation truncated to fit: R_X86_64_PC32 against symbol `field' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0xc0): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x195): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x1a8): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGeNW8S.o
/tmp/ccGeNW8S.o: in function `solve()':
a.cc:(.text+0x1f1): relocation truncated to fit: R_X86_64_PC32 against symbol `method' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x263): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccGeNW8S.o
/tmp/ccGeNW8S.o: in function `main':
a.cc:(.text+0x280): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x28a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x2be): relocation truncated to fit: R_X86_64_PC32 against symbol `field' defined in .bss section in /tmp/ccGeNW8S.o
a.cc:(.text+0x2e2): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s869464346 | p00472 | C++ | #include<iostream>
#include<cstdio>
using namespace std;
int dp[100000][100000];
int field[100000];
int method[100000];
int n,m;
void dpcreate(void){
for(int lp=0;lp<n;lp++){
dp[lp][lp]=0;
}
for(int lp=1;lp<n;lp++){
dp[0][lp]=dp[0][lp-1]+field[lp-1];
dp[lp][0]=dp[0][lp];
}
for(int lp1=1;lp1<n-1;lp1++){
for(int lp2=lp1+1;lp2<n;lp2++){
dp[lp1][lp2]=dp[0][lp2]-dp[0][lp1];
dp[lp2][lp1]=dp[lp1][lp2];
}
}
}
int solve(void){
int prevpos=0,nextpos=0;
int answer=0;
for(int day=0;day<m;day++){
nextpos=prevpos+method[day];
answer+=dp[prevpos][nextpos];
prevpos=nextpos;
if(answer>100000){
answer=answer%100000;
}
}
return answer;
}
int main(void){
scanf("%d %d",&n,&m);
for(int lp=0;lp<n-1;lp++){
scanf("%d",&field[lp]);
}
for(int lp=0;lp<m;lp++){
scanf("%d",&method[lp]);
}
dpcreate();
printf("%d\n",solve());
return 0;
}
| /tmp/ccylBOhu.o: in function `dpcreate()':
a.cc:(.text+0x2d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x6c): relocation truncated to fit: R_X86_64_PC32 against symbol `field' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0xc0): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x195): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x1a8): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccylBOhu.o
/tmp/ccylBOhu.o: in function `solve()':
a.cc:(.text+0x1f1): relocation truncated to fit: R_X86_64_PC32 against symbol `method' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x263): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccylBOhu.o
/tmp/ccylBOhu.o: in function `main':
a.cc:(.text+0x280): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x28a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x2be): relocation truncated to fit: R_X86_64_PC32 against symbol `field' defined in .bss section in /tmp/ccylBOhu.o
a.cc:(.text+0x2e2): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s365554261 | p00472 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, init, n) for(int i = init; i < (n); i++)
using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
int to, cost;
};
const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main()
{
int N, M;
cin >> N >> M;
vector<int> dist(N, 0);
rep(i, N - 1)
{
int input;
cin >> input;
dist[i + 1] = input;
}
rep(i, N) dist[i + 1] += dist[i];
int now = 0, ans = 0;
rep(i, M)
{
int input;
cin >> input;
ans += abs(dist[now + input] - dist[now]);
now += input;
}
cout << ans % 1e5 << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:50:17: error: invalid operands of types 'int' and 'double' to binary 'operator%'
50 | cout << ans % 1e5 << endl;
| ~~~ ^ ~~~
| | |
| int double
|
s005018763 | p00472 | C++ | d | a.cc:1:1: error: 'd' does not name a type
1 | d
| ^
|
s493592453 | p00472 | C++ | #include <iostream>
#include <cmath>
using namespace std;
const int size = 100001;
int length[size];
int main( void ) {
int n, m;
cin >> n >> m;
length[0] = 0;
for ( int i = 1; i < n; i++ ) {
int si;
cin >> si;
length[i] = length[i-1] + si;
}
int k = 0;
int answer = 0;
for ( int i = 0; i < m; i++ ) {
int ai;
cin >> ai;
int prev = k;
int next = k + ai;
answer += abs( length[next] - length[prev] );
k = next;
}
cout << answer << endl;
return 0;
} | a.cc:6:12: error: reference to 'size' is ambiguous
6 | int length[size];
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:5:11: note: 'const int size'
5 | const int size = 100001;
| ^~~~
a.cc: In function 'int main()':
a.cc:12:5: error: 'length' was not declared in this scope
12 | length[0] = 0;
| ^~~~~~
|
s997649620 | p00472 | C++ | #include <iostream>
#include <cmath>
using namespace std;
const int size = 100001;
int length[size];
int main( void ) {
int n, m;
cin >> n >> m;
length[0] = 0;
for ( int i = 1; i < n; i++ ) {
int si;
cin >> si;
length[i] = length[i-1] + si;
}
int k = 0;
int answer = 0;
for ( int i = 0; i < m; i++ ) {
int ai;
cin >> ai;
int prev = k;
int next = k + ai;
answer += abs( length[next] - length[prev] );
k = next;
}
cout << answer << endl;
return 0;
} | a.cc:6:12: error: reference to 'size' is ambiguous
6 | int length[size];
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:5:11: note: 'const int size'
5 | const int size = 100001;
| ^~~~
a.cc: In function 'int main()':
a.cc:12:5: error: 'length' was not declared in this scope
12 | length[0] = 0;
| ^~~~~~
|
s941403453 | p00472 | C++ | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int n, m;
int sumLoad[100001];
int now;
int ans;
scanf("%d%d", &n, &m);
sumLoad[0] = 0;
for (int i = 0; i < n - 1; i++){
scanf("%d", &sumLoad[i + 1]);
sumLoad[i + 1] += sumLoad[i];
}
now = 0;
ans = 0;
for (int i = 0; i < m; i++){
int a;
scanf("%d", &a);
ans = (ans + abs(sumLoad[now + a] - sumLoa) % 100000;
now += a;
}
printf("%d\n", ans);
return (0);
} | a.cc: In function 'int main()':
a.cc:25:53: error: 'sumLoa' was not declared in this scope; did you mean 'sumLoad'?
25 | ans = (ans + abs(sumLoad[now + a] - sumLoa) % 100000;
| ^~~~~~
| sumLoad
a.cc:25:69: error: expected ')' before ';' token
25 | ans = (ans + abs(sumLoad[now + a] - sumLoa) % 100000;
| ~ ^
| )
|
s177911774 | p00472 | C++ | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int n, m;
int sumLoad[100001];
int now;
int ans;
scanf("%d%d", &n, &m);
sumLoad[0] = 0;
for (int i = 0; i < n - 1; i++){
scanf("%d", &sumLoad[i + 1]);
sumLoad[i + 1] += sumLoad[i];
}
now = 0;
ans = 0;
for (int i = 0; i < m; i++){
int a;
scanf("%d", &a);
ans = (ans + abs(sumLoad[now + a] - sumLoad)) % 100000;
now += a;
}
printf("%d\n", ans);
return (0);
} | a.cc: In function 'int main()':
a.cc:25:51: error: invalid operands of types 'int' and 'int [100001]' to binary 'operator-'
25 | ans = (ans + abs(sumLoad[now + a] - sumLoad)) % 100000;
| ~~~~~~~~~~~~~~~~ ^ ~~~~~~~
| | |
| int int [100001]
|
s154216272 | p00472 | C++ | #include<vector>
#include<cstdio>
#include<math>
using namespace std;
int main(void){
int n,m,s,cnt=0,w=0;
vector<int> a;
//a.push_back(0);
scanf("%d%d",&n,&m);
for(int i=1;i<n;i++){
scanf("%d",&s);
a.push_back(s);
}
for(int i=0;i<m;i++){
scanf("%d",&s);
for(int j=0;j<s;j++){
cnt+=a[w++];
}
for(int j=0;j>s;j--){
cnt+=a[--w];
}
}
printf("%d\n",cnt%100000);
return 0;
} | a.cc:3:9: fatal error: math: No such file or directory
3 | #include<math>
| ^~~~~~
compilation terminated.
|
s262466152 | p00472 | C++ | #include <cstdio>
int x[100005],w=1;
long long s=0;
int main(n,m,a,i){
scanf("%d %d",&n,&m);
for(i=1;i<n;i++){
scanf("%d",&x[i]);
}
for(i=0;i<m;i++){
scanf("%d",&a);
if(a>0){
for(int j=0;j<a;j++){
s+=x[w+j];
}
}else{
for(int j=a;j<0;j++){
s+=x[w+j];
}
}
w+=a;
}
printf("%lld\n",s%100000);
return 0;
} | a.cc:4:5: error: cannot declare '::main' to be a global variable
4 | int main(n,m,a,i){
| ^~~~
a.cc:4:10: error: 'n' was not declared in this scope
4 | int main(n,m,a,i){
| ^
a.cc:4:12: error: 'm' was not declared in this scope
4 | int main(n,m,a,i){
| ^
a.cc:4:14: error: 'a' was not declared in this scope
4 | int main(n,m,a,i){
| ^
a.cc:4:16: error: 'i' was not declared in this scope
4 | int main(n,m,a,i){
| ^
a.cc:4:17: error: expression list treated as compound expression in initializer [-fpermissive]
4 | int main(n,m,a,i){
| ^
|
s925330404 | p00472 | C++ | #include <cstdio>
int x[100005],w=1;
long long s=0;
main(n,m,a,i){
scanf("%d %d",&n,&m);
for(i=1;i<n;i++){
scanf("%d",&x[i]);
}
for(i=0;i<m;i++){
scanf("%d",&a);
if(a>0){
for(int j=0;j<a;j++){
s+=x[w+j];
}
}else{
for(int j=a;j<0;j++){
s+=x[w+j];
}
}
w+=a;
}
printf("%lld\n",s%100000);
return 0;
} | a.cc:4:5: error: expected constructor, destructor, or type conversion before '(' token
4 | main(n,m,a,i){
| ^
|
s859308609 | p00472 | C++ | #include <cstdio>
int x[100005],w=1;
long long s=0;
main(int n,m,a,i){
scanf("%d %d",&n,&m);
for(i=1;i<n;i++){
scanf("%d",&x[i]);
}
for(i=0;i<m;i++){
scanf("%d",&a);
if(a>0){
for(int j=0;j<a;j++){
s+=x[w+j];
}
}else{
for(int j=a;j<0;j++){
s+=x[w+j];
}
}
w+=a;
}
printf("%lld\n",s%100000);
return 0;
} | a.cc:4:12: error: 'm' has not been declared
4 | main(int n,m,a,i){
| ^
a.cc:4:14: error: 'a' has not been declared
4 | main(int n,m,a,i){
| ^
a.cc:4:16: error: 'i' has not been declared
4 | main(int n,m,a,i){
| ^
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main(int n,m,a,i){
| ^~~~
a.cc:4:1: warning: second argument of 'int main(int, int, int, int)' should be 'char **' [-Wmain]
a.cc:4:1: warning: third argument of 'int main(int, int, int, int)' should probably be 'char **' [-Wmain]
a.cc:4:1: warning: 'int main(int, int, int, int)' takes only zero or two arguments [-Wmain]
a.cc: In function 'int main(int, int, int, int)':
a.cc:5:19: error: 'm' was not declared in this scope
5 | scanf("%d %d",&n,&m);
| ^
a.cc:6:5: error: 'i' was not declared in this scope
6 | for(i=1;i<n;i++){
| ^
a.cc:9:5: error: 'i' was not declared in this scope
9 | for(i=0;i<m;i++){
| ^
a.cc:10:13: error: 'a' was not declared in this scope
10 | scanf("%d",&a);
| ^
|
s747552544 | p00472 | C++ | #include <iostream>
using namespace std;
int main(){
int n;
int m;
cin >>n;
cin >>m;
int a[n];
a[0]=0;
int b;
int c;
b=0;
while(b<n){
cin >>c;
a[b+1]=a[b]+c;
b=b+1;}
int e;
e=0;
int d;
d=0;
b=0;
while(b<m){
cin >>c;
if(c>0){e=(e+a[d+c]-a[d])%100000}
else{e=(e+a[d]-a[d+c])%100000}
d=d+c;
b=b+1;}
cout <<e<<endl;} | a.cc: In function 'int main()':
a.cc:24:33: error: expected ';' before '}' token
24 | if(c>0){e=(e+a[d+c]-a[d])%100000}
| ^
| ;
a.cc:25:30: error: expected ';' before '}' token
25 | else{e=(e+a[d]-a[d+c])%100000}
| ^
| ;
|
s805480319 | p00472 | C++ | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<vector>
using namespace std;
#define AMA(100000)
int N,M;
int S[100005];
int main(){
scanf("%d %d",&N,&M);
for(int i=2;i<=N;i++){
int s;
scanf("%d",&s);
S[i]=S[i-1]+s;
}
int now = 1;
int res = 0;
for(int i=0;i<M;i++){
int a;
scanf("%d",&a);
res += (abs(S[now+a]-S[now]))%AMA;
now = now + a;
}
printf("%d\n",res%AMA);
} | a.cc:8:13: error: expected parameter name, found "100000"
8 | #define AMA(100000)
| ^~~~~~
a.cc: In function 'int main()':
a.cc:23:35: error: 'AMA' was not declared in this scope
23 | res += (abs(S[now+a]-S[now]))%AMA;
| ^~~
a.cc:26:21: error: 'AMA' was not declared in this scope
26 | printf("%d\n",res%AMA);
| ^~~
|
s739325916 | p00472 | C++ | #include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = j; i < k; i++)
typedef long long ll;
typedef unsigned long long ull;
int main(){
int n,m;
int field[128000]={0};
scanf("%d%d",&n,&m);
rep(i,n-1){
scanf("%d",&field[i]);
}
int mod = 100000;
int res = 0;
int now = 0;
rep(i,m){
int x;
scanf("%d",&x);
if(x > 0){
if(res+field[j]>=mod)reps(j,now,now+x)res = (res+field[j])%mod;
else{
reps(j,now,now+x)res = res+field[j];
now += x;
}
else{
if(res+field[j]>=100000)
for(int j = now-1;j > now+x-1; j--)res = (res+field[j])%mod;
else{
for(int j = now-1;j > now+x-1; j--)res = (res+field[j]);
now += x;
}
}
printf("%d\n",res);
return 0;
} | a.cc: In function 'int main()':
a.cc:39:26: error: 'j' was not declared in this scope
39 | if(res+field[j]>=mod)reps(j,now,now+x)res = (res+field[j])%mod;
| ^
a.cc:44:9: error: expected '}' before 'else'
44 | else{
| ^~~~
a.cc:38:18: note: to match this '{'
38 | if(x > 0){
| ^
a.cc:45:14: error: 'j' was not declared in this scope
45 | if(res+field[j]>=100000)
| ^
a.cc:54:2: error: expected '}' at end of input
54 | }
| ^
a.cc:25:11: note: to match this '{'
25 | int main(){
| ^
|
s807771197 | p00473 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
int n=ir.nextInt();
a=ir.nextIntArray(n-1);
int m=n>>1;
for(int i=0;i<m;i++){
for(int j=;j<m;j++){
for(int k=0;k<2;k++){
dp[i][j][k]=-1;
}
}
}
out.println(dfs(0,0,0));
}
static int m;
static int[] a;
static int[][][] dp;
public static int dfs(int l,int r,int now){
if(dp[l][r][now]>=0) return dp[l][r][now];
if(l==m&&r==m) return dp[l][r][now]=0;
int mi=1<<29;
if(now==0&&l<m) mi=Math.min(mi,dfs(l+1,r,now));
if(now==1&&r<m) mi=Math.min(mi,dfs(l,r+1,now));
if(l!=0&&r!=0) mi=Math.min(mi,dfs(l,r,now^1)+a[l+r-1]);
return dp[l][r][now]=mi;
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:21: error: illegal start of expression
for(int j=;j<m;j++){
^
1 error
|
s690684227 | p00473 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
typedef uint16_t li;
const li linf = 0xfffffffffffffff;
li dp[5005][5005][2];
short int leng[10005] = { 0 };
int main()
{
for (int i = 0; i < 5005; i++) {
for (int j = 0; j < 5005; j++) {
dp[i][j][0] = linf;
dp[i][j][1] = linf;
}
}
dp[0][0][0] = 0;
dp[0][0][1] = 0;
int n;
cin >> n;
for (int i = 1; i < n; i++) cin >> leng[i];
for (int i = 0; i <= n / 2; i++) {
for (int j = 0; j <= n / 2; j++) {
if (i > 0) {
dp[i][j][0] = min(dp[i - 1][j][1] + leng[i + j], dp[i - 1][j][0] + leng[i + j] - leng[i + j - 1]);
}
if (j > 0) {
dp[i][j][1] = min(dp[i][j - 1][0] + leng[i + j], dp[i][j - 1][1] + leng[i + j] - leng[i + j - 1]);
}
}
}
cout << min(dp[n / 2][n / 2][0], dp[n / 2][n / 2][1]) << endl;
return 0;
}
| a.cc:4:9: error: 'uint16_t' does not name a type
4 | typedef uint16_t li;
| ^~~~~~~~
a.cc:3:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
2 | #include <algorithm>
+++ |+#include <cstdint>
3 | using namespace std;
a.cc:5:7: error: 'li' does not name a type
5 | const li linf = 0xfffffffffffffff;
| ^~
a.cc:6:1: error: 'li' does not name a type
6 | li dp[5005][5005][2];
| ^~
a.cc: In function 'int main()':
a.cc:12:25: error: 'dp' was not declared in this scope
12 | dp[i][j][0] = linf;
| ^~
a.cc:12:39: error: 'linf' was not declared in this scope
12 | dp[i][j][0] = linf;
| ^~~~
a.cc:16:9: error: 'dp' was not declared in this scope
16 | dp[0][0][0] = 0;
| ^~
|
s191688742 | p00473 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
typedef uint16_t li;
const li linf = 1000000;
li dp[5005][5005][2];
short int leng[10005] = { 0 };
int main()
{
for (int i = 0; i < 5005; i++) {
for (int j = 0; j < 5005; j++) {
dp[i][j][0] = linf;
dp[i][j][1] = linf;
}
}
dp[0][0][0] = 0;
dp[0][0][1] = 0;
int n;
cin >> n;
for (int i = 1; i < n; i++) cin >> leng[i];
for (int i = 0; i <= n / 2; i++) {
for (int j = 0; j <= n / 2; j++) {
if (i > 0) {
dp[i][j][0] = min(dp[i - 1][j][1] + leng[i + j], dp[i - 1][j][0] + leng[i + j] - leng[i + j - 1]);
}
if (j > 0) {
dp[i][j][1] = min(dp[i][j - 1][0] + leng[i + j], dp[i][j - 1][1] + leng[i + j] - leng[i + j - 1]);
}
}
}
cout << min(dp[n / 2][n / 2][0], dp[n / 2][n / 2][1]) << endl;
return 0;
}
| a.cc:4:9: error: 'uint16_t' does not name a type
4 | typedef uint16_t li;
| ^~~~~~~~
a.cc:3:1: note: 'uint16_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
2 | #include <algorithm>
+++ |+#include <cstdint>
3 | using namespace std;
a.cc:5:7: error: 'li' does not name a type
5 | const li linf = 1000000;
| ^~
a.cc:6:1: error: 'li' does not name a type
6 | li dp[5005][5005][2];
| ^~
a.cc: In function 'int main()':
a.cc:12:25: error: 'dp' was not declared in this scope
12 | dp[i][j][0] = linf;
| ^~
a.cc:12:39: error: 'linf' was not declared in this scope
12 | dp[i][j][0] = linf;
| ^~~~
a.cc:16:9: error: 'dp' was not declared in this scope
16 | dp[0][0][0] = 0;
| ^~
|
s942805993 | p00473 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <deque>
#include <complex>
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define REP(i,a) FOR(i,0,a)
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef int useType;
typedef pair<useType,useType> pr;
typedef vector<useType> VI;
const int INF=1<<30;
int DP[2][2][10002];
int main(){
int n,p;
while(cin >> n && n){
REP(i,2)
REP(j,10002){
DP[0][i][j]=INF;
DP[1][i][j]=INF;
}
DP[0][0][1]=0;
DP[0][1][0]=0;
REP(i,n-1){
cin >> p;
FOR(k,1,n+1)
DP[(i+1)&1][0][k]=min(DP[i&1][0][k-1],DP[i&1][1][k-1]+p);
REP(k,n1)
DP[(i+1)&1][1][k]=min(DP[i&1][0][k]+p,DP[i&1][1][k]);
}
cout << min(DP[(n+1)&1][0][n/2],DP[(n+1)&1][1][n/2]) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:36:31: error: 'n1' was not declared in this scope; did you mean 'n'?
36 | REP(k,n1)
| ^~
a.cc:9:42: note: in definition of macro 'FOR'
9 | #define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
| ^
a.cc:36:25: note: in expansion of macro 'REP'
36 | REP(k,n1)
| ^~~
|
s575680771 | p00473 | C++ | //0550 Dividing Snacks お菓子の分割
#include <cstdio>
#include <algorithm>
using namespace std;
int dp[2][5010][2];
#define MAX 100000000
int main(void){
int n;
scanf("%d",&n);
int i,j;
int a[10001];
for(i=0;i<n-1;i++){
scanf("%d",&a[i]);
}
for(i=0;i<2;i++){
for(j=0;j<=5001;j++){
dp[i][j][0]=MAX;
dp[i][j][1]=MAX;
}
}
dp[0][0][0]=0;//スタート地点
for(i=0;i<n;i++){
int m=min(5010,i);
for(j=0;j<=m;j++){
dp[(i+1)&1][j+1][0]=min(dp[i&1][j][0],dp[i&1][j][1]+a[i]);
dp[(i+1)&1][j][1]=min(dp[i&1][j][1],dp[i&1][j][0]+a[i]);
}
dp[i&1][0][0]=MAX;
}
int min=MAX;
for(i=0;i<2;i++){
if(dp[0][n/2][i]<min){
min=dp[0][n/2][i];
}
if(dp[01[n/2][i]<min){
min=dp[1][n/2][i];
}
}
printf("%d\n",min);
return 0;
} | a.cc: In function 'int main()':
a.cc:35:25: error: invalid types 'int[int]' for array subscript
35 | if(dp[01[n/2][i]<min){
| ^
a.cc:35:37: error: expected ']' before ')' token
35 | if(dp[01[n/2][i]<min){
| ^
| ]
|
s556963901 | p00473 | C++ | #include <cstdio>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
int n, t, dp[2][5001][2];
scanf("%d",&n);
rep(i,2)rep(j,5001)rep(k,2)dp[i][j][k]=100000000;
dp[0][1][0] = 0; dp[0][0][1] = 0;
for(int i = 1; i < n; i++){
scanf("%d",&t);
for(int j = 0; j <= n/2; j++){
if(j != 0){
dp[1][j][0] = min(dp[0][j-1][0],dp[0][j-1][1]+t);
dp[1][j][1] = min(dp[0][j][1],dp[0][j][0]+t);
} else dp[1][j][1] = dp[0][j][1];
}
for(int j = 0; j <= n/2; j++)rep(k,2)dp[0][j][k] = dp[1][j][k];
}
printf("%d\n", min(dp[0][n/2][0],dp[0][n/2][1]));
} | a.cc: In function 'int main()':
a.cc:13:31: error: 'min' was not declared in this scope; did you mean 'main'?
13 | dp[1][j][0] = min(dp[0][j-1][0],dp[0][j-1][1]+t);
| ^~~
| main
a.cc:19:20: error: 'min' was not declared in this scope; did you mean 'main'?
19 | printf("%d\n", min(dp[0][n/2][0],dp[0][n/2][1]));
| ^~~
| main
|
s387199748 | p00473 | C++ | #include<bits/stdc++.h>
using namespace std;N,C,D[2][5001],i,j,*A,*B;main(){A=*D;B=D[1];cin>>N;fill_n(*D,1e4+2,1e9);A[1]=*B=0;for(;++i<N&&cin>>C;)for(j=N/2;~j;)A[j+1]=min(A[j],B[j]+C),B[j--]=min(A[j]+C,B[j]);cout<<min(A[N/2],B[N/2])<<endl;} | a.cc:2:21: error: 'N' does not name a type
2 | using namespace std;N,C,D[2][5001],i,j,*A,*B;main(){A=*D;B=D[1];cin>>N;fill_n(*D,1e4+2,1e9);A[1]=*B=0;for(;++i<N&&cin>>C;)for(j=N/2;~j;)A[j+1]=min(A[j],B[j]+C),B[j--]=min(A[j]+C,B[j]);cout<<min(A[N/2],B[N/2])<<endl;}
| ^
a.cc:2:46: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | using namespace std;N,C,D[2][5001],i,j,*A,*B;main(){A=*D;B=D[1];cin>>N;fill_n(*D,1e4+2,1e9);A[1]=*B=0;for(;++i<N&&cin>>C;)for(j=N/2;~j;)A[j+1]=min(A[j],B[j]+C),B[j--]=min(A[j]+C,B[j]);cout<<min(A[N/2],B[N/2])<<endl;}
| ^~~~
a.cc: In function 'int main()':
a.cc:2:53: error: 'A' was not declared in this scope
2 | using namespace std;N,C,D[2][5001],i,j,*A,*B;main(){A=*D;B=D[1];cin>>N;fill_n(*D,1e4+2,1e9);A[1]=*B=0;for(;++i<N&&cin>>C;)for(j=N/2;~j;)A[j+1]=min(A[j],B[j]+C),B[j--]=min(A[j]+C,B[j]);cout<<min(A[N/2],B[N/2])<<endl;}
| ^
a.cc:2:56: error: 'D' was not declared in this scope
2 | using namespace std;N,C,D[2][5001],i,j,*A,*B;main(){A=*D;B=D[1];cin>>N;fill_n(*D,1e4+2,1e9);A[1]=*B=0;for(;++i<N&&cin>>C;)for(j=N/2;~j;)A[j+1]=min(A[j],B[j]+C),B[j--]=min(A[j]+C,B[j]);cout<<min(A[N/2],B[N/2])<<endl;}
| ^
a.cc:2:58: error: 'B' was not declared in this scope
2 | using namespace std;N,C,D[2][5001],i,j,*A,*B;main(){A=*D;B=D[1];cin>>N;fill_n(*D,1e4+2,1e9);A[1]=*B=0;for(;++i<N&&cin>>C;)for(j=N/2;~j;)A[j+1]=min(A[j],B[j]+C),B[j--]=min(A[j]+C,B[j]);cout<<min(A[N/2],B[N/2])<<endl;}
| ^
a.cc:2:70: error: 'N' was not declared in this scope
2 | using namespace std;N,C,D[2][5001],i,j,*A,*B;main(){A=*D;B=D[1];cin>>N;fill_n(*D,1e4+2,1e9);A[1]=*B=0;for(;++i<N&&cin>>C;)for(j=N/2;~j;)A[j+1]=min(A[j],B[j]+C),B[j--]=min(A[j]+C,B[j]);cout<<min(A[N/2],B[N/2])<<endl;}
| ^
a.cc:2:110: error: 'i' was not declared in this scope
2 | using namespace std;N,C,D[2][5001],i,j,*A,*B;main(){A=*D;B=D[1];cin>>N;fill_n(*D,1e4+2,1e9);A[1]=*B=0;for(;++i<N&&cin>>C;)for(j=N/2;~j;)A[j+1]=min(A[j],B[j]+C),B[j--]=min(A[j]+C,B[j]);cout<<min(A[N/2],B[N/2])<<endl;}
| ^
a.cc:2:120: error: 'C' was not declared in this scope
2 | using namespace std;N,C,D[2][5001],i,j,*A,*B;main(){A=*D;B=D[1];cin>>N;fill_n(*D,1e4+2,1e9);A[1]=*B=0;for(;++i<N&&cin>>C;)for(j=N/2;~j;)A[j+1]=min(A[j],B[j]+C),B[j--]=min(A[j]+C,B[j]);cout<<min(A[N/2],B[N/2])<<endl;}
| ^
a.cc:2:127: error: 'j' was not declared in this scope; did you mean 'jn'?
2 | using namespace std;N,C,D[2][5001],i,j,*A,*B;main(){A=*D;B=D[1];cin>>N;fill_n(*D,1e4+2,1e9);A[1]=*B=0;for(;++i<N&&cin>>C;)for(j=N/2;~j;)A[j+1]=min(A[j],B[j]+C),B[j--]=min(A[j]+C,B[j]);cout<<min(A[N/2],B[N/2])<<endl;}
| ^
| jn
|
s016598676 | p00473 | C++ | nclude<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int main()
{
int N, t[10000] = {};
int dp[5001][2];
fill_n(*dp, 5001 * 2, INF);
scanf("%d", &N);
for(int i = 0; i < N - 1; i++) scanf("%d", &t[i]);
dp[1][0] = 0;
for(int i = 0; i < N - 1; i++) {
for(int j = N / 2; j > 0; j--) {
dp[j][1] = min(dp[j ][1], dp[j ][0] + t[i]);
dp[j][0] = min(dp[j - 1][0], dp[j - 1][1] + t[i]);
}
}
printf("%d\n", dp[N / 2][0]);
} | a.cc:1:1: error: 'nclude' does not name a type
1 | nclude<bits/stdc++.h>
| ^~~~~~
a.cc: In function 'int main()':
a.cc:8:3: error: 'fill_n' was not declared in this scope
8 | fill_n(*dp, 5001 * 2, INF);
| ^~~~~~
a.cc:10:3: error: 'scanf' was not declared in this scope
10 | scanf("%d", &N);
| ^~~~~
a.cc:16:18: error: 'min' was not declared in this scope; did you mean 'main'?
16 | dp[j][1] = min(dp[j ][1], dp[j ][0] + t[i]);
| ^~~
| main
a.cc:20:3: error: 'printf' was not declared in this scope
20 | printf("%d\n", dp[N / 2][0]);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | nclude<bits/stdc++.h>
|
s609911679 | p00473 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)
int n;
int time[10000];
int dp[10000][5000];//[i][j] = i????????\?????§j??¬??????????°?
// d????????\?????§a?????????????°????
int dfs(int d, int a) {
if (n - d == a) return 0;
if (a < 0) return INF;
if (dp[d][a] != INF) return dp[d][a];
int res = INF;
FOR(i, d + 1, n) {
res = min(res, time[i - 1] + dfs(i, a - (i - d)));
res = min(res, time[i - 1] + dfs(i, a));
}
return dp[d][a] = res;
}
int main() {
cin >> n;
REP(i, n - 1) scanf("%d", &time[i]);
fill(dp[0], dp[n], INF);
cout << dfs(0, n / 2) << endl;
return 0;
}
// 0:50 0:50 | a.cc:12:15: error: 'int time [10000]' redeclared as different kind of entity
12 | int time[10000];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int dfs(int, int)':
a.cc:23:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | res = min(res, time[i - 1] + dfs(i, a - (i - d)));
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:23:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | res = min(res, time[i - 1] + dfs(i, a - (i - d)));
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:23:26: error: no matching function for call to 'min(int&, time_t (*)(time_t*) noexcept)'
23 | res = min(res, time[i - 1] + dfs(i, a - (i - d)));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:
/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:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'})
23 | res = min(res, time[i - 1] + dfs(i, a - (i - d)));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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,
from a.cc:3:
/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:23:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
23 | res = min(res, time[i - 1] + dfs(i, a - (i - d)));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:24:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | res = min(res, time[i - 1] + dfs(i, a));
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:24:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | res = min(res, time[i - 1] + dfs(i, a));
| ~~~~~~~~~~~~^~~~~~~~~~~
a.cc:24:26: error: no matching function for call to 'min(int&, time_t (*)(time_t*) noexcept)'
24 | res = min(res, time[i - 1] + dfs(i, a));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:24:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'})
24 | res = min(res, time[i - 1] + dfs(i, a));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
/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:24:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
24 | res = min(res, time[i - 1] + dfs(i, a));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:31:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | REP(i, n - 1) scanf("%d", &time[i]);
| ^
|
s845683715 | p00473 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)
int n;
int time[10000];
int dp[10000][5000];//[i][j] = i????????\?????§j??¬??????????°?
// d????????\?????§a?????????????°????
int dfs(int d, int a) {
if (a == 0) return 0;
if (a < 0 || d == n - 1) return INF;
if (dp[d][a] != INF) return dp[d][a];
int res = INF;
FOR(i, d + 1, n) {
res = min(res, time[i - 1] + dfs(i, a - (i - d)));
res = min(res, time[i - 1] + dfs(i, a));
}
return dp[d][a] = res;
}
int main() {
cin >> n;
REP(i, n - 1) scanf("%d", &time[i]);
fill(dp[0], dp[n], INF);
cout << dfs(0, n / 2) << endl;
return 0;
} | a.cc:12:15: error: 'int time [10000]' redeclared as different kind of entity
12 | int time[10000];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int dfs(int, int)':
a.cc:23:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | res = min(res, time[i - 1] + dfs(i, a - (i - d)));
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:23:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | res = min(res, time[i - 1] + dfs(i, a - (i - d)));
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:23:26: error: no matching function for call to 'min(int&, time_t (*)(time_t*) noexcept)'
23 | res = min(res, time[i - 1] + dfs(i, a - (i - d)));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:
/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:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'})
23 | res = min(res, time[i - 1] + dfs(i, a - (i - d)));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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,
from a.cc:3:
/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:23:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
23 | res = min(res, time[i - 1] + dfs(i, a - (i - d)));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:24:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | res = min(res, time[i - 1] + dfs(i, a));
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:24:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | res = min(res, time[i - 1] + dfs(i, a));
| ~~~~~~~~~~~~^~~~~~~~~~~
a.cc:24:26: error: no matching function for call to 'min(int&, time_t (*)(time_t*) noexcept)'
24 | res = min(res, time[i - 1] + dfs(i, a));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:24:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'})
24 | res = min(res, time[i - 1] + dfs(i, a));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
/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:24:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
24 | res = min(res, time[i - 1] + dfs(i, a));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:31:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | REP(i, n - 1) scanf("%d", &time[i]);
| ^
|
s644121134 | p00473 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef long long ll;
int k[10000];
int dp[2][5101][2];
signed main()
{
int N, i, j;
cin >> N;
rep(i,N-1) cin >> k[i];
memset(dp, 0x7f, sizeof(dp));
dp[0][0][0] = 0;
rep(i,N) {
int m = min(5009, i);
for (j=0; j<=m; j++) {
dp[(i+1)&1][j+1][0] = min(dp[i&1][j][0], dp[i&1][j][1] + k[i]);
dp[(i+1)&1][j][1] = min(dp[i&1][j][1], dp[i&1][j][0] + k[i]);
}
dp[i&1][0][0] = 0x7f7f;
}
cout << dp[N%2][N/2][0];
} | a.cc: In function 'int main()':
a.cc:19:28: error: no matching function for call to 'min(int, long long int&)'
19 | int m = min(5009, i);
| ~~~^~~~~~~~~
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:19:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
19 | int m = min(5009, i);
| ~~~^~~~~~~~~
/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:19:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
19 | int m = min(5009, i);
| ~~~^~~~~~~~~
|
s205021034 | p00473 | C++ | #include<bits/stdc++.h>
using namespace std;
????
int dp[2][5005][2]{};//1 here 0 there
int main(){
????????for(int x=0;x<2;x++){
????????for(int y=0;y<5000;y++){
????????????????dp[x][y][0]=dp[x][y][1]=1<<29;
????????????????}
????????}
????????dp[0][0][0]=dp[0][0][1]=0;
????????int a;
????????cin>>a;
????????for(int b=1;b<a;b++){
????????for(int i=0;i<=a/2;i++)dp[b&1][i][0]=dp[b&1][i][1]=1<<29;
????????int c;scanf("%d",&c);
????????dp[b&1][0][0]=dp[(b+1)&1][0][0];
????????for(int d=a/2;d>=1;d--){
????????????????????????????dp[b&1][d][1]=min({dp[(b+1)&1][d-1][1],dp[(b+1)&1][d-1][0]+c});
????????????????????dp[b&1][d][0]=min({dp[(b+1)&1][d][0],dp[(b+1)&1][d][1]+c});
????????????????}
????????}
??????cout<<min(dp[(a+1)&1][a/2][0],dp[(a+1)&1][a/2][1])<<endl;
} | a.cc:3:1: error: expected unqualified-id before '?' token
3 | ????
| ^
a.cc: In function 'int main()':
a.cc:6:1: error: expected primary-expression before '?' token
6 | ????????for(int x=0;x<2;x++){
| ^
a.cc:6:2: error: expected primary-expression before '?' token
6 | ????????for(int x=0;x<2;x++){
| ^
a.cc:6:3: error: expected primary-expression before '?' token
6 | ????????for(int x=0;x<2;x++){
| ^
a.cc:6:4: error: expected primary-expression before '?' token
6 | ????????for(int x=0;x<2;x++){
| ^
a.cc:6:5: error: expected primary-expression before '?' token
6 | ????????for(int x=0;x<2;x++){
| ^
a.cc:6:6: error: expected primary-expression before '?' token
6 | ????????for(int x=0;x<2;x++){
| ^
a.cc:6:7: error: expected primary-expression before '?' token
6 | ????????for(int x=0;x<2;x++){
| ^
a.cc:6:8: error: expected primary-expression before '?' token
6 | ????????for(int x=0;x<2;x++){
| ^
a.cc:6:9: error: expected primary-expression before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
a.cc:6:9: error: expected ':' before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
| :
a.cc:6:9: error: expected primary-expression before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
a.cc:6:9: error: expected ':' before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
| :
a.cc:6:9: error: expected primary-expression before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
a.cc:6:9: error: expected ':' before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
| :
a.cc:6:9: error: expected primary-expression before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
a.cc:6:9: error: expected ':' before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
| :
a.cc:6:9: error: expected primary-expression before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
a.cc:6:9: error: expected ':' before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
| :
a.cc:6:9: error: expected primary-expression before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
a.cc:6:9: error: expected ':' before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
| :
a.cc:6:9: error: expected primary-expression before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
a.cc:6:9: error: expected ':' before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
| :
a.cc:6:9: error: expected primary-expression before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
a.cc:6:9: error: expected ':' before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
| :
a.cc:6:9: error: expected primary-expression before 'for'
6 | ????????for(int x=0;x<2;x++){
| ^~~
a.cc:6:21: error: 'x' was not declared in this scope
6 | ????????for(int x=0;x<2;x++){
| ^
a.cc:11:1: error: expected primary-expression before '?' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
a.cc:11:2: error: expected primary-expression before '?' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
a.cc:11:3: error: expected primary-expression before '?' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
a.cc:11:4: error: expected primary-expression before '?' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
a.cc:11:5: error: expected primary-expression before '?' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
a.cc:11:6: error: expected primary-expression before '?' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
a.cc:11:7: error: expected primary-expression before '?' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
a.cc:11:8: error: expected primary-expression before '?' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
a.cc:11:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^~
| dup
a.cc:11:34: error: expected ':' before ';' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
| :
a.cc:11:34: error: expected primary-expression before ';' token
a.cc:11:34: error: expected ':' before ';' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
| :
a.cc:11:34: error: expected primary-expression before ';' token
a.cc:11:34: error: expected ':' before ';' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
| :
a.cc:11:34: error: expected primary-expression before ';' token
a.cc:11:34: error: expected ':' before ';' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
| :
a.cc:11:34: error: expected primary-expression before ';' token
a.cc:11:34: error: expected ':' before ';' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
| :
a.cc:11:34: error: expected primary-expression before ';' token
a.cc:11:34: error: expected ':' before ';' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
| :
a.cc:11:34: error: expected primary-expression before ';' token
a.cc:11:34: error: expected ':' before ';' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
| :
a.cc:11:34: error: expected primary-expression before ';' token
a.cc:11:34: error: expected ':' before ';' token
11 | ????????dp[0][0][0]=dp[0][0][1]=0;
| ^
| :
a.cc:11:34: error: expected primary-expression before ';' token
a.cc:12:1: error: expected primary-expression before '?' token
12 | ????????int a;
| ^
a.cc:12:2: error: expected primary-expression before '?' token
12 | ????????int a;
| ^
a.cc:12:3: error: expected primary-expression before '?' token
12 | ????????int a;
| ^
a.cc:12:4: error: expected primary-expression before '?' token
12 | ????????int a;
| ^
a.cc:12:5: error: expected primary-expression before '?' token
12 | ????????int a;
| ^
a.cc:12:6: error: expected primary-expression before '?' token
12 | ????????int a;
| ^
a.cc:12:7: error: expected primary-expression before '?' token
12 | ????????int a;
| ^
a.cc:12:8: error: expected primary-expression before '?' token
12 | ????????int a;
| ^
a.cc:12:9: error: expected primary-expression before 'int'
12 | ????????int a;
| ^~~
a.cc:12:9: error: expected ':' before 'int'
12 | ????????int a;
| ^~~
| :
a.cc:12:9: error: expected primary-expression before 'int'
12 | ????????int a;
| ^~~
a.cc:12:9: error: expected ':' before 'int'
12 | ????????int a;
| ^~~
| :
a.cc:12:9: error: expected primary-expression before 'int'
12 | ????????int a;
| ^~~
a.cc:12:9: error: expected ':' before 'int'
12 | ????????int a;
| ^~~
| :
a.cc:12:9: error: expected primary-expression before 'int'
12 | ????????int a;
| ^~~
a.cc:12:9: error: expected ':' before 'int'
12 | ????????int a;
| ^~~
| :
a.cc:12:9: error: expected primary-expression before 'int'
12 | ????????int a;
| ^~~
a.cc:12:9: error: expected ':' before 'int'
12 | ????????int a;
| ^~~
| :
a.cc:12:9: error: expected primary-expression before 'int'
12 | ????????int a;
| ^~~
a.cc:12:9: error: expected ':' before 'int'
12 | ????????int a;
| ^~~
| :
a.cc:12:9: error: expected primary-expression before 'int'
12 | ????????int a;
| ^~~
a.cc:12:9: error: expected ':' before 'int'
12 | ????????int a;
| ^~~
| :
a.cc:12:9: error: expected primary-expression before 'int'
12 | ????????int a;
| ^~~
a.cc:12:9: error: expected ':' before 'int'
12 | ????????int a;
| ^~~
| :
a.cc:12:9: error: expected primary-expression before 'int'
12 | ????????int a;
| ^~~
a.cc:13:1: error: expected primary-expression before '?' token
13 | ????????cin>>a;
| ^
a.cc:13:2: error: expected primary-expression before '?' token
13 | ????????cin>>a;
| ^
a.cc:13:3: error: expected primary-expression before '?' token
13 | ????????cin>>a;
| ^
a.cc:13:4: error: expected primary-expression before '?' token
13 | ????????cin>>a;
| ^
a.cc:13:5: error: expected primary-expression before '?' token
13 | ????????cin>>a;
| ^
a.cc:13:6: error: expected primary-expression before '?' token
13 | ????????cin>>a;
| ^
a.cc:13:7: error: expected primary-expression before '?' token
13 | ????????cin>>a;
| ^
a.cc:13:8: error: expected primary-expression before '?' token
13 | ????????cin>>a;
| ^
a.cc:13:14: error: 'a' was not declared in this scope
13 | ????????cin>>a;
| ^
a.cc:13:15: error: expected ':' before ';' token
13 | ????????cin>>a;
| ^
| :
a.cc:13:15: error: expected primary-expression before ';' token
a.cc:13:15: error: expected ':' before ';' token
13 | ????????cin>>a;
| ^
| :
a.cc:13:15: error: expected primary-expression before ';' token
a.cc:13:15: error: expected ':' before ';' token
13 | ????????cin>>a;
| ^
| :
a.cc:13:15: error: expected primary-expression before ';' token
a.cc:13:15: error: expected ':' before ' |
s598329819 | p00473 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <bitset>
#include <fstream>
#include <cmath>
#include <ctime>
#include <numeric>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define REP(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define MSG(a) cout << #a << " " << a << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int snac[10000];
int dp[2][5105][2]; // dp[i][j][k] := i : |CgiôïÅg¢Üí·jj : [Ì k : ¼OÌrbg
const int INF = 0x7f7f;
int main()
{
int n;
while(cin >> n && n)
{
memset(dp, INF, sizeof(dp));
memset(snac, 0, sizeof(snac));
rep(i, n-1)
cin >> snac[i];
dp[0][0][0] = 0;
rep(i, n)
{
int m = min(i, 5009);
rep(j, m+1)
{
dp[(i+1)&1][j+1][0] = min(dp[i&1][j][0], dp[i&1][j][1] + snac[i]);
dp[(i+1)&1][j][1] = min(dp[i&1][j][1], dp[i&1][j][0] + snac[i]);
}
dp[i&1][0][0] = INF;
}
cout << dp[n&1][n/2][0] << endl;
}
} | a.cc: In function 'int main()':
a.cc:34:17: error: 'memset' was not declared in this scope
34 | memset(dp, INF, sizeof(dp));
| ^~~~~~
a.cc:14:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
13 | #include <numeric>
+++ |+#include <cstring>
14 | using namespace std;
|
s942154634 | p00473 | C++ | 在しない数の個数が許容される範囲(空白カードがあれば 1 以下、無ければは 0 以下)に収ま | a.cc:1:56: error: extended character 、 is not valid in an identifier
1 | 在しない数の個数が許容される範囲(空白カードがあれば 1 以下、無ければは 0 以下)に収ま
| ^
a.cc:1:1: error: '\U00005728\U00003057\U0000306a\U00003044\U00006570\U0000306e\U0000500b\U00006570\U0000304c\U00008a31\U00005bb9\U00003055\U0000308c\U0000308b\U00007bc4\U000056f2\U0000ff08\U00007a7a\U0000767d\U000030ab\U000030fc\U000030c9\U0000304c\U00003042\U0000308c\U00003070' does not name a type
1 | 在しない数の個数が許容される範囲(空白カードがあれば 1 以下、無ければは 0 以下)に収ま
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s393844534 | p00473 | C++ | #include<cstdio>
#include<iostream>
#define INF 10000000
using namespace std;
int dp[2][100000][2]={{{0}}};
int main(){
for(int i = 0;i < 2;i++){
for(int j = 0;j < 100000;j++){
dp[i][j][0] = dp[i][j][1] = INF;
}
}
int N;
cin>>N;
int v[100000]={0};
for(int i = 0; i < N - 1;i++){
cin>>v[i+1];
}
v[N-1] = 0;
for(int i = 0;i < N;i++){
for(int j = 0;j < N+1;j++){
for(int k = 0;k < 2;k++){
dp[(i+1)%2][j][k] = INF;
}
}
dp[(i+1)%2][0][1] = v[i];
for(int j = 0;j < N/2;j++){
if(dp[i%2][j][1]!=INF){
dp[(i+1)%2][j+1][0] = min(dp[(i+1)%2][j+1][0],dp[i%2][j][1]+v[i]);
dp[(i+1)%2][j][1] = min(dp[(i+1)%2][j][1],dp[i%2][j][1]-v[i-1]+v[i]);
}
if(dp[i%2][j][0]!=INF){
dp[(i+1)%2][j+1][0] = min(dp[(i+1)%2][j+1][0],dp[i%2][j][0]-v[i-1]+v[i]);
dp[(i+1)%2][j][1] = min(dp[(i+1)%2][j][1],dp[i%2][j][0]+v[i]);
}
}
cout<<dp[0][N/2-1][0]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:40:2: error: expected '}' at end of input
40 | }
| ^
a.cc:7:11: note: to match this '{'
7 | int main(){
| ^
|
s680829453 | p00473 | C++ | #include<cstdio>
using namespace std;
int main(){
const int I=99999999;
int n,c,m;
int p[2][5000+2][2];
for(int i=0;i<2;i++)for(int j=0;j<5002;j++){p[i][j][0]=I; p[i][j][1]=I;}
p[1][1][0]=0;
p[1][0][1]=0;
cin>>n;
for(int i=2;i<=n;i++){
int s=i%2,t=1-s;
cin>>c;
m=min(i,n/2);
for(int j=0;j<=m;j++){
if(j!=0)p[s][j][0]=min(p[t][j-1][0],p[t][j-1][1]+c);
p[s][j][1]=min(p[t][j][0]+c,p[t][j][1]);
}
}
cout<<min(p[0][m][0],p[0][m][1])<<endl;
} | a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
11 | cin>>n;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include<cstdio>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:15:19: error: 'min' was not declared in this scope; did you mean 'main'?
15 | m=min(i,n/2);
| ^~~
| main
a.cc:21:9: error: 'cout' was not declared in this scope
21 | cout<<min(p[0][m][0],p[0][m][1])<<endl;
| ^~~~
a.cc:21:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:15: error: 'min' was not declared in this scope; did you mean 'main'?
21 | cout<<min(p[0][m][0],p[0][m][1])<<endl;
| ^~~
| main
a.cc:21:43: error: 'endl' was not declared in this scope
21 | cout<<min(p[0][m][0],p[0][m][1])<<endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include<cstdio>
+++ |+#include <ostream>
2 | using namespace std;
|
s055089070 | p00473 | C++ | #include<iostream>
using namespace std;
int N;
int time[9999];
int main(){
int i;
cin >> N;
for(i = 0;i < N;i++){
cin >> time[i];
}
int min;
min = time[0]+time[N/2];
for(i = 1;i < N/2-1;i++){
if(min > time[i]+time[i+N/2]){
min = time[i]+time[i+N/2];
}
}
if(min > time[N/2-1])
min = time[N/2-1];
cout << min << endl;
return 0;
} | a.cc:4:14: error: 'int time [9999]' redeclared as different kind of entity
4 | int time[9999];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:9:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
9 | cin >> time[i];
| ^
a.cc:9:5: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
9 | cin >> time[i];
| ~~~ ^~ ~~~~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:14: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
9 | cin >> time[i];
| ~~~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:14: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
9 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:9:14: error: cannot bind rvalue '(short int)(time + ((sizetype)i))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:14: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
9 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:9:14: error: cannot bind rvalue '(short unsigned int)(time + ((sizetype)i))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:14: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
9 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:9:14: error: cannot bind rvalue '(int)(time + ((sizetype)i))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:14: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
9 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:9:14: error: cannot bind rvalue '(unsigned int)(time + ((sizetype)i))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:14: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
9 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:9:14: error: cannot bind rvalue '(long int)(time + ((sizetype)i))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:14: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive]
9 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:9:14: error: cannot bind rvalue '(long unsigned int)(time + ((sizetype)i))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:14: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive]
9 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:9:14: error: cannot bind rvalue '(long long int)(time + ((sizetype)i))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:14: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive]
9 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:9:14: error: cannot bind rvalue '(long long unsigned int)(time + ((sizetype)i))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:14: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
9 | cin >> time[i];
| ~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:9:14: error: cannot bind rvalue '(void*)(time + ((sizetype)i))' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:9:14: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
9 | cin >> time[i];
| ~~~~~~ |
s046120733 | p00473 | C++ |
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define MAXN 10012
#define INF 1e+9
int SwapDim1Array(int **a,int **b);
typedef struct{
int exist;
int none;
} dint;
dint origin[MAXN];
dint buffer[MAXN];
dint *dp = origin;
dint *dpbuf = buffer;
int field[MAXN] = {0};
int length = 0;
int main (void){
scanf("%d",&length);
for(int i=0;i<=length;i++){
dp[i].exist = INF;
dp[i].none = INF;
}
dp[0].none = 0;
for(int i=1;i<length;i++){
scanf("%d",&field[i]);
}
for(int i=0;i<length;i++){ //くばるDP
for(int j=0;j<=i;j++){
dpbuf[j+1].exist = min(min(dp[j].exist + field[i+1] - field[i] , dp[j].none + field[i] + field[i+1]) , dpbuf[j+1].exist);
dpbuf[j].none = min(min(dp[j].exist , dp[j].none) , dpbuf[j].none);
SwapDim1Array(dp,dpbuf);
}
}
int answer = 0;
answer = min(dp[length/2].exist,dp[length/2].none);
printf("%d\n",answer);
/*puts("field");
for(int i=1;i<length;i++){
printf("%d\t",field[i]);
}puts("");
printf("###%d###%d\n",dp[1][1].exist,dp[1][1].none);*/
return 0;
}
int SwapDim1Array(int **a,int **b){
int *c;
c = *a;
*a = *b;
*b = c;
return 0;
} | a.cc: In function 'int main()':
a.cc:40:39: error: cannot convert 'dint*' to 'int**'
40 | SwapDim1Array(dp,dpbuf);
| ^~
| |
| dint*
a.cc:11:25: note: initializing argument 1 of 'int SwapDim1Array(int**, int**)'
11 | int SwapDim1Array(int **a,int **b);
| ~~~~~~^
|
s379814340 | p00473 | C++ |
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define MAXN 10012
#define INF 1e+9
int SwapDim1Array(int **a,int **b);
typedef struct{
int exist;
int none;
} dint;
dint origin[MAXN];
dint buffer[MAXN];
dint *dp = origin;
dint *dpbuf = buffer;
int field[MAXN] = {0};
int length = 0;
int main (void){
scanf("%d",&length);
for(int i=0;i<=length;i++){
dp[i].exist = INF;
dp[i].none = INF;
}
dp[0].none = 0;
for(int i=1;i<length;i++){
scanf("%d",&field[i]);
}
for(int i=0;i<length;i++){ //くばるDP
for(int j=0;j<=i;j++){
dpbuf[j+1].exist = min(min(dp[j].exist + field[i+1] - field[i] , dp[j].none + field[i] + field[i+1]) , dpbuf[j+1].exist);
dpbuf[j].none = min(min(dp[j].exist , dp[j].none) , dpbuf[j].none);
SwapDim1Array(dp,dpbuf);
}
}
int answer = 0;
answer = min(dp[length/2].exist,dp[length/2].none);
printf("%d\n",answer);
/*puts("field");
for(int i=1;i<length;i++){
printf("%d\t",field[i]);
}puts("");
printf("###%d###%d\n",dp[1][1].exist,dp[1][1].none);*/
return 0;
}
int SwapDim1Array(int **a,int **b){
int *c;
c = *a;
*a = *b;
*b = c;
return 0;
} | a.cc: In function 'int main()':
a.cc:40:39: error: cannot convert 'dint*' to 'int**'
40 | SwapDim1Array(dp,dpbuf);
| ^~
| |
| dint*
a.cc:11:25: note: initializing argument 1 of 'int SwapDim1Array(int**, int**)'
11 | int SwapDim1Array(int **a,int **b);
| ~~~~~~^
|
s830897743 | p00473 | C++ |
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define MAXN 10012
#define INF 1e+9
typedef struct{
int exist;
int none;
} dint;
int SwapDim1Array(dint **a,dint **b);
dint origin[MAXN];
dint buffer[MAXN];
dint *dp = origin;
dint *dpbuf = buffer;
int field[MAXN] = {0};
int length = 0;
int main (void){
scanf("%d",&length);
for(int i=0;i<=length;i++){
dp[i].exist = INF;
dp[i].none = INF;
}
dp[0].none = 0;
for(int i=1;i<length;i++){
scanf("%d",&field[i]);
}
for(int i=0;i<length;i++){ //くばるDP
for(int j=0;j<=i;j++){
dpbuf[j] = INF;
}
for(int j=0;j<=i;j++){
dpbuf[j+1].exist = min(min(dp[j].exist + field[i+1] - field[i] , dp[j].none + field[i] + field[i+1]) , dpbuf[j+1].exist);
dpbuf[j].none = min(min(dp[j].exist , dp[j].none) , dpbuf[j].none);
SwapDim1Array(dp,dpbuf);
}
}
int answer = 0;
answer = min(dp[length/2].exist,dp[length/2].none);
printf("%d\n",answer);
return 0;
}
int SwapDim1Array(dint **a,dint **b){
dint *c;
c = *a;
*a = *b;
*b = c;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:13: error: no match for 'operator=' (operand types are 'dint' and 'double')
9 | #define INF 1e+9
| ^~~~
a.cc:38:36: note: in expansion of macro 'INF'
38 | dpbuf[j] = INF;
| ^~~
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(const dint&)'
14 | } dint;
| ^~~~
a.cc:14:3: note: no known conversion for argument 1 from 'double' to 'const dint&'
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(dint&&)'
a.cc:14:3: note: no known conversion for argument 1 from 'double' to 'dint&&'
a.cc:43:39: error: cannot convert 'dint*' to 'dint**'
43 | SwapDim1Array(dp,dpbuf);
| ^~
| |
| dint*
a.cc:15:26: note: initializing argument 1 of 'int SwapDim1Array(dint**, dint**)'
15 | int SwapDim1Array(dint **a,dint **b);
| ~~~~~~~^
|
s309946979 | p00473 | C++ |
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define MAXN 10012
#define INF 1e+9
typedef struct{
int exist;
int none;
} dint;
int SwapDim1Array(dint **a,dint **b);
//dint origin[MAXN];
//dint buffer[MAXN];
dint *dp = origin;
dint *dpbuf = buffer;
dp = (dint *)malloc(sizeof(dint)*MAXN);
dpbuf = (dint *)malloc(sizeof(dint)*MAXN);
int field[MAXN] = {0};
int length = 0;
int main (void){
scanf("%d",&length);
for(int i=0;i<=length;i++){
dp[i].exist = INF;
dp[i].none = INF;
}
dp[0].none = 0;
for(int i=1;i<length;i++){
scanf("%d",&field[i]);
}
for(int i=0;i<length;i++){ //くばるDP
for(int j=0;j<=i;j++){
dpbuf[j] = INF;
}
for(int j=0;j<=i;j++){
dpbuf[j+1].exist = min(min(dp[j].exist + field[i+1] - field[i] , dp[j].none + field[i] + field[i+1]) , dpbuf[j+1].exist);
dpbuf[j].none = min(min(dp[j].exist , dp[j].none) , dpbuf[j].none);
SwapDim1Array(dp,dpbuf);
}
}
int answer = 0;
answer = min(dp[length/2].exist,dp[length/2].none);
printf("%d\n",answer);
return 0;
}
int SwapDim1Array(dint **a,dint **b){
dint *c;
c = *a;
*a = *b;
*b = c;
return 0;
} | a.cc:19:12: error: 'origin' was not declared in this scope
19 | dint *dp = origin;
| ^~~~~~
a.cc:20:15: error: 'buffer' was not declared in this scope; did you mean 'setbuffer'?
20 | dint *dpbuf = buffer;
| ^~~~~~
| setbuffer
a.cc:21:1: error: 'dp' does not name a type
21 | dp = (dint *)malloc(sizeof(dint)*MAXN);
| ^~
a.cc:22:1: error: 'dpbuf' does not name a type
22 | dpbuf = (dint *)malloc(sizeof(dint)*MAXN);
| ^~~~~
a.cc: In function 'int main()':
a.cc:9:13: error: no match for 'operator=' (operand types are 'dint' and 'double')
9 | #define INF 1e+9
| ^~~~
a.cc:40:36: note: in expansion of macro 'INF'
40 | dpbuf[j] = INF;
| ^~~
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(const dint&)'
14 | } dint;
| ^~~~
a.cc:14:3: note: no known conversion for argument 1 from 'double' to 'const dint&'
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(dint&&)'
a.cc:14:3: note: no known conversion for argument 1 from 'double' to 'dint&&'
a.cc:45:39: error: cannot convert 'dint*' to 'dint**'
45 | SwapDim1Array(dp,dpbuf);
| ^~
| |
| dint*
a.cc:15:26: note: initializing argument 1 of 'int SwapDim1Array(dint**, dint**)'
15 | int SwapDim1Array(dint **a,dint **b);
| ~~~~~~~^
|
s415012017 | p00473 | C++ |
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define MAXN 10012
#define INF 1e+9
typedef struct{
int exist;
int none;
} dint;
int SwapDim1Array(dint **a,dint **b);
//dint origin[MAXN];
//dint buffer[MAXN];
dint *dp = origin;
dint *dpbuf = buffer;
dp = (dint *)malloc(sizeof(dint)*MAXN);
dpbuf = (dint *)malloc(sizeof(dint)*MAXN);
int field[MAXN] = {0};
int length = 0;
int main (void){
scanf("%d",&length);
for(int i=0;i<=length;i++){
dp[i].exist = INF;
dp[i].none = INF;
}
dp[0].none = 0;
for(int i=1;i<length;i++){
scanf("%d",&field[i]);
}
for(int i=0;i<length;i++){ //くばるDP
for(int j=0;j<=i;j++){
dpbuf[j] = INF;
}
for(int j=0;j<=i;j++){
dpbuf[j+1].exist = min(min(dp[j].exist + field[i+1] - field[i] , dp[j].none + field[i] + field[i+1]) , dpbuf[j+1].exist);
dpbuf[j].none = min(min(dp[j].exist , dp[j].none) , dpbuf[j].none);
SwapDim1Array(dp,dpbuf);
}
}
int answer = 0;
answer = min(dp[length/2].exist,dp[length/2].none);
printf("%d\n",answer);
return 0;
}
int SwapDim1Array(dint **a,dint **b){
dint *c;
c = *a;
*a = *b;
*b = c;
return 0;
} | a.cc:19:12: error: 'origin' was not declared in this scope
19 | dint *dp = origin;
| ^~~~~~
a.cc:20:15: error: 'buffer' was not declared in this scope; did you mean 'setbuffer'?
20 | dint *dpbuf = buffer;
| ^~~~~~
| setbuffer
a.cc:21:1: error: 'dp' does not name a type
21 | dp = (dint *)malloc(sizeof(dint)*MAXN);
| ^~
a.cc:22:1: error: 'dpbuf' does not name a type
22 | dpbuf = (dint *)malloc(sizeof(dint)*MAXN);
| ^~~~~
a.cc: In function 'int main()':
a.cc:9:13: error: no match for 'operator=' (operand types are 'dint' and 'double')
9 | #define INF 1e+9
| ^~~~
a.cc:40:36: note: in expansion of macro 'INF'
40 | dpbuf[j] = INF;
| ^~~
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(const dint&)'
14 | } dint;
| ^~~~
a.cc:14:3: note: no known conversion for argument 1 from 'double' to 'const dint&'
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(dint&&)'
a.cc:14:3: note: no known conversion for argument 1 from 'double' to 'dint&&'
a.cc:45:39: error: cannot convert 'dint*' to 'dint**'
45 | SwapDim1Array(dp,dpbuf);
| ^~
| |
| dint*
a.cc:15:26: note: initializing argument 1 of 'int SwapDim1Array(dint**, dint**)'
15 | int SwapDim1Array(dint **a,dint **b);
| ~~~~~~~^
|
s848863655 | p00473 | C++ |
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define MAXN 10012
#define INF 1e+9
typedef struct{
int exist;
int none;
} dint;
int SwapDim1Array(dint **a,dint **b);
//dint origin[MAXN];
//dint buffer[MAXN];
dint *dp = origin;
dint *dpbuf = buffer;
dp = (dint *)malloc(sizeof(dint)*MAXN);
dpbuf = (dint *)malloc(sizeof(dint)*MAXN);
int field[MAXN] = {0};
int length = 0;
int main (void){
scanf("%d",&length);
for(int i=0;i<=length;i++){
dp[i].exist = INF;
dp[i].none = INF;
}
dp[0].none = 0;
for(int i=1;i<length;i++){
scanf("%d",&field[i]);
}
for(int i=0;i<length;i++){ //くばるDP
for(int j=0;j<=i;j++){
dpbuf[j] = INF;
}
for(int j=0;j<=i;j++){
dpbuf[j+1].exist = min(min(dp[j].exist + field[i+1] - field[i] , dp[j].none + field[i] + field[i+1]) , dpbuf[j+1].exist);
dpbuf[j].none = min(min(dp[j].exist , dp[j].none) , dpbuf[j].none);
SwapDim1Array(dp,dpbuf);
}
}
int answer = 0;
answer = min(dp[length/2].exist,dp[length/2].none);
printf("%d\n",answer);
return 0;
}
int SwapDim1Array(dint **a,dint **b){
dint *c;
c = *a;
*a = *b;
*b = c;
return 0;
} | a.cc:19:12: error: 'origin' was not declared in this scope
19 | dint *dp = origin;
| ^~~~~~
a.cc:20:15: error: 'buffer' was not declared in this scope; did you mean 'setbuffer'?
20 | dint *dpbuf = buffer;
| ^~~~~~
| setbuffer
a.cc:21:1: error: 'dp' does not name a type
21 | dp = (dint *)malloc(sizeof(dint)*MAXN);
| ^~
a.cc:22:1: error: 'dpbuf' does not name a type
22 | dpbuf = (dint *)malloc(sizeof(dint)*MAXN);
| ^~~~~
a.cc: In function 'int main()':
a.cc:9:13: error: no match for 'operator=' (operand types are 'dint' and 'double')
9 | #define INF 1e+9
| ^~~~
a.cc:40:36: note: in expansion of macro 'INF'
40 | dpbuf[j] = INF;
| ^~~
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(const dint&)'
14 | } dint;
| ^~~~
a.cc:14:3: note: no known conversion for argument 1 from 'double' to 'const dint&'
a.cc:14:3: note: candidate: 'constexpr dint& dint::operator=(dint&&)'
a.cc:14:3: note: no known conversion for argument 1 from 'double' to 'dint&&'
a.cc:45:39: error: cannot convert 'dint*' to 'dint**'
45 | SwapDim1Array(dp,dpbuf);
| ^~
| |
| dint*
a.cc:15:26: note: initializing argument 1 of 'int SwapDim1Array(dint**, dint**)'
15 | int SwapDim1Array(dint **a,dint **b);
| ~~~~~~~^
|
s539142180 | p00473 | C++ |
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define MAXN 10012
#define INF 1e+9
typedef struct{
int exist;
int none;
}dint;
int SwapDim1Array(dint **a,dint **b);
dint origin[MAXN];
dint buffer[MAXN];
dint *dp = origin;
dint *dpbuf = buffer;
int field[MAXN] = {0};
int length = 0;
int main (void){
scanf("%d",&length);
for(int i=0;i<=length;i++){
dp[i].exist = INF;
dp[i].none = INF;
}
dp[0].none = 0;
for(int i=1;i<length;i++){
scanf("%d",&field[i]);
}
for(int i=0;i<length;i++){ //くばるDP
for(int j=0;j<=i;j++){
dpbuf[j].exist = INF;
dpbuf[j].none = INF;
}
for(int j=0;j<=i;j++){
dpbuf[j+1].exist = min(min(dp[j].exist + field[i+1] - field[i] , dp[j].none + field[i] + field[i+1]) , dpbuf[j+1].exist);
dpbuf[j].none = min(min(dp[j].exist , dp[j].none) , dpbuf[j].none);
SwapDim1Array(dp,dpbuf);
}
}
int answer = 0;
answer = min(dp[length/2].exist,dp[length/2].none);
printf("%d\n",answer);
return 0;
}
int SwapDim1Array(dint **a,dint **b){
dint *c;
c = *a;
*a = *b;
*b = c;
return 0;
} | a.cc: In function 'int main()':
a.cc:44:39: error: cannot convert 'dint*' to 'dint**'
44 | SwapDim1Array(dp,dpbuf);
| ^~
| |
| dint*
a.cc:15:26: note: initializing argument 1 of 'int SwapDim1Array(dint**, dint**)'
15 | int SwapDim1Array(dint **a,dint **b);
| ~~~~~~~^
|
s112040291 | p00474 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;
/**
* Icicles
*/
public class Main {
static P0551 main = new P0551();
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()) {
int n = Integer.parseInt(line.substring(0, line.indexOf(' ')));
int l = Integer.parseInt(line.substring(line.indexOf(' ') + 1));
Icicle[] icicles = new Icicle[n + 2];
Queue<Icicle> growths = new PriorityQueue<Icicle>(1,
new Comparator<Icicle>() {
@Override
public int compare(Icicle o1, Icicle o2) {
return o2.length - o1.length;
}
});
// read
icicles[0] = main.new Icicle(0);
for (int i = 1; i < n + 1; i++) {
icicles[i] = main.new Icicle(Integer.parseInt(br.readLine()));
}
icicles[n + 1] = main.new Icicle(0);
// solve
int total = 0;
while (true) {
for (int i = 1; i < n + 1; i++) {
if (!icicles[i].queued
&& icicles[i].length > icicles[i - 1].length
&& icicles[i].length > icicles[i + 1].length) {
icicles[i].queued = true;
growths.offer(icicles[i]);
}
}
if (growths.isEmpty()) {
break;
}
//
int elapse = l - growths.peek().length;
total += elapse;
while (!growths.isEmpty()) {
if (growths.peek().length + elapse == l) {
growths.peek().length = 0;
growths.poll();
} else {
break;
}
}
for (Icicle i : growths) {
i.length += elapse;
}
}
System.out.println(total);
}
}
class Icicle {
int length;
boolean queued = false;
Icicle(int length) {
this.length = length;
}
}
} | Main.java:13: error: cannot find symbol
static P0551 main = new P0551();
^
symbol: class P0551
location: class Main
Main.java:13: error: cannot find symbol
static P0551 main = new P0551();
^
symbol: class P0551
location: class Main
2 errors
|
s060785178 | p00474 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <queue>
#include <stack>
#include <set>
using namespace std;
#define ALL(co) co.begin(), co.end()
#define tpl(...) make_tuple(__VA_ARGS__)
typedef long long LL;
typedef pair<int, int> P; typedef pair<int, P> IP; typedef pair<P, P> PP;
typedef vector<int> Array; typedef vector<vector<int> > Array2;
typedef vector<LL> LArray; typedef vector<P> PArray; typedef vector<string> SArray;
const int INF = 1 << 29;
const LL LINF = 1LL << 60;
inline int getInt() { int itiv; return (cin >> itiv, itiv); }
template <typename T> void readAll(vector<T>& vec) { for (int i = 0, size = vec.size(); i < size; i++) cin >> vec[i]; }
template <typename T, typename U> void readAll(vector<pair<T, U> >& vec) { for (int i = 0, size = vec.size(); i < size; i++) cin >> vec[i].first >> vec[i].second; }
template < typename T > inline string toString( const T &a ){ ostringstream oss; oss << a; return oss.str(); };
inline bool between(int min, int max, int n) { return min <= n && n <= max; }
inline bool inRange(int begin, int end, int n) { return begin <= n && n < end; }
inline bool inRange(int size, int n) { return 0 <= n && n < size; }
int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };
int dr[] = { 0, -1, 0, 1 }, dc[] = { -1, 0, 1, 0 };
int n, l;
vector<int> turara;
vector<int> time;
int dfs(int now)
{
if(time[now] != -1) return time[now];
int ret = 0;
if(turara[now - 1] > turara[now])
{
ret = dfs(now - 1);
}
if(turara[now + 1] > turara[now])
{
ret = max(ret, dfs(now + 1));
}
ret += l - turara[now];
return time[now] = ret;
}
int main(void)
{
ios::sync_with_stdio(false);
while(cin >> n >> l && n)
{
turara.resize(n + 2);
time = Array(n + 2, -1);
time[0] = time[n + 1] = 0;
turara[0] = turara[n + 1] = 0;
for (int i = 0; i < n; i++)
{
cin >> turara[i + 1];
}
int ans = 0;
for (int i = 1; i <= n; i++)
{
ans = max(ans, dfs(i));
}
cout << ans << endl;
}
return 0;
} | a.cc:42:13: error: 'std::vector<int> time' redeclared as different kind of entity
42 | vector<int> time;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int dfs(int)':
a.cc:46:20: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | if(time[now] != -1) return time[now];
| ^
a.cc:46:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
46 | if(time[now] != -1) return time[now];
| ~~~~~~~~~~^~~~~
a.cc:46:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | if(time[now] != -1) return time[now];
| ^
a.cc:46:44: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
46 | if(time[now] != -1) return time[now];
| ^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:59:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | return time[now] = ret;
| ^
a.cc:59:26: error: assignment of read-only location '*(time + ((sizetype)now))'
59 | return time[now] = ret;
| ~~~~~~~~~~^~~~~
a.cc: In function 'int main()':
a.cc:68:22: error: assignment of function 'time_t time(time_t*)'
68 | time = Array(n + 2, -1);
| ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:69:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
69 | time[0] = time[n + 1] = 0;
| ^
a.cc:69:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
69 | time[0] = time[n + 1] = 0;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:69:39: error: assignment of read-only location '*(time + (((sizetype)n) + 1))'
69 | time[0] = time[n + 1] = 0;
| ~~~~~~~~~~~~^~~
|
s687617838 | p00474 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <queue>
#include <stack>
#include <set>
using namespace std;
#define ALL(co) co.begin(), co.end()
#define tpl(...) make_tuple(__VA_ARGS__)
typedef long long LL;
typedef pair<int, int> P; typedef pair<int, P> IP; typedef pair<P, P> PP;
typedef vector<int> Array; typedef vector<vector<int> > Array2;
typedef vector<LL> LArray; typedef vector<P> PArray; typedef vector<string> SArray;
const int INF = 1 << 29;
const LL LINF = 1LL << 60;
inline int getInt() { int itiv; return (cin >> itiv, itiv); }
template <typename T> void readAll(vector<T>& vec) { for (int i = 0, size = vec.size(); i < size; i++) cin >> vec[i]; }
template <typename T, typename U> void readAll(vector<pair<T, U> >& vec) { for (int i = 0, size = vec.size(); i < size; i++) cin >> vec[i].first >> vec[i].second; }
template < typename T > inline string toString( const T &a ){ ostringstream oss; oss << a; return oss.str(); };
inline bool between(int min, int max, int n) { return min <= n && n <= max; }
inline bool inRange(int begin, int end, int n) { return begin <= n && n < end; }
inline bool inRange(int size, int n) { return 0 <= n && n < size; }
int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };
int dr[] = { 0, -1, 0, 1 }, dc[] = { -1, 0, 1, 0 };
int n, l;
vector<int> turara;
vector<int> time;
int dfs(int now)
{
if(time[now] != -1) return time[now];
int ret = 0;
if(turara[now - 1] > turara[now])
{
ret = dfs(now - 1);
}
if(turara[now + 1] > turara[now])
{
ret = max(ret, dfs(now + 1));
}
ret += l - turara[now];
return time[now] = ret;
}
int main(void)
{
ios::sync_with_stdio(false);
while(cin >> n >> l && n)
{
turara.resize(n + 2);
time = Array(n + 2, -1);
time[0] = time[n + 1] = 0;
turara[0] = turara[n + 1] = 0;
for (int i = 0; i < n; i++)
{
cin >> turara[i + 1];
}
int ans = 0;
for (int i = 1; i <= n; i++)
{
ans = max(ans, dfs(i));
}
cout << ans << endl;
}
return 0;
} | a.cc:42:13: error: 'std::vector<int> time' redeclared as different kind of entity
42 | vector<int> time;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int dfs(int)':
a.cc:46:20: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | if(time[now] != -1) return time[now];
| ^
a.cc:46:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
46 | if(time[now] != -1) return time[now];
| ~~~~~~~~~~^~~~~
a.cc:46:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | if(time[now] != -1) return time[now];
| ^
a.cc:46:44: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
46 | if(time[now] != -1) return time[now];
| ^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:59:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | return time[now] = ret;
| ^
a.cc:59:26: error: assignment of read-only location '*(time + ((sizetype)now))'
59 | return time[now] = ret;
| ~~~~~~~~~~^~~~~
a.cc: In function 'int main()':
a.cc:68:22: error: assignment of function 'time_t time(time_t*)'
68 | time = Array(n + 2, -1);
| ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:69:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
69 | time[0] = time[n + 1] = 0;
| ^
a.cc:69:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
69 | time[0] = time[n + 1] = 0;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:69:39: error: assignment of read-only location '*(time + (((sizetype)n) + 1))'
69 | time[0] = time[n + 1] = 0;
| ~~~~~~~~~~~~^~~
|
s210730713 | p00474 | C++ | #include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;
typedef unsigned long ulong;
typedef pair<ulong,int> pli;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define MP(f,s) make_pair(f,s)
priority_queue<pli> p;
ulong t[100000];
int n=0;
int l=0;
ulong g=ULONG_MAX;
bool check(int c){
if(c==0)
return t[c]>t[c+1];
if(c==n-1)
return t[c]>t[c-1];
return t[c]>t[c+1]&&t[c]>t[c-1];
}
int main(){
scanf("%d %d",&n,&l);
REP(i,n)
scanf("%lu",&t[i]);
REP(i,n){
if(check(i))
p.push(MP(g-(l-t[i]),i));
}
pli m;
ulong res=0;
while(!p.empty()){
do{
m=p.top();
p.pop();
t[m.second]=0;
if(m.second>0)
if(check(m.second-1))
p.push(MP(m.first-(l-t[m.second-1]),m.second-1));
if(m.second<n-1)
if(check(m.second+1))
p.push(MP(m.first-(l-t[m.second+1]),m.second+1));
if(p.empty())
break;
}while(m.first == p.top().first);
res+=g-m.first;
g=m.first;
}
printf("%lu\n",res);
} | a.cc:19:9: error: 'ULONG_MAX' was not declared in this scope
19 | ulong g=ULONG_MAX;
| ^~~~~~~~~
a.cc:5:1: note: 'ULONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include <algorithm>
+++ |+#include <climits>
5 |
|
s620133019 | p00474 | C++ | #include<cstdio>
#include<math.h>
#include<algorithm>
#include<string.h>
#include<vector>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int INF=1001001001;
pair<int,int> map[100002];
int time[100002];
int main(){
int N,L;
scanf("%d %d",&N,&L);
rep(i,N){
int a;
scanf("%d",&a);
map[i]=make_pair(a,i);
}
sort(map,map+N,greater<pair<int,int>???>());
int ans=0;
rep(i,N){
int sans=0;
int yokomax=0;
if(map[i].second!=0){yokomax=max(time[map[i].second+1],yokomax);}
if(map[i].second!=N-1){yokomax=max(time[map[i].second-1],yokomax);}
sans=yokomax+L-map[i].first;
time[map[i].second]=sans;
ans=max(ans,sans);
}
printf("%d",ans);
} | a.cc:26:54: warning: trigraph ??> ignored, use -trigraphs to enable [-Wtrigraphs]
26 | sort(map,map+N,greater<pair<int,int>???>());
a.cc: In function 'int main()':
a.cc:26:56: error: template argument 1 is invalid
26 | sort(map,map+N,greater<pair<int,int>???>());
| ^
|
s334157813 | p00474 | C++ | #include<cstdio>
#include<math.h>
#include<algorithm>
#include<string.h>
#include<vector>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int INF=1001001001;
pair<int,int> map[100002];
long long int time[100002];
int main(){
int N,L;
scanf("%d %d",&N,&L);
rep(i,N){
int a;
scanf("%d",&a);
map[i]=make_pair(a,i);
}
sort(map,map+N,greater< pair<int,int> >() );
long long int ans=0;
rep(i,N){
long long int sans=0;
int yokomax=0;
if(map[i].second!=0){yokomax=max(time[map[i].second+1],yokomax);}
if(map[i].second!=N-1){yokomax=max(time[map[i].second-1],yokomax);}
sans=yokomax+L-map[i].first;
time[map[i].second]=sans;
ans=max(ans,sans);
}
printf("%lld\n",ans);
} | a.cc: In function 'int main()':
a.cc:31:57: error: no matching function for call to 'max(long long int&, int&)'
31 | if(map[i].second!=0){yokomax=max(time[map[i].second+1],yokomax);}
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906,
from /usr/include/c++/14/math.h:36,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:31:57: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
31 | if(map[i].second!=0){yokomax=max(time[map[i].second+1],yokomax);}
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:31:57: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
31 | if(map[i].second!=0){yokomax=max(time[map[i].second+1],yokomax);}
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:32:59: error: no matching function for call to 'max(long long int&, int&)'
32 | if(map[i].second!=N-1){yokomax=max(time[map[i].second-1],yokomax);}
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:32:59: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
32 | if(map[i].second!=N-1){yokomax=max(time[map[i].second-1],yokomax);}
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:32:59: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
32 | if(map[i].second!=N-1){yokomax=max(time[map[i].second-1],yokomax);}
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s420230085 | p00474 | C++ | //成長し続けることが目的
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#define N_MAX 100000
#define L_MAX 50000
using namespace std;
typedef int TL;
typedef int num;
typedef pair<TL,num> I;
int N,L;
int Ice[N_MAX+2+1];
int time = 0;
priority_queue<I> que;
void solve(){
for(int i = 1;i <= N;i++){
if(Ice[i] > Ice[i-1] && Ice[i] > Ice[i+1])
que.push(make_pair(-1*(L-Ice[i]),i));
}
while(!que.empty()){
I ic = que.top();que.pop();
time = -1 * ic.first;
int n = ic.second;
Ice[n] = 0;
if(n + 1 <= N && Ice[n+1] > Ice[n+2])
que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
if(n - 1 >= 1 && Ice[n-1] > Ice[n-2])
que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
}
printf("%d\n",time);
return;
}
int main() {
scanf("%d %d",&N,&L);
Ice[0] = 0;Ice[N+1] = 0;
for(int n = 1;n <= N;n++)scanf("%d",&Ice[n]);
solve();
return 0;
} | a.cc:18:5: error: 'int time' redeclared as different kind of entity
18 | int time = 0;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:5:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void solve()':
a.cc:28:22: error: assignment of function 'time_t time(time_t*)'
28 | time = -1 * ic.first;
| ~~~~~^~~~~~~~~~~~~~~
a.cc:32:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~~~~~~~~~^~~~~
a.cc:32:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:34:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~~~~~~~~~^~~~~
a.cc:34:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s875084278 | p00474 | C++ | //成長し続けることが目的
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#define N_MAX 100000
#define L_MAX 50000
using namespace std;
typedef int TL;
typedef int num;
typedef pair<TL,num> I;
int N,L;
int Ice[N_MAX+2+1];
int time = 0;
priority_queue<I> que;
void solve(){
for(int i = 1;i <= N;i++){
if(Ice[i] > Ice[i-1] && Ice[i] > Ice[i+1])
que.push(make_pair(-1*(L-Ice[i]),i));
}
while(!que.empty()){
I ic = que.top();que.pop();
time = -1 * ic.first;
int n = ic.second;
Ice[n] = 0;
if(n + 1 <= N && Ice[n+1] > Ice[n+2])
que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
if(n - 1 >= 1 && Ice[n-1] > Ice[n-2])
que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
}
printf("%d\n",time);
return;
}
int main() {
scanf("%d %d",&N,&L);
Ice[0] = 0;Ice[N+1] = 0;
for(int n = 1;n <= N;n++)scanf("%d",&Ice[n]);
solve();
return 0;
} | a.cc:18:5: error: 'int time' redeclared as different kind of entity
18 | int time = 0;
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:5:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void solve()':
a.cc:28:22: error: assignment of function 'time_t time(time_t*)'
28 | time = -1 * ic.first;
| ~~~~~^~~~~~~~~~~~~~~
a.cc:32:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~~~~~~~~~^~~~~
a.cc:32:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:34:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~~~~~~~~~^~~~~
a.cc:34:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s246943576 | p00474 | C++ | //成長し続けることが目的
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#define N_MAX 100000
#define L_MAX 50000
using namespace std;
typedef int TL;
typedef int num;
typedef pair<TL,num> I;
int N,L;
int Ice[N_MAX+2+1];
int ctime = 0;
priority_queue<I> que;
void solve(){
for(int i = 1;i <= N;i++){
if(Ice[i] > Ice[i-1] && Ice[i] > Ice[i+1])
que.push(make_pair(-1*(L-Ice[i]),i));
}
while(!que.empty()){
I ic = que.top();que.pop();
ctime = -1 * ic.first;
int n = ic.second;
Ice[n] = 0;
if(n + 1 <= N && Ice[n+1] > Ice[n+2])
que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
if(n - 1 >= 1 && Ice[n-1] > Ice[n-2])
que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
}
printf("%d\n",ctime);
return;
}
int main() {
scanf("%d %d",&N,&L);
Ice[0] = 0;Ice[N+1] = 0;
for(int n = 1;n <= N;n++)scanf("%d",&Ice[n]);
solve();
return 0;
} | a.cc:18:5: error: 'int ctime' redeclared as different kind of entity
18 | int ctime = 0;
| ^~~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:5:
/usr/include/time.h:183:14: note: previous declaration 'char* ctime(const time_t*)'
183 | extern char *ctime (const time_t *__timer) __THROW;
| ^~~~~
a.cc: In function 'void solve()':
a.cc:28:23: error: assignment of function 'char* ctime(const time_t*)'
28 | ctime = -1 * ic.first;
| ~~~~~~^~~~~~~~~~~~~~~
a.cc:32:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~~~~~~~~~^~~~~
a.cc:32:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:34:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~~~~~~~~~^~~~~
a.cc:34:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s463603019 | p00474 | C++ | //成長し続けることが目的
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#define N_MAX 100000
#define L_MAX 50000
using namespace std;
typedef int TL;
typedef int num;
typedef pair<TL,num> I;
int N,L;
int Ice[N_MAX+2+1];
int ct = 0;
priority_queue<I> que;
void solve(){
for(int i = 1;i <= N;i++){
if(Ice[i] > Ice[i-1] && Ice[i] > Ice[i+1])
que.push(make_pair(-1*(L-Ice[i]),i));
}
while(!que.empty()){
I ic = que.top();que.pop();
ct = -1 * ic.first;
int n = ic.second;
Ice[n] = 0;
if(n + 1 <= N && Ice[n+1] > Ice[n+2])
que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
if(n - 1 >= 1 && Ice[n-1] > Ice[n-2])
que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
}
printf("%d\n",ct);
return;
}
int main() {
scanf("%d %d",&N,&L);
Ice[0] = 0;Ice[N+1] = 0;
for(int n = 1;n <= N;n++)scanf("%d",&Ice[n]);
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:32:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~~~~~~~~~^~~~~
a.cc:32:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:34:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~~~~~~~~~^~~~~
a.cc:34:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s622398078 | p00474 | C++ | //成長し続けることが目的
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#define N_MAX 100000
#define L_MAX 50000
using namespace std;
typedef int TL;
typedef int num;
typedef pair<TL,num> I;
int N,L;
int Ice[N_MAX+2+1];
int ct = 0;
priority_queue<I> que;
void solve(){
for(int i = 1;i <= N;i++){
if(Ice[i] > Ice[i-1] && Ice[i] > Ice[i+1])
que.push(make_pair(-1*(L-Ice[i]),i));
}
while(!que.empty()){
I ic = que.top();que.pop();
ct = -1 * ic.first;
int n = ic.second;
Ice[n] = 0;
if(n + 1 <= N && Ice[n+1] > Ice[n+2])
que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
if(n - 1 >= 1 && Ice[n-1] > Ice[n-2])
que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
}
cout <<ct <endl;
return;
}
int main() {
scanf("%d %d",&N,&L);
Ice[0] = 0;Ice[N+1] = 0;
for(int n = 1;n <= N;n++)scanf("%d",&Ice[n]);
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:32:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~~~~~~~~~^~~~~
a.cc:32:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:34:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~~~~~~~~~^~~~~
a.cc:34:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:36:19: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
36 | cout <<ct <endl;
| ~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906,
from a.cc:2:
/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:
a.cc:36:20: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
36 | cout <<ct <endl;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
a.cc:36:20: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
36 | cout <<ct <endl;
| ^~~~
/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:
a.cc:36:20: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
36 | cout <<ct <endl;
| ^~~~
/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:
a.cc:36:20: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
36 | cout <<ct <endl;
| ^~~~
/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:
a.cc:36:20: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
36 | cout <<ct <endl;
| ^~~~
In file included from /usr/include/c++/14/vector:66,
from a.cc:4:
/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:
a.cc:36:20: note: 'std::basic_ostream<char>' is not derived from 'const std::vector<_Tp, _Alloc>'
36 | cout <<ct <endl;
| ^~~~
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:
a.cc:36:20: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>'
36 | cout <<ct <endl;
| ^~~~
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:5:
/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:
a.cc:36:20: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
36 | cout <<ct <endl;
| ^~~~
/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:
a.cc:36:20: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
36 | cout <<ct <endl;
| ^~~~
/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:
a.cc:36:20: note: couldn't deduce template parameter '_CharT'
36 | cout <<ct <endl;
| ^~~~
/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:
a.cc:36:20: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
36 | cout <<ct <endl;
| ^~~~
/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:
a.cc:36:20: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
36 | cout <<ct <endl;
| ^~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3901 | operator<(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed:
a.cc:36:20: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>'
36 | cout <<ct <endl;
| ^~~~
In file included from /usr/include/c++/14/deque:66,
from /usr/include/c++/14/queue:62,
from a.cc:7:
/usr/include/c++/14/bits/stl_deque.h:2334:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2334 | op |
s904400749 | p00474 | C++ | //成長し続けることが目的
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#define N_MAX 100000
#define L_MAX 50000
using namespace std;
typedef int TL;
typedef int num;
typedef pair<TL,num> I;
int N,L;
int Ice[N_MAX+2+1];
int ct = 0;
priority_queue<I> que;
void solve(){
for(int i = 1;i <= N;i++){
if(Ice[i] > Ice[i-1] && Ice[i] > Ice[i+1])
que.push(make_pair(-1*(L-Ice[i]),i));
}
while(!que.empty()){
I ic = que.top();que.pop();
ct = -1 * ic.first;
int n = ic.second;
Ice[n] = 0;
if(n + 1 <= N && Ice[n+1] > Ice[n+2])
que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
if(n - 1 >= 1 && Ice[n-1] > Ice[n-2])
que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
}
return;
}
int main() {
scanf("%d %d",&N,&L);
Ice[0] = 0;Ice[N+1] = 0;
for(int n = 1;n <= N;n++)scanf("%d",&Ice[n]);
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:32:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~~~~~~~~~^~~~~
a.cc:32:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
32 | que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:34:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~~~~~~~~~^~~~~
a.cc:34:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
34 | que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
| ~~^~~~~~~~~~~~~~~~~~
| | |
| int time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s914210041 | p00474 | C++ | #include<bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i <= (int)n; ++i)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define MP make_pair
#define PB push_back
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define int long long
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef vector<int> VLL;
typedef vector<int> VVLL;
typedef unsigned int uint;
typedef priority_queue<int> maxque;
typedef priority_queue< int, vector<int>, greater<int> > minque;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const int LL_INF = 1ll << 60;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };
int s[100010];
signed main(){
int n,m;
int time=0;
cin>>n>>m;
FOR(i,1,n){
cin>>s[i];
}
int t=0;
int q=0;
FOR(i,1,n){
if(s[i]>s[i-1]&&s[i]>s[i+1]){
if(t<s[i]){
if(t!=0)s[i]+=(m-t);
if(m>=s[i]){
time+=(m-s[i]);
t=s[i];
}
else {
q=(s[i]-m);
cout<<q<<endl;
if(s[i-1]!=0)s[i-1]+=q;
}
}
s[i]=0;
}
}
int p=LL_INF;
FOR(i,1,n){
if(s[i])time+=m-s[i];
}
if(p!=LL_INF)time+=(m-p);
cout<<time<<endl;
return 0;
} | a.cc:23:22: error: conflicting declaration 'typedef long long unsigned int uint'
23 | typedef unsigned int uint;
| ^~~~
In file included from /usr/include/stdlib.h:514,
from /usr/include/c++/14/cstdlib:79,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
from a.cc:1:
/usr/include/x86_64-linux-gnu/sys/types.h:150:22: note: previous declaration as 'typedef unsigned int uint'
150 | typedef unsigned int uint;
| ^~~~
|
s251493381 | p00474 | C++ | #include<bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i <= (int)n; ++i)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define MP make_pair
#define PB push_back
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define int long long
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef vector<int> VLL;
typedef vector<int> VVLL;
typedef unsigned int uint;
typedef priority_queue<int> maxque;
typedef priority_queue< int, vector<int>, greater<int> > minque;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const int LL_INF = 1ll << 60;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };
int s[100010];
signed main(){
int n,m;
int time=0;
cin>>n>>m;
FOR(i,1,n){
cin>>s[i];
}
int t=0;
int q=0;
FOR(i,1,n){
if(s[i]>s[i-1]&&s[i]>s[i+1]){
if(t<s[i]){
if(t!=0)s[i]+=(m-t);
if(m>=s[i]){
time+=(m-s[i]);
t=s[i];
}
else {
q=(s[i]-m);
cout<<q<<endl;
if(s[i-1]!=0)s[i-1]+=q;
}
}
s[i]=0;
}
}
int p=LL_INF;
FOR(i,1,n){
if(s[i])time+=m-s[i];
}
if(p!=LL_INF)time+=(m-p);
cout<<time<<endl;
return 0;
} | a.cc:23:22: error: conflicting declaration 'typedef long long unsigned int uint'
23 | typedef unsigned int uint;
| ^~~~
In file included from /usr/include/stdlib.h:514,
from /usr/include/c++/14/cstdlib:79,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
from a.cc:1:
/usr/include/x86_64-linux-gnu/sys/types.h:150:22: note: previous declaration as 'typedef unsigned int uint'
150 | typedef unsigned int uint;
| ^~~~
|
s731124011 | p00474 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int N, L, a[100000], X, time = 0, pluser = 1000000, longs[30000];
int main()
{
cin >> N >> L;
for (int i = 0; i < N; i++)
{
cin >> a[i];
}
for (int fin = 0; fin != 1;)
{
fin = 1;
pluser = 60000;
X = 0;
if (a[0] > a[1])
{
pluser = min(pluser, L - a[0]);
longs[X] = 0;
X++;
}
for (int i = 1; i < N - 1; i++)
{
if (a[i] > a[i - 1] && a[i] > a[i + 1])
{
pluser = min(pluser, L - a[i]);
longs[X] = i;
X++;
}
}
if (a[N - 1] > a[N - 2])
{
pluser = min(pluser, L - a[N - 1]);
longs[X] = N - 1;
X++;
}
time += pluser;
for (int i = 0; i < X; i++)
{
if (a[longs[i]] == L - pluser)
{
a[longs[i]] = 0;
}
else if (a[longs[i]] != 0)
{
a[longs[i]] += pluser;
}
}
for (int i = 0; i < N; i++)
{
if (a[i] != 0)
{
fin = 0;
break;
}
}
}
cout << time << endl;
return 0;
} | a.cc:6:25: error: 'int time' redeclared as different kind of entity
6 | int N, L, a[100000], X, time = 0, pluser = 1000000, longs[30000];
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:44:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
44 | time += pluser;
| ~~~~~^~~~~~~~~
a.cc:44:22: error: assignment of read-only location 'time'
|
s461488767 | p00474 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int N, L, a[100000], X, time = 0, pluser = 1000000, longs[30000];
int main()
{
cin >> N >> L;
for (int i = 0; i < N; i++)
{
cin >> a[i];
}
for (int fin = 0; fin != 1;)
{
fin = 1;
pluser = 60000;
X = 0;
if (a[0] > a[1])
{
pluser = min(pluser, L - a[0]);
longs[X] = 0;
X++;
}
for (int i = 1; i < N - 1; i++)
{
if (a[i] > a[i - 1])
{
if(a[i] > a[i + 1])
{
pluser = min(pluser, L - a[i]);
longs[X] = i;
X++;
}
}
}
if (a[N - 1] > a[N - 2])
{
pluser = min(pluser, L - a[N - 1]);
longs[X] = N - 1;
X++;
}
time += pluser;
for (int i = 0; i < X; i++)
{
if (a[longs[i]] == L - pluser)
{
a[longs[i]] = 0;
}
else if (a[longs[i]] != 0)
{
a[longs[i]] += pluser;
}
}
for (int i = 0; i < N; i++)
{
if (a[i] != 0)
{
fin = 0;
break;
}
}
}
cout << time << endl;
return 0;
} | a.cc:6:25: error: 'int time' redeclared as different kind of entity
6 | int N, L, a[100000], X, time = 0, pluser = 1000000, longs[30000];
| ^~~~
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:47:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
47 | time += pluser;
| ~~~~~^~~~~~~~~
a.cc:47:22: error: assignment of read-only location 'time'
|
s150258203 | p00474 | C++ | #include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 101010
using namespace std;
int a[MAX],dp[MAX];
void solve(){
int n,l;
cin>>n>>l;
a[0]=a[n+1]=0;
FOR(i,n) cin>>a[i+1];
ZERO(dp);
int ma=0;
FOR(i,n) ma=max(ma,dfs(i+1));
cout<<ma<<endl;
}
int dfs(int now){
if(dp[now]) return dp[now];
if(a[now]>a[now-1]&&a[now]>a[now+1]) return dp[now]=l-a[now];
int ma=0;
if(a[now]<=a[now-1]) ma=dfs(now-1);
if(a[now]<=a[now+1]) ma=max(ma,dfs(now+1));
return dp[now]=ma+l-dp[now];
}
int main(){
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:24:21: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
24 | FOR(i,n) ma=max(ma,dfs(i+1));
| ^~~
| ffs
a.cc: In function 'int dfs(int)':
a.cc:30:54: error: 'l' was not declared in this scope
30 | if(a[now]>a[now-1]&&a[now]>a[now+1]) return dp[now]=l-a[now];
| ^
a.cc:34:20: error: 'l' was not declared in this scope
34 | return dp[now]=ma+l-dp[now];
| ^
|
s482514850 | p00474 | C++ | #include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 101010
using namespace std;
int n,l,a[MAX],dp[MAX];
void solve(){
cin>>n>>l;
a[0]=a[n+1]=0;
FOR(i,n) cin>>a[i+1];
ZERO(dp);
int ma=0;
FOR(i,n) ma=max(ma,dfs(i+1));
cout<<ma<<endl;
}
int dfs(int now){
if(dp[now]) return dp[now];
if(a[now]>a[now-1]&&a[now]>a[now+1]) return dp[now]=l-a[now];
int ma=0;
if(a[now]<=a[now-1]) ma=dfs(now-1);
if(a[now]<=a[now+1]) ma=max(ma,dfs(now+1));
return dp[now]=ma+l-dp[now];
}
int main(){
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:23:21: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
23 | FOR(i,n) ma=max(ma,dfs(i+1));
| ^~~
| ffs
|
s188011258 | p00474 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int n, l, icicles[100001], time1, time2, loop, ans = 0;
int main(){
cin >> n >> l;
for(int i = 1; i <= n; i++){
cin >> icicles[i];
}
for(int i = 1; i <= n; i++){
if(icicles[i] > icicles[i - 1] && icicles[i] > icicles[i + 1]){
time1 = l - icicles[i];
time2 = l - icicles[i];
roop = i;
while(icicles[loop] > icicles[--loop] && roop > 0){
time1 += l - icicles[loop];
}
ans = max(ans, time1);
roop = i;
while(icicles[loop] > icicles[++loop] && roop <= n){
time2 += l - icicles[loop];
}
ans = max(ans, time2);
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:25: error: 'roop' was not declared in this scope; did you mean 'loop'?
17 | roop = i;
| ^~~~
| loop
|
s320513914 | p00474 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int n, l, icicles[100001], time1, time2, loop, ans = 0;
int main(){
cin >> n >> l;
for(int i = 1; i <= n; i++){
cin >> icicles[i];
}
for(int i = 1; i <= n; i++){
if(icicles[i] > icicles[i - 1] && icicles[i] > icicles[i + 1]){
time1 = l - icicles[i];
time2 = l - icicles[i];
loop = i;
while(icicles[loop] > icicles[--loop] && roop > 0){
time1 += l - icicles[loop];
}
ans = max(ans, time1);
roop = i;
while(icicles[loop] > icicles[++loop] && roop <= n){
time2 += l - icicles[loop];
}
ans = max(ans, time2);
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:18:66: error: 'roop' was not declared in this scope; did you mean 'loop'?
18 | while(icicles[loop] > icicles[--loop] && roop > 0){
| ^~~~
| loop
a.cc:23:25: error: 'roop' was not declared in this scope; did you mean 'loop'?
23 | roop = i;
| ^~~~
| loop
|
s871570263 | p00474 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int n, l, icicles[100001], time1, time2, loop, ans = 0;
int main(){
cin >> n >> l;
for(int i = 1; i <= n; i++){
cin >> icicles[i];
}
for(int i = 1; i <= n; i++){
if(icicles[i] > icicles[i - 1] && icicles[i] > icicles[i + 1]){
time1 = l - icicles[i];
time2 = l - icicles[i];
loop = i;
while(icicles[loop] > icicles[--loop] && loop > 0){
time1 += l - icicles[loop];
}
ans = max(ans, time1);
roop = i;
while(icicles[loop] > icicles[++loop] && loop <= n){
time2 += l - icicles[loop];
}
ans = max(ans, time2);
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:25: error: 'roop' was not declared in this scope; did you mean 'loop'?
23 | roop = i;
| ^~~~
| loop
|
s223399187 | p00474 | C++ |
#include <bits/stdc++.h>
using namespace std;
typedef long long int;
int n,l;
int a[123456];
typedef pair<int,int> P;//first:time second:index
signed main()
{
priority_queue<P,vector<P>,greater<P> >que;
cin >> n >> l;
a[0] = a[n+1] = 0;
for(int i = 0;i < n;++i)
{
cin >> a[i + 1];
}
for(int i = 1;i <= n;++i)
{
if(a[i] > a[i - 1] && a[i] > a[i + 1])
{
que.push(make_pair(l - a[i],i));
}
}
int ans = 0;
while(!que.empty())
{
P p = que.top();que.pop();
int time = p.first;
int index = p.second;
ans = time;
a[index] = 0;
for(int i = index - 1;i <= index + 1;i += 2)
{
if(i == 0 || i == n)continue;
if(a[i] > a[i - 1] && a[i] > a[i + 1])
{
que.push(make_pair(l - a[i] + time,i));
}
}
}
cout << ans << endl;
return 0;
} | a.cc:4:19: error: declaration does not declare anything [-fpermissive]
4 | typedef long long int;
| ^~~
|
s145831123 | p00474 | C++ |
#include <bits/stdc++.h>
using namespace std;
typedef long long Int;
typedef Int int;
int n,l;
int a[123456];
typedef pair<int,int> P;//first:time second:index
signed main()
{
priority_queue<P,vector<P>,greater<P> >que;
cin >> n >> l;
a[0] = a[n+1] = 0;
for(int i = 0;i < n;++i)
{
cin >> a[i + 1];
}
for(int i = 1;i <= n;++i)
{
if(a[i] > a[i - 1] && a[i] > a[i + 1])
{
que.push(make_pair(l - a[i],i));
}
}
int ans = 0;
while(!que.empty())
{
P p = que.top();que.pop();
int time = p.first;
int index = p.second;
ans = time;
a[index] = 0;
for(int i = index - 1;i <= index + 1;i += 2)
{
if(i == 0 || i == n)continue;
if(a[i] > a[i - 1] && a[i] > a[i + 1])
{
que.push(make_pair(l - a[i] + time,i));
}
}
}
cout << ans << endl;
return 0;
} | a.cc:5:9: error: multiple types in one declaration
5 | typedef Int int;
| ^~~
a.cc:5:13: error: declaration does not declare anything [-fpermissive]
5 | typedef Int int;
| ^~~
|
s297536656 | p00474 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main(){
int n.l;
cin>>n>>l;
int icic[114514];
icic[0]=0;
icic[1]=0;
for(int i=0;i<n;i++)cin>>icic[i+2];
icic[n+2]=0;
icic[n+3]=0;
int t=0;
priority_queue<P>Q;
for(int i=1;i<=n;i++){
if(icic[i]>icic[i-1]&&icic[i]>icic[i+1]){
Q.push(P(icic[i],i));
}
}
while(Q.size()){
P p=Q.front();
Q.pop();
if(p.first==0)continue;
if(p.first+t<l){
t+=(l-p.first-t);
}
if(icic[p.second-2]<icic[p.second-1])Q.push(P(icic[p.second-1],p.second-1));
if(icic[p.second+2]<icic[p.second+1])Q.push(P(icic[p.second+1],p.second+1));
}
cout<<t<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:14: error: expected initializer before '.' token
6 | int n.l;
| ^
a.cc:7:14: error: 'n' was not declared in this scope; did you mean 'yn'?
7 | cin>>n>>l;
| ^
| yn
a.cc:7:17: error: 'l' was not declared in this scope
7 | cin>>n>>l;
| ^
a.cc:24:31: error: 'class std::priority_queue<std::pair<int, int> >' has no member named 'front'
24 | P p=Q.front();
| ^~~~~
|
s079264119 | p00474 | C++ | # include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>
# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)
using namespace std; | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s969278543 | p00474 | C++ | # include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>
# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)
using namespace std; | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s904616115 | p00474 | C++ | #include <stdio.h>
#include<iostream>
using namespace std;
#include <stack>
int main()
{
int k,n,o,r,i[100002]={ 0 },t=0,s;
stack<int> up;
scanf("%d%d",&k,&o);
r=k;
for(n=1;n<=k;n++){
scanf("%d",&i[n]);
}
for(t=1;;t++)
{
for(n=1;n<=k;n++)
{
if(i[n]>i[n-1]&&i[n]>i[n+1])
{
up.push(n);
}
}
while(!up.empty())
{
s=up.top();
up.pop();
i[s]+=1;
if(i[s]==o)
{
i[s]=0;
r-=1;
}
}
if(r==0)
{
break;
}
}
printf("%d\n",t);
return 0; | a.cc: In function 'int main()':
a.cc:40:18: error: expected '}' at end of input
40 | return 0;
| ^
a.cc:6:1: note: to match this '{'
6 | {
| ^
|
s978642549 | p00474 | C++ |
void maxi(T& x, T y){
if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
if(x > y) x = y;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const LL MOD = 1e9+7;
int main(){
cin.tie(0);
ios_base::sync_with_stdio(false);
LL N, L;
cin >> N >> L;
vector<PLL> xs(N);
REP(i,N){
cin >> xs[i].FF;
xs[i].SS = i;
}
RSORT(xs);
VL ts(N);
REP(i,N){
int ix = xs[i].SS;
ts[ix] = max((ix>0?ts[ix-1]:0ll), (ix+1<N?ts[ix+1]:0ll)) + L - xs[i].FF;
}
cout << *max_element(ALL(ts)) << endl;
return 0;
} | a.cc:2:6: error: variable or field 'maxi' declared void
2 | void maxi(T& x, T y){
| ^~~~
a.cc:2:11: error: 'T' was not declared in this scope
2 | void maxi(T& x, T y){
| ^
a.cc:2:14: error: 'x' was not declared in this scope
2 | void maxi(T& x, T y){
| ^
a.cc:2:17: error: 'T' was not declared in this scope
2 | void maxi(T& x, T y){
| ^
a.cc:12:20: error: 'acos' was not declared in this scope
12 | const double PI = acos(-1.0);
| ^~~~
a.cc:13:7: error: 'LL' does not name a type
13 | const LL MOD = 1e9+7;
| ^~
a.cc: In function 'int main()':
a.cc:16:3: error: 'cin' was not declared in this scope
16 | cin.tie(0);
| ^~~
a.cc:17:3: error: 'ios_base' has not been declared
17 | ios_base::sync_with_stdio(false);
| ^~~~~~~~
a.cc:19:3: error: 'LL' was not declared in this scope
19 | LL N, L;
| ^~
a.cc:20:10: error: 'N' was not declared in this scope
20 | cin >> N >> L;
| ^
a.cc:20:15: error: 'L' was not declared in this scope
20 | cin >> N >> L;
| ^
a.cc:22:3: error: 'vector' was not declared in this scope
22 | vector<PLL> xs(N);
| ^~~~~~
a.cc:22:10: error: 'PLL' was not declared in this scope
22 | vector<PLL> xs(N);
| ^~~
a.cc:22:15: error: 'xs' was not declared in this scope
22 | vector<PLL> xs(N);
| ^~
a.cc:23:7: error: 'i' was not declared in this scope
23 | REP(i,N){
| ^
a.cc:23:3: error: 'REP' was not declared in this scope
23 | REP(i,N){
| ^~~
a.cc:27:3: error: 'RSORT' was not declared in this scope
27 | RSORT(xs);
| ^~~~~
a.cc:29:3: error: 'VL' was not declared in this scope
29 | VL ts(N);
| ^~
a.cc:34:3: error: 'cout' was not declared in this scope
34 | cout << *max_element(ALL(ts)) << endl;
| ^~~~
a.cc:34:28: error: 'ts' was not declared in this scope
34 | cout << *max_element(ALL(ts)) << endl;
| ^~
a.cc:34:24: error: 'ALL' was not declared in this scope
34 | cout << *max_element(ALL(ts)) << endl;
| ^~~
a.cc:34:12: error: 'max_element' was not declared in this scope
34 | cout << *max_element(ALL(ts)) << endl;
| ^~~~~~~~~~~
a.cc:34:36: error: 'endl' was not declared in this scope
34 | cout << *max_element(ALL(ts)) << endl;
| ^~~~
|
s041592180 | p00474 | C++ | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, -1, sizeof(mat))
typedef long long ll;
int a[100005];
int t[100005];
int N, L;
int dfs(int x) {
if(t[x] != -1) return t[x];
if(x == 0) {
if(a[x] > a[x+1]) {
return t[x] = L - a[x];
} else {
return t[x] = L - a[x] + dfs(x+1);
}
} else if(x == N - 1) {
if(a[x] > a[x-1]) {
return t[x] = L - a[x];
} else {
return t[x] = L - a[x] + dfs(x-1);
}
} else {
if(a[x] > a[x-1] && a[x] > a[x+1]) {
return t[x] = L - a[x];
} else if(a[x] > a[x-1]){
return t[x] = L - a[x] + dfs(x+1);
} else if(a[x] > a[x+1]) {
return t[x] = L - a[x] + dfs(x-1);
} else {
return t[x] = L - a[x] + dfs(a[x-1] < a[x+1] ? x - 1 : x + 1);
}
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N >> L;
CLR(t);
FOR(i,0,N) cin >> a[i];
FOR(i,0,N) {
if(t[i] == -1) {
t[i] = dfs(i);
}
cout << t[i] << endl;
}
ll ans = 0;
FOR(i,0,N) ans = max(ans, t[i]);
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:64:23: error: no matching function for call to 'max(ll&, int&)'
64 | FOR(i,0,N) ans = max(ans, t[i]);
| ~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:64:23: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
64 | FOR(i,0,N) ans = max(ans, t[i]);
| ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:64:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
64 | FOR(i,0,N) ans = max(ans, t[i]);
| ~~~^~~~~~~~~~~
|
s225690772 | p00474 | C++ | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
| |
s728033968 | p00474 | C++ | a
| a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s448780420 | p00474 | C++ | #include <iostream>
#include <algorithm>
#include <queue>
#include <cassert>
using namespace std;
#define INF (1<<29)
int time[100002];
int data[100002];
int main(){
for(int i = 0 ; i < 100002 ; i++)
time[i] = -1;
int n,L;
cin >> n >> L;
time[0] = time[n+1] = data[n+1] = data[0] = 0 ;
priority_queue< pair<int,int> > Q;
for(int i = 1 ; i <= n ; i++){
cin >> data[i];
Q.push(make_pair(data[i],i));
}
int s = 0;
while(Q.size()){
int len = Q.top().first , index = Q.top().second ; Q.pop();
if( data[index-1] < data[index] && data[index+1] < data[index]){
len = min(L , len+s);
}else if(~time[index-1] && ~time[index+1]){
len = min(L , (s-max(time[index+1],time[index-1]) + len) );
}else if(~time[index-1]){
len = min(L , (s-time[index-1]) + len);
}else if(~time[index+1]){
len = min(L , (s-time[index+1]) + len);
}else{
assert(0);
}
int usetime = L - len;
s += usetime;
time[index] = s;
}
cout << s << endl;
} | a.cc:8:16: error: 'int time [100002]' redeclared as different kind of entity
8 | int time[100002];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:14:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
14 | time[i] = -1;
| ^
a.cc:14:25: error: assignment of read-only location '*(time + ((sizetype)i))'
14 | time[i] = -1;
| ~~~~~~~~^~~~
a.cc:18:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
18 | time[0] = time[n+1] = data[n+1] = data[0] = 0 ;
| ^
a.cc:18:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
18 | time[0] = time[n+1] = data[n+1] = data[0] = 0 ;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:18:31: error: reference to 'data' is ambiguous
18 | time[0] = time[n+1] = data[n+1] = data[0] = 0 ;
| ^~~~
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:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [100002]'
9 | int data[100002];
| ^~~~
a.cc:18:43: error: reference to 'data' is ambiguous
18 | time[0] = time[n+1] = data[n+1] = data[0] = 0 ;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [100002]'
9 | int data[100002];
| ^~~~
a.cc:22:24: error: reference to 'data' is ambiguous
22 | cin >> data[i];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [100002]'
9 | int data[100002];
| ^~~~
a.cc:23:34: error: reference to 'data' is ambiguous
23 | Q.push(make_pair(data[i],i));
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [100002]'
9 | int data[100002];
| ^~~~
a.cc:29:21: error: reference to 'data' is ambiguous
29 | if( data[index-1] < data[index] && data[index+1] < data[index]){
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [100002]'
9 | int data[100002];
| ^~~~
a.cc:29:37: error: reference to 'data' is ambiguous
29 | if( data[index-1] < data[index] && data[index+1] < data[index]){
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [100002]'
9 | int data[100002];
| ^~~~
a.cc:29:52: error: reference to 'data' is ambiguous
29 | if( data[index-1] < data[index] && data[index+1] < data[index]){
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [100002]'
9 | int data[100002];
| ^~~~
a.cc:29:68: error: reference to 'data' is ambiguous
29 | if( data[index-1] < data[index] && data[ |
s111947290 | p00474 | C++ | #include <iostream>
#include <map>
using namespace std;
int main(){
int n,l,*ice,buf,h=0,sz;
queue<int> q;
cin >> n >> l;
ice = new int[n+2];
ice[0] = ice[n+1] = 0;
for(int i = 1; i < n+1; i++){
cin >> ice[i];
}
for(int i = 1; i < n+1; i++){
if(ice[i]){
if((ice[i] > ice[i-1]) && (ice[i] > ice[i+1])){
q.push(i);
}
}
}
while(1){
sz = q.size();
for(int i = 0; i < sz; i++){
buf = q.front();
q.pop();
ice[buf]++;
if(ice[buf] == l){
ice[buf] = 0;
if(ice[buf-1] > ice[buf-2]){
q.push(buf-1);
}
if(ice[buf+1] > ice[buf+2]){
q.push(buf+1);
}
}else{
q.push(buf);
}
}
h++;
if(q.empty()){
break;
}
}
cout << h << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:9: error: 'queue' was not declared in this scope
7 | queue<int> q;
| ^~~~~
a.cc:3:1: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
2 | #include <map>
+++ |+#include <queue>
3 | using namespace std;
a.cc:7:15: error: expected primary-expression before 'int'
7 | queue<int> q;
| ^~~
a.cc:20:33: error: 'q' was not declared in this scope
20 | q.push(i);
| ^
a.cc:26:22: error: 'q' was not declared in this scope
26 | sz = q.size();
| ^
|
s152139188 | p00474 | C++ | #include <iostream>
#include <queue>
#include <utility>
using namespace std;
int main(){
int n,l,,buf,pa,h=0,sz,ice[100002];
queue<pair<int, int> > q;
priority_queue<pair<int, int> > bufq;
cin >> n >> l;
//ice = new int[n+2];
ice[0] = ice[n+1] = 0;
for(int i = 1; i < n+1; i++){
cin >> ice[i];
}
for(int i = 1; i < n+1; i++){
if(ice[i]){
if((ice[i] > ice[i-1]) && (ice[i] > ice[i+1])){
bufq.push(make_pair(ice[i], i));
}
}
}
while(1){
sz = bufq.size();
for(int i = 0; i < sz; i++){
q.push(bufq.top());
bufq.pop();
}
pa = l - q.front().first;
sz = q.size();
for(int i = 0; i < sz; i++){
buf = q.front().second;
q.pop();
ice[buf] += pa;
if(ice[buf] >= l){
ice[buf] = 0;
if(ice[buf-1] > ice[buf-2]){
bufq.push(make_pair(ice[buf-1], buf-1));
}
if(ice[buf+1] > ice[buf+2]){
bufq.push(make_pair(ice[buf+1], buf+1));
}
}else{
bufq.push(make_pair(ice[buf], buf));
}
}
h += pa;
if(bufq.empty()){
break;
}
}
cout << h << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:17: error: expected unqualified-id before ',' token
7 | int n,l,,buf,pa,h=0,sz,ice[100002];
| ^
|
s285728062 | p00474 | C++ | #include <cstdio>
#include <utility>
#include <queue>
using namespace std;
int i,n,L,t,tr[100002],s;
int main(){
typedef pair<int,int>pii;
priority_queue<pii> qu;
pii p;
for(scanf("%d%d",&n,&L);i++<n;)scanf("%d",tr+i);
for(;--i;)
tr[i]>tr[i-1]&tr[i]>tr[i+1]?
qu.push(pii(tr[i]-L,i)),
tr[i]=L:0;
for(;!qu.empty(); n&&n!=L&u>tr[s+2])?
qu.push(pii(t-L+n,s+1)),
tr[s+1]=L
:0)
p=qu.top(),
qu.pop(),
t=p.first,
tr[s=p.second]=0,
n=tr[s-1],
n&&n!=L&n>tr[s-2]?
qu.push(pii(t-L+n,s-1)),
tr[s-1]=L
:0,
n=tr[s+1];
printf("%d\n",-t);
} | a.cc: In function 'int main()':
a.cc:18:49: error: 'u' was not declared in this scope
18 | for(;!qu.empty(); n&&n!=L&u>tr[s+2])?
| ^
a.cc:18:59: error: expected primary-expression before '?' token
18 | for(;!qu.empty(); n&&n!=L&u>tr[s+2])?
| ^
|
s394629381 | p00474 | C++ | #include <cstdio>
#include <utility>
#include <queue>
using namespace std;
int i,n,L,t,s;
int main(){
typedef pair<int,int>pii;
priority_queue<pii> qu;
pii p;
int tr[100002];
for(scanf("%d%d",&n,&L);i++<n;)scanf("%d",tr+i);
*t=tr[n+1]=0;
for(;--i;)
tr[i]>tr[i-1]&tr[i]>tr[i+1]?
qu.push(pii(tr[i]-L,i)),
tr[i]=L:0;
for(;!qu.empty();
n&&n!=L&n>tr[s+2]?
qu.push(pii(t-L+n,s+1)),
tr[s+1]=L
:0)
p=qu.top(),
qu.pop(),
t=p.first,
tr[s=p.second]=0,
n=tr[s-1],
n&&n!=L&n>tr[s-2]?
qu.push(pii(t-L+n,s-1)),
tr[s-1]=L
:0,
n=tr[s+1];
printf("%d\n",-t);
} | a.cc: In function 'int main()':
a.cc:13:9: error: invalid type argument of unary '*' (have 'int')
13 | *t=tr[n+1]=0;
| ^~
|
s479819980 | p00474 | C++ | #include <iostream>
#include <vector>
using namespace std;
const int INF = 100000000;
int n, l;
int data[2][100000];
int val[100000];
main(){
cin >> n >> l;
for(int i=0;i<n;i++){
cin >> data[0][i];
val[i] = data[0][i];
}
int ans = 0;
int rem = n;
int now = 0;
int next = 1;
while(rem > 0){
sort(val, val + n);
int valm = l - val[n-1];
if(data[now][0] > data[now][1]){
data[next][0] = data[now][0] + valm;
if(data[next][0] >= l){
data[next][0] = 0;
--rem;
}
}else{
data[next][0] = data[now][0];
}
val[0] = data[next][0];
for(int i=1;i<n-1;i++){
if(data[now][i-1] < data[now][i] && data[now][i] > data[now][i+1]){
data[next][i] = data[now][i] + valm;
if(data[next][i] >= l){
data[next][i] = 0;
--rem;
}
}else{
data[next][i] = data[now][i];
}
val[i] = data[next][i];
}
if(data[now][n-2] < data[now][n-1]){
data[next][n-1] = data[now][n-1] + valm;
if(data[next][n-1] >= l){
data[next][n-1] = 0;
--rem;
}
}else{
data[next][n-1] = data[now][n-1];
}
val[n-1] = data[next][n-1];
next = now;
now = 1 - next;
ans += valm;
}
cout << ans << endl;
return 0;
} | a.cc:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
12 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:15:12: error: reference to 'data' is ambiguous
15 | cin >> data[0][i];
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [2][100000]'
9 | int data[2][100000];
| ^~~~
a.cc:16:14: error: reference to 'data' is ambiguous
16 | val[i] = data[0][i];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [2][100000]'
9 | int data[2][100000];
| ^~~~
a.cc:23:5: error: 'sort' was not declared in this scope; did you mean 'short'?
23 | sort(val, val + n);
| ^~~~
| short
a.cc:25:8: error: reference to 'data' is ambiguous
25 | if(data[now][0] > data[now][1]){
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [2][100000]'
9 | int data[2][100000];
| ^~~~
a.cc:25:23: error: reference to 'data' is ambiguous
25 | if(data[now][0] > data[now][1]){
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [2][100000]'
9 | int data[2][100000];
| ^~~~
a.cc:26:7: error: reference to 'data' is ambiguous
26 | data[next][0] = data[now][0] + valm;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [2][100000]'
9 | int data[2][100000];
| ^~~~
a.cc:26:23: error: reference to 'data' is ambiguous
26 | data[next][0] = data[now][0] + valm;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [2][100000]'
9 | int data[2][100000];
| ^~~~
a.cc:27:10: error: reference to 'data' is ambiguous
27 | if(data[next][0] >= l){
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [2][100000]'
9 | int data[2][100000];
| ^~~~
a.cc:28:9: error: reference to 'data' is ambiguous
28 | data[next][0] = 0;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [2][100000]'
9 | int data[2][100000];
| ^~~~
a.cc:32:7: error: reference to 'data' is ambiguous
32 | data[next][0] = data[now][0];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/rang |
s178500374 | p00474 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int N,L,a[100002]={0};
int memo[100002];
int rec(int id)
{
if(~memo[id])return memo[id];
int wait=0;
if(a[id-1]>a[id])wait=max(wait,rec(id-1));
if(a[id]<a[id+1])wait=max(wait,rec(id+1));
return memo[id] = wait + L-a[id];
}
int main()
{
memset(memo,-1,sizeof(memo));
cin>>N>>L;
for(int i=1;i<=N;i++)cin>>a[i];
int ans=0;
for(int i=1;i<=N;i++)ans=max(ans,rec(i));
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:19:3: error: 'memset' was not declared in this scope
19 | memset(memo,-1,sizeof(memo));
| ^~~~~~
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;
|
s864015643 | p00474 | C++ | / JOI 2009-2010 本戦3 ツララ だよー
// オンラインジャッジに後で出す
#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;
typedef pair<int,int> P;
int main(void)
{
int N, L;
cin >> N >> L;
int t[100002] = {};
priority_queue<P> pque, next_pque; // first : Long second : No
for(int i = 1; i <= N; i++)
cin >> t[i];
for(int i = 1; i <= N; i++){
if(t[i-1] < t[i] && t[i] > t[i+1]){
pque.push(P(t[i],i));
// cout << ' ' << i << endl;
}
}
int ans = 0;
while(pque.size()){
int dl = L - pque.top().first;
ans += dl;
while(pque.size()){
int No = pque.top().second;
pque.pop();
t[No] += dl;
// cout << t[No] << endl;
if(t[No] < L)
next_pque.push(P(t[No],No));
else {
t[No] = -1;
if(No > 1 && t[No-1] > t[No-2]){
next_pque.push(P(t[No-1],No-1));
}
if(No < N && t[No+1] > t[No+2]){
next_pque.push(P(t[No+1],No+1));
}
}
}
// cout << endl;
swap(pque,next_pque);
}
cout << ans << endl;
} | a.cc:1:1: error: expected unqualified-id before '/' token
1 | / JOI 2009-2010 本戦3 ツララ だよー
| ^
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:6:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:179:51: error: 'size_t' is not a member of 'std'; did you m |
s627199478 | p00474 | C++ | #include<iostream>
using namespace std;
int N,L;
int ice[100000]; //つららの長さ
int time[100000]; //伸び始め〜折れるまで
int num[100000]; //左中右とくらべて伸びる順番(0〜2)
int stime[100000]; //伸び始める時間(>=0)
int main(){
int i,j;
cin >> N >> L;
for(i = 0;i < N;i++){
cin >> ice[i];
time[i] = L-ice[i];
}
for(i = 0;i < N-1;i++){
if(ice[i] < ice[i+1])
num[i]++;
else
num[i+1]++;
}
for(i = 0;i < N;i++){
if(num[i] != 0)
continue;
for(j = i-1;j >= 0;j--){
if(num[j] == 2){
if(stime[j] < stime[j+1]+time[j+1]){
stime[j] = stime[j+1]+time[j+1];
}
break;
}
stime[j] = stime[j+1]+time[j+1];
}
for(j = i+1;j < N;j++){
if(num[j] == 2){
if(stime[j] < stime[j-1]+time[j-1]){
stime[j] = stime[j-1]+time[j-1];
}
break;
}
stime[j] = stime[j-1]+time[j-1];
}
}
int max = 0;
for(i = 0;i < N;i++){
if(max < stime[i]+time[i])
max = stime[i]+time[i];
}
cout << max << endl;
return 0;
} | a.cc:5:16: error: 'int time [100000]' redeclared as different kind of entity
5 | int time[100000]; //伸び始め〜折れるまで
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:13:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i] = L-ice[i];
| ^
a.cc:13:25: error: assignment of read-only location '*(time + ((sizetype)i))'
13 | time[i] = L-ice[i];
| ~~~~~~~~^~~~~~~~~~
a.cc:26:66: warning: pointer to a function used in arithmetic [-Wpointer-arith]
26 | if(stime[j] < stime[j+1]+time[j+1]){
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:26:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
26 | if(stime[j] < stime[j+1]+time[j+1]){
| ~~~~~~~~~~^~~~~~~~~~
a.cc:26:45: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
26 | if(stime[j] < stime[j+1]+time[j+1]){
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:27:71: warning: pointer to a function used in arithmetic [-Wpointer-arith]
27 | stime[j] = stime[j+1]+time[j+1];
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:27:62: warning: pointer to a function used in arithmetic [-Wpointer-arith]
27 | stime[j] = stime[j+1]+time[j+1];
| ~~~~~~~~~~^~~~~~~~~~
a.cc:27:62: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
27 | stime[j] = stime[j+1]+time[j+1];
| ~~~~~~~~~~^~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:31:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | stime[j] = stime[j+1]+time[j+1];
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:31:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | stime[j] = stime[j+1]+time[j+1];
| ~~~~~~~~~~^~~~~~~~~~
a.cc:31:46: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
31 | stime[j] = stime[j+1]+time[j+1];
| ~~~~~~~~~~^~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:35:66: warning: pointer to a function used in arithmetic [-Wpointer-arith]
35 | if(stime[j] < stime[j-1]+time[j-1]){
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:35:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
35 | if(stime[j] < stime[j-1]+time[j-1]){
| ~~~~~~~~~~^~~~~~~~~~
a.cc:35:45: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
35 | if(stime[j] < stime[j-1]+time[j-1]){
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:36:71: warning: pointer to a function used in arithmetic [-Wpointer-arith]
36 | stime[j] = stime[j-1]+time[j-1];
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:36:62: warning: pointer to a function used in arithmetic [-Wpointer-arith]
36 | stime[j] = stime[j-1]+time[j-1];
| ~~~~~~~~~~^~~~~~~~~~
a.cc:36:62: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
36 | stime[j] = stime[j-1]+time[j-1];
| ~~~~~~~~~~^~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:40:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
40 | stime[j] = stime[j-1]+time[j-1];
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:40:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
40 | stime[j] = stime[j-1]+time[j-1];
| ~~~~~~~~~~^~~~~~~~~~
a.cc:40:46: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
40 | stime[j] = stime[j-1]+time[j-1];
| ~~~~~~~~~~^~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:45:41: warning: pointer to a function used in arithmetic [-Wpointer-arith]
45 | if(max < stime[i]+time[i])
| ^
a.cc:45:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
45 | if(max < stime[i]+time[i])
| ~~~~~~~~^~~~~~~~
a.cc:45:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
45 | if(max < stime[i]+time[i])
| ~~~~^~~~~~~~~~~~~~~~~~
a.cc:46:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | max = stime[i]+time[i];
| ^
a.cc:46:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | max = stime[i]+time[i];
| ~~~~~~~~^~~~~~~~
a.cc:46:39: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
46 | max = stime[i]+time[i];
| ~~~~~~~~^~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s728648386 | p00475 | C++ | #include <stdio.h>
#include <algorithm>
#include <climits>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,b) FOR(i,0,b)
int a[100000];
int b[100000];
int amn=INT_MAX;
int amx=INT_MIN;
int bmn=INT_MAX;
int bmx=INT_MIN;
int n;
int c,d;
int or = INT_MIN;
int ou = INT_MIN;
int main(){
scanf("%d",&n);
REP(i,n){
scanf("%d %d",&c,&d);
a[i] = c+d;
b[i] = c-d;
amn = min(amn,a[i]);
amx = max(amx,a[i]);
bmn = min(bmn,b[i]);
bmx = max(bmx,b[i]);
}
REP(i,n){
or = max(or,min(max(a[i]-amn,b[i]-bmn),max(amx-a[i],bmx-b[i])));
ou = max(ou,min(max(a[i]-amn,bmx-b[i]),max(amx-a[i],b[i]-bmn)));
}
printf("%d",min(or,ou));
} | a.cc:18:5: error: expected unqualified-id before 'or' token
18 | int or = INT_MIN;
| ^~
a.cc: In function 'int main()':
a.cc:33:17: error: expected primary-expression before 'or' token
33 | or = max(or,min(max(a[i]-amn,b[i]-bmn),max(amx-a[i],bmx-b[i])));
| ^~
a.cc:33:20: error: expected primary-expression before '=' token
33 | or = max(or,min(max(a[i]-amn,b[i]-bmn),max(amx-a[i],bmx-b[i])));
| ^
a.cc:33:26: error: expected primary-expression before 'or' token
33 | or = max(or,min(max(a[i]-amn,b[i]-bmn),max(amx-a[i],bmx-b[i])));
| ^~
a.cc:33:28: error: expected primary-expression before ',' token
33 | or = max(or,min(max(a[i]-amn,b[i]-bmn),max(amx-a[i],bmx-b[i])));
| ^
a.cc:36:25: error: expected primary-expression before 'or' token
36 | printf("%d",min(or,ou));
| ^~
a.cc:36:27: error: expected primary-expression before ',' token
36 | printf("%d",min(or,ou));
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.