submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s592345865
p00447
C++
a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;}
a.cc:1:1: error: 'a' does not name a type 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:49: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^~~~ a.cc: In function 'int main()': a.cc:1:76: error: 'n' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:64: error: 'scanf' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^~~~~ a.cc:1:95: error: 'i' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:123: error: 'a' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:129: error: 'b' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:148: error: 'm' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:155: error: 'i' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:183: error: 'c' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:189: error: 'd' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:200: error: 'i' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:213: error: 'w' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:215: error: 'c' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:220: error: 'a' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:225: error: 'q' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:227: error: 'd' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t=0,w,q;main(){for(;;){scanf("%d",&n);if(!n)break;for(i=0;i<n;i++){scanf("%d %d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d %d",&c[i],&d[i]);}for(i=0;i<m;i++){w=c[i]-a[0];q=d[i]-b[0];for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+w==c[k]){if(b[j]+q==d[k]){t++;break;}}}}if(t==n-1){printf("%d %d\n",w,q);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:232: error:
s285217185
p00447
C++
#include <cstdio> #include <vector> using namespace std; int main() { while(true) { int m, n; vector<pair<int, int> > ms, ns; scanf("%d", &m); if(m == 0) break; ms.resize(m); for(int i = 0; i < m; ++i) scanf("%d%d", &ms[i].first, &ms[i].second); scanf("%d", &n); ns.resize(n); for(int i = 0; i < n; ++i) scanf("%d%d", &ns[i].first, &ns[i].second); int dx, dy; for(int i = 0; i < n; ++i) { dx = ns[i].first - ms[0].first; dy = ns[i].second - ms[0].second; bool exist = true; for(int j = 0; j < m; ++j) { if(!binary_search(ns.begin(), ns.end(), make_pair(ms[i].first + dx, ms[i].second + dy))) exist = false; } if(exist) break; } printf("%d\n%d\n", dx, dy); } return 0; }
a.cc: In function 'int main()': a.cc:27:5: error: 'binary_search' was not declared in this scope 27 | if(!binary_search(ns.begin(), ns.end(), make_pair(ms[i].first + dx, ms[i].second + dy))) | ^~~~~~~~~~~~~
s892287777
p00447
C++
a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;}
a.cc:1:1: error: 'a' does not name a type 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:43: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^~~~ a.cc: In function 'int main()': a.cc:1:67: error: 'n' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:55: error: 'scanf' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^~~~~ a.cc:1:79: error: 'i' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:106: error: 'a' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:112: error: 'b' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:131: error: 'm' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:138: error: 'i' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:165: error: 'c' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:171: error: 'd' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:182: error: 'i' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:199: error: 'j' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:216: error: 'k' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:232: error: 'a' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:237: error: 'c' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:257: error: 'b' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0;}}return 0;} | ^ a.cc:1:262: error: 'd' was not declared in this scope 1 | a[200],b[200],c[1000],d[1000],n,m,i,j,k,t;main(){for(;scanf("%d",&n)&&n;){for(i=0;i<n;i++){scanf("%d%d",&a[i],&b[i]);}scanf("%d",&m);for(i=0;i<m;i++){scanf("%d%d",&c[i],&d[i]);}for(i=0;i<m;i++){for(j=1;j<n;j++){for(k=0;k<m;k++){if(a[j]+c[i]-a[0]==c[k]){if(b[j]+d[i]-b[0]==d[k]){t++;}}}}if(t==n-1){printf("%d %d\n",c[i]-a[0],d[i]-b[0]);t=0;break;}t=0
s197880866
p00447
C++
#include<iostream> #include<sstream> #include<cstdio> #include<cstdlib> #include<vector> #include<string> #include<stack> #include<queue> #include<deque> #include<set> #include<map> #include<algorithm> #include<functional> #include<utility> #include<cmath> #include<ctime> #include<complex> using namespace std; #define REP(i,s,e) for(int i=int(s);i<=int(e);i++) #define rep(i,n) for(int i=0;i<int(n);i++) int main(){ while(true){ int m,n,x,y; vector<pair<int,int> >c; vector<pair<int,int> >p; vector<pair<int,int> >s; cin >> m; if(m==0) break; rep(i,m){ cin >> x >> y; c.push_back(make_pair(x,y)); } cin >> n; rep(i,n){ cin >> x >> y; p.push_back(make_pair(x,y)); } sort(c.begin(),c.end()); sort(p.begin(),p.end()); int x=0; int y; rep(i,n){ rep(j,m-1){ s.push_back(make_pair(p[i].first+c[j+1].first-c[0].first,p[i].second+c[j+1].second-c[0].second)); REP(k,i+1,n-1){ if(p[k]==s[j]){ x++; break;} } } s.clear(); if(x==m-1){ y=i; break;} } cout << p[y].first-c[0].first << " " << p[y].second-c[0].second << endl; c.clear(); p.clear(); } return 0; }
a.cc: In function 'int main()': a.cc:46:21: error: redeclaration of 'int x' 46 | int x=0; int y; | ^ a.cc:29:25: note: 'int x' previously declared here 29 | int m,n,x,y; | ^ a.cc:46:30: error: redeclaration of 'int y' 46 | int x=0; int y; | ^ a.cc:29:27: note: 'int y' previously declared here 29 | int m,n,x,y; | ^
s708140794
p00447
C++
#include <iostream> #include <vector> using namespace std; #define MAX 200 struct Point{ int x, y; bool operator < (const Point p)const{ if(x != p.x){ return x < p.x; }else{ return y < p.y; } } }; int n, m; Point star[MAX], pict[MAX*5]; Point search(){ Point res; vector<Point> v; for(int i = 0 ; i < m ; i++){ for(int j = 0 ; j < n ; j++){ Point P; P.x = pict[j].x - star[i].x; P.y = pict[j].y - star[i].y; v.push_back(P); } } sort(v.begin(),v.end()); int cnt = 1; Point p = v[0]; for(int i = 1 ; i < (int)v.size() ; i++){ if(cnt == m){ res = p; break; } if(p.x != v[i].x || p.y != v[i].y){ p = v[i]; cnt = 1; }else{ cnt++; } } return res; } int main(){ while(cin >> m, m){ for(int i = 0 ; i < m ; i++){ cin >> star[i].x >> star[i].y; } cin >> n; for(int i = 0 ; i < n ; i++){ cin >> pict[i].x >> pict[i].y; } Point p = search(); cout << p.x << " " << p.y << endl; } return 0; }
a.cc: In function 'Point search()': a.cc:35:3: error: 'sort' was not declared in this scope; did you mean 'short'? 35 | sort(v.begin(),v.end()); | ^~~~ | short
s913852437
p00448
Java
import java.util.Scanner; public class Solve { private static boolean debug = false; private static int r; private static int c; private static int[][] senbeis; private static int URA = 0, OMOTE = 1; @SuppressWarnings("unused") private static void debug(String format, Object... objects) { if (!debug) return; System.out.format(format, objects); } public static int solve() { int ans = 0; for (int trial = 0; trial < (2 << 10); trial++) { int canSell = 0; for (int x = 0; x < c; x++) { int ura = 0; for (int y = 0; y < r; y++) { boolean reverses = ((y >> trial) & 1) == 0; int target = reverses ? URA : OMOTE; ura += (senbeis[y][x] == target) ? 1 : 0; } canSell += Math.max(ura, r - ura); } ans = Math.max(ans, canSell); } return ans; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); r = scanner.nextInt(); c = scanner.nextInt(); senbeis = new int[r][c]; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { senbeis[i][j] = scanner.nextInt(); } } debug("===\n"); debug("%d %d\n", r, c); for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { debug("%d ", senbeis[i][j]); } debug("\n"); } debug("===\n"); System.out.format("%d\n", solve()); scanner.close(); } }
Main.java:3: error: class Solve is public, should be declared in a file named Solve.java public class Solve { ^ 1 error
s672684931
p00448
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner scn = new Scanner(System.in); int row,col; int[] cols; int cnt_min = 10*10000; row = scn.nextInt(); col = scn.nextInt(); cols = new int[col]; for(int i=0; i<row; i++) for(int j=0; j<col; j++) cols[j] = cols[j]<<1+scn.nextInt(); for(int i=0; i<1<<(row-1); i++){ int cnt=0; for(int column : cols){ int tmp=0; column=column^i; for(int j=0; j<row; j++){ if(column&1 == 0) tmp++; column = column>>1; } cnt += (tmp<(row-tmp))?tmp:(row-tmp); } cnt_min = (cnt<cnt_min)?cnt:cnt_min; } System.out.println(cnt_min); } }
Main.java:23: error: bad operand types for binary operator '&' if(column&1 == 0) ^ first type: int second type: boolean 1 error
s854263817
p00448
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner scn = new Scanner(System.in); int row,col; int[] cols; int cnt_min = 10*10000; while(true){ row = scn.nextInt(); col = scn.nextInt(); if(row==0&&col==0) break; cols = new int[col]; for(int i=0; i<row; i++) for(int j=0; j<col; j++) cols[j] = cols[j]<<1+scn.nextInt(); for(int i=0; i<1<<(row-1); i++){ int cnt=0; for(int column : cols){ int tmp=0; column=column^i; for(int j=0; j<row; j++){ if(column&1 == 0) tmp++; column = column>>1; } cnt += (tmp<(row-tmp))?tmp:(row-tmp); } cnt_min = (cnt<cnt_min)?cnt:cnt_min; } System.out.println(cnt_min); } } }
Main.java:26: error: bad operand types for binary operator '&' if(column&1 == 0) ^ first type: int second type: boolean 1 error
s901678917
p00448
Java
import java.util.*; public class aoj525{ public static void main(String[] args){ Scanner scn = new Scanner(System.in); int row,col; int[] cols; int cnt_min = 10*10000; while(true){ row = scn.nextInt(); col = scn.nextInt(); if(row==0&&col==0) break; cols = new int[col]; for(int i=0; i<row; i++) for(int j=0; j<col; j++) cols[j] = (cols[j]<<1)+scn.nextInt(); for(int i=0; i<(1<<(row-1)); i++){ int cnt=0; for(int column : cols){ int tmp=0; column=column^i; for(int j=0; j<row; j++){ tmp += column&1; column >>= 1; } cnt += (tmp<(row-tmp))?tmp:(row-tmp); } cnt_min = (cnt<cnt_min)?cnt:cnt_min; } System.out.println(row*col-cnt_min); } } }
Main.java:3: error: class aoj525 is public, should be declared in a file named aoj525.java public class aoj525{ ^ 1 error
s483604249
p00448
Java
import java.util.*; public class aoj525{ public static void main(String[] args){ Scanner scn = new Scanner(System.in); int row,col; int[] cols; int cnt_min; while(true){ cnt_min = 10*10000; row = scn.nextInt(); col = scn.nextInt(); if(row==0&&col==0) break; cols = new int[col]; for(int i=0; i<row; i++) for(int j=0; j<col; j++) cols[j] = (cols[j]<<1)+scn.nextInt(); for(int i=0; i<(1<<(row-1)); i++){ int cnt=0; for(int column : cols){ int tmp=0; column=column^i; for(int j=0; j<row; j++){ tmp += column&1; column >>= 1; } cnt += (tmp<(row-tmp))?tmp:(row-tmp); } cnt_min = (cnt<cnt_min)?cnt:cnt_min; } System.out.println(row*col-cnt_min); } } }
Main.java:3: error: class aoj525 is public, should be declared in a file named aoj525.java public class aoj525{ ^ 1 error
s568636553
p00448
C
#include <cstdio> #include <algorithm> using namespace std; int r, c, a[15][10005], maxn; void dfs(int x) { if (x == r + 1) { int temp = 0; for (int j = 1; j <= c; j++) { int s = 0; for (int i = 1; i <= r; i++) if (a[i][j] == 1) s++; temp += max(s, r - s); } maxn = max(maxn, temp); return ; } dfs(x + 1); for (int i = 1; i <= c; i++) a[x][i] = !a[x][i]; dfs(x + 1); } int main() { while (scanf("%d %d", &r, &c) != EOF) { maxn = 0; if (r == 0 && c == 0) break; for (int i = 1; i <= r; i++) for (int j = 1; j <= c; j++) scanf("%d", &a[i][j]); dfs(1); printf("%d\n", maxn); } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s346570680
p00448
C
#include<stdio.h> int r,c; char senbei[10][10000],check[10]; long max; void search(int i){ if(i>=r){ long stock; stock=count(); max=(stock>max)?stock:max; return; } check[i]=1; search(i+1); check[i]=0; search(i+1); } long count(){ int i,j; char num; long ans=0; for(i=0;i<c;i++){ num=0; for(j=0;j<r;j++){ num+=senbei[j][i]^check[j]; } if((int)num>(r/2)) ans+=(long)num; else ans+=(long)(r-(int)num); } return ans; } int main(){ int i,j; while(1){ scanf("%d %d",&r,&c); if(r==0) break; for(i=0;i<r;i++){ for(j=0;j<c;j++){ scanf("%d",&senbei[i][j]); } } max=0; search(0); printf("%ld\n",max); } return 0; }
main.c: In function 'search': main.c:11:23: error: implicit declaration of function 'count' [-Wimplicit-function-declaration] 11 | stock=count(); | ^~~~~ main.c: At top level: main.c:21:6: error: conflicting types for 'count'; have 'long int()' 21 | long count(){ | ^~~~~ main.c:11:23: note: previous implicit declaration of 'count' with type 'int()' 11 | stock=count(); | ^~~~~
s800271706
p00448
C
#include<stdio.h> int r,c; char senbei[10][10000],check[10]; long max; void search(int i){ if(i>=r){ long stock; stock=count(); max=(stock>max)?stock:max; return; } check[i]=1; search(i+1); check[i]=0; search(i+1); } long count(){ int i,j; char num; long ans=0; for(i=0;i<c;i++){ num=0; for(j=0;j<r;j++){ num+=senbei[j][i]^check[j]; } if((int)num>(r/2)) ans+=(long)num; else ans+=(long)(r-(int)num); } return ans; } int main(){ int i,j; while(1){ scanf("%d %d",&r,&c); if(r==0) break; for(i=0;i<r;i++){ for(j=0;j<c;j++){ scanf("%d",&senbei[i][j]); } } max=0; search(0); printf("%ld\n",max); } return 0; }
main.c: In function 'search': main.c:11:23: error: implicit declaration of function 'count' [-Wimplicit-function-declaration] 11 | stock=count(); | ^~~~~ main.c: At top level: main.c:21:6: error: conflicting types for 'count'; have 'long int()' 21 | long count(){ | ^~~~~ main.c:11:23: note: previous implicit declaration of 'count' with type 'int()' 11 | stock=count(); | ^~~~~
s768185877
p00448
C
#include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<string> #include<cstring> #include<iomanip> #include<iostream> #include<stack> #include<cmath> #include<map> #include<vector> #define ll long long #define inf 0x3f3f3f3f #define INF 1000000000 #define bug1 cout<<"bug1"<<endl; #define bug2 cout<<"bug2"<<endl; #define bug3 cout<<"bug3"<<endl; using namespace std; #define sf scanf #define pf printf #define mem(a,b) memset(a,b,sizeof(a)); #define maxn 12 int r,c; bool mat[11][10005]; int anslast; void dfs(int x){ if(x==r+1){ int ans=0; for(int j=1;j<=c;++j){ int num1=0; for(int i=1;i<=r;++i){ if(mat[i][j])++num1; } if(num1>r-num1)ans+=num1; else ans+=(r-num1); } anslast=max(anslast,ans); return; } dfs(x+1); for(int j=1;j<=c;++j){ mat[x][j]=!mat[x][j]; } dfs(x+1); } int main(){ while(~sf("%d%d",&r,&c)&&r+c){ anslast=0; for(int i=1;i<=r;++i){ for(int j=1;j<=c;++j){ sf("%d",&mat[i][j]); } } dfs(1); pf("%d\n",anslast); } }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s648831296
p00448
C
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int r,c,ans; bool pan[12][10002]; bool dis[10002]; void dfs(int x) { if(x>r) { int cnt=0; for(int j=1;j<=c;j++) { int sum=0; for(int i=1;i<=r;i++) if(dis[i]!=pan[i][j]) sum++; cnt+=max(sum,r-sum); } ans=max(ans,cnt); return; } dis[x]=0; dfs(x+1); dis[x]=1; dfs(x+1); } int main() { while(scanf("%d %d",&r,&c)&&r&&c) { ans=0; memset(dis,0,sizeof(dis)); for(int i=1;i<=r;i++) for(int j=1;j<=c;j++) cin>>pan[i][j]; dfs(1); printf("%d\n",ans); } }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s461608048
p00448
C
//Garden Luba thinks about #include <iostream> #include <cstdio> using namespace std; int a[120]; int n,k; int main(){ scanf("%d%d",&n,&k); int i; for(i = 0; i < n; i++) scanf("%d",&a[i]); int minh = 999999; for(i = 0; i < n; i++){ if(k%a[i]==0){ if(k/a[i]<minh) minh = k/a[i]; } } printf("%d\n",minh); return 0; }
main.c:2:10: fatal error: iostream: No such file or directory 2 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s688125238
p00448
C
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <ctime> #include <iostream> #include <algorithm> #include <sstream> #include <string> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <utility> #include <cctype> #include <numeric> using namespace std; #define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i)) #define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++) int R, C, B[12][10002]; void main2() { int ans = 0; for (int v = 0; v < (1<<R); ++v) { int cnt = 0; for (int x = 0; x < C; ++x) { int up = 0; for (int y = 0; y < R; ++y) { bool is_rev = v >> y & 1; if ((is_rev && !B[y][x]) || (!is_rev && B[y][x])) ++up; } cnt += max(up, R - up); } ans = max(ans, cnt); } printf("%d\n", ans); } int main() { while (scanf("%d%d", &R, &C), R | C) { rep(i,R) rep(j,C) scanf("%d", B[i]+j); main2(); } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s369578085
p00448
C
#include<stdio.h> #include<stdlib.h> #define RMAX 10 #define CMAX 10000 int main(void){ int R,C; char *Buffer=NULL; int Osenbei[RMAX][CMAX]; int RSum[RMAX],CSum[CMAX]; int Count,Count2,GoodSenbei=0; int Best=0; //入力 while(1){ //行列サイズ入力 scanf("%d %d%*c",&R,&C); if(R==0&&C==0){return 0;}//終了判定 for(Count=0;Count<R;Count++)RSum[Count]=0; for(Count=0;Count<C;Count++)CSum[Count]=0; for(Count=0;Count<R;Count++){//一行ずつ入力処理 int InC=0,Charbuff=0; while(Charbuff=getchar()){//一文字ずつ入力 if(Charbuff=='\n'){ break; } else if(Charbuff=='0'){ Osenbei[Count][InC]=0; InC++; } else if(Charbuff=='1'){ Osenbei[Count][InC]=1; InC++; } } for(InC=0;InC<C;InC++){ RSum[Count]+=Osenbei[Count][InC]; CSum[InC]+=Osenbei[Count][InC]; } //for(InC=0;InC<C;InC++){ // printf("%d ",Osenbei[Count][InC]); //} } //ここで全探索 for(Count=0;Count<R;Count++){ for(Count2=0;Count2<C;Count2++){ int Ans=2*CSum[Count2]+2*RSum[Count]-C-R-2+4*Osenbei[Count][Count2]; Best=(Best<Ans)?Ans:Best; GoodSenbei+=Osenbei[Count][Count2] } } printf("%d\n",GoodSenbei+Best); } } //次回 6/4
main.c: In function 'main': main.c:49:67: error: expected ';' before '}' token 49 | GoodSenbei+=Osenbei[Count][Count2] | ^ | ; 50 | } | ~
s745929229
p00448
C
//Osenbei #include <stdio.h> #include <string.h> int A[10001]; int main(){ int C, R, tmp, mask, ans, a, b, c, i, j; while(true){ scanf("%d %d", &C, &R); if((C | R) == 0){ break; } memset(A, 0, sizeof(A)); for(i = 0; i < C; ++i){ for(j = 0; j < R; ++j){ scanf("%d", &tmp); A[j] += tmp << i; } } for(i = 0; i < R; ++i){ //printf("%d", A[i]); } //printf("\n"); ans = 0; for(mask = 0; mask < (1 << C); ++mask){ //printf("mask = %d \n", mask); a = 0; for(i = 0; i < R; ++i){ tmp = A[i] ^ mask; //printf("%d", tmp); b = 0; while(tmp != 0){ if((tmp & 1) == 1){ b++; } tmp = tmp >> 1; } a += b > C - b ? b : C - b; } //printf(" a = %d \n", a); if(ans < a){ ans = a; } } printf("%d\n", ans); } return 0; }
main.c: In function 'main': main.c:8:9: error: 'true' undeclared (first use in this function) 8 | while(true){ | ^~~~ main.c:4:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 3 | #include <string.h> +++ |+#include <stdbool.h> 4 | int A[10001]; main.c:8:9: note: each undeclared identifier is reported only once for each function it appears in 8 | while(true){ | ^~~~
s185809858
p00448
C++
#include <iostream> using namespace std; int main(){ int R, C; static int s[10][10000]; while(cin >> R >> C){ for(int i=0;i<R;i++){ for(int j=0;j<C;j++) cin >> s[i][j]; } int res = 0; for(int b=0;b<(1<<R);b++){ int sum = 0; for(int j=0;j<C;j++){ int cnt = 0; for(int i=0;i<R;i++){ if(b&(1<<i)){ if(s[i][j] == 0) cnt++; } else { if(s[i][j] == 1) cnt++; } } sum += max(cnt, R-cnt); } res = max(sum, res); } cout << res << endl; return; } }
a.cc: In function 'int main()': a.cc:29:1: error: return-statement with no value, in function returning 'int' [-fpermissive] 29 | return; | ^~~~~~
s600324057
p00448
C++
#include<iostream> #define MAX_C 10000 using namespace std; int r,c; int senbei[1<<10][MAX_C+1]; int bitCnt(int n){ int cnt=0; while(n>0){ if(n%2==1)cnt++; n/=2; } if(r-cnt<cnt){ return r-cnt; }else{ return cnt; } } int rec(int s,int n){ if(senbei[s][n]!=-1){ return senbei[s][n]; } int tmp=s; for(int i=0;tmp>0;i++){ if(tmp%2==1){ for(int j=0;j<c;j++){ int bitpos=1<<i; senbei[s][j]=rec(s^bitpos,j)^bitpos; } } tmp/=2; } return senbei[s][n]; } int minimam(){ int ans=1<<30; int tmp=0; for(int i=0;i<1<<r;i++){ tmp=0; cout << "reset" << endl; for(int j=0;j<c;j++){ tmp+=bitCnt(senbei[i][j]); cout<<"tmp is "<<tmp<<endl; } if(ans>tmp)ans=tmp; } return ans; } int main(){ cin>>r>>c; int tmp[c]; memset(tmp,0,sizeof(tmp)); memset(senbei,-1,sizeof(senbei)); for(int i=0;i<r;i++){ for(int j=0;j<c;j++){ tmp[j]=tmp[j]<<1; int bit; cin>>bit; if(bit==1){ tmp[j]=tmp[j]|1; } } } for(int i=0;i<c;i++){ senbei[0][i]=tmp[i]; //cout << tmp[i] << endl; } rec((1<<r)-1,0); for(int i=0;i<1<<r;i++){ for(int j=0;j<c;j++){ cout<<senbei[i][j]; } cout<<endl; } cout<<r*c-minimam()<<endl; return 0; }
a.cc: In function 'int main()': a.cc:55:3: error: 'memset' was not declared in this scope 55 | memset(tmp,0,sizeof(tmp)); | ^~~~~~ 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 | #define MAX_C 10000
s131460248
p00448
C++
#include<iostream> #include<map> #define MAX_C 10000 using namespace std; int r,c; int senbei[1<<10][MAX_C+1]; int bitCnt(int n){ int cnt=0; while(n>0){ if(n%2==1)cnt++; n/=2; } if(r-cnt<cnt){ return r-cnt; }else{ return cnt; } } int rec(int s,int n){ if(senbei[s][n]!=-1){ return senbei[s][n]; } int tmp=s; for(int i=0;tmp>0;i++){ if(tmp%2==1){ for(int j=0;j<c;j++){ int bitpos=1<<i; senbei[s][j]=rec(s^bitpos,j)^bitpos; } } tmp/=2; } return senbei[s][n]; } int minimam(){ int ans=1<<30; int tmp=0; for(int i=0;i<1<<r;i++){ tmp=0; cout << "reset" << endl; for(int j=0;j<c;j++){ tmp+=bitCnt(senbei[i][j]); cout<<"tmp is "<<tmp<<endl; } if(ans>tmp)ans=tmp; } return ans; } int main(){ cin>>r>>c; int tmp[c]; memset(tmp,0,sizeof(tmp)); memset(senbei,-1,sizeof(senbei)); for(int i=0;i<r;i++){ for(int j=0;j<c;j++){ tmp[j]=tmp[j]<<1; int bit; cin>>bit; if(bit==1){ tmp[j]=tmp[j]|1; } } } for(int i=0;i<c;i++){ senbei[0][i]=tmp[i]; //cout << tmp[i] << endl; } rec((1<<r)-1,0); for(int i=0;i<1<<r;i++){ for(int j=0;j<c;j++){ cout<<senbei[i][j]; } cout<<endl; } cout<<r*c-minimam()<<endl; return 0; }
a.cc: In function 'int main()': a.cc:56:3: error: 'memset' was not declared in this scope 56 | memset(tmp,0,sizeof(tmp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<map> +++ |+#include <cstring> 3 | #define MAX_C 10000
s662969755
p00448
C++
#include<iostream> #include<map> #define MAX_C 10000 using namespace std; int r,c; int senbei[1<<10][MAX_C+1]; int bitCnt(int n){ int cnt=0; while(n>0){ if(n%2==1)cnt++; n/=2; } if(r-cnt<cnt){ return r-cnt; }else{ return cnt; } } int rec(int s,int n){ if(senbei[s][n]!=-1){ return senbei[s][n]; } int tmp=s; for(int i=0;tmp>0;i++){ if(tmp%2==1){ for(int j=0;j<c;j++){ int bitpos=1<<i; senbei[s][j]=rec(s^bitpos,j)^bitpos; } } tmp/=2; } return senbei[s][n]; } int minimam(){ int ans=1<<30; int tmp=0; for(int i=0;i<1<<r;i++){ tmp=0; cout << "reset" << endl; for(int j=0;j<c;j++){ tmp+=bitCnt(senbei[i][j]); cout<<"tmp is "<<tmp<<endl; } if(ans>tmp)ans=tmp; } return ans; } int main(){ cin>>r>>c; int tmp[c]; memset(tmp,0,sizeof(tmp)); memset(senbei,-1,sizeof(senbei)); for(int i=0;i<r;i++){ for(int j=0;j<c;j++){ tmp[j]=tmp[j]<<1; int bit; cin>>bit; if(bit==1){ tmp[j]=tmp[j]|1; } } } for(int i=0;i<c;i++){ senbei[0][i]=tmp[i]; //cout << tmp[i] << endl; } rec((1<<r)-1,0); for(int i=0;i<1<<r;i++){ for(int j=0;j<c;j++){ cout<<senbei[i][j]; } cout<<endl; } cout<<r*c-minimam()<<endl; return 0; }
a.cc: In function 'int main()': a.cc:56:3: error: 'memset' was not declared in this scope 56 | memset(tmp,0,sizeof(tmp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<map> +++ |+#include <cstring> 3 | #define MAX_C 10000
s353897375
p00448
C++
#include<iostream> #define MAX_C 10000 using namespace std; int r,c; int senbei[1<<10][MAX_C+1]; int bitCnt(int n){ int cnt=0; while(n>0){ if(n%2==1)cnt++; n/=2; } if(r-cnt<cnt){ return r-cnt; }else{ return cnt; } } int rec(int s,int n){ if(senbei[s][n]!=-1){ return senbei[s][n]; } int tmp=s; for(int i=0;tmp>0;i++){ if(tmp%2==1){ for(int j=0;j<c;j++){ int bitpos=1<<i; senbei[s][j]=rec(s^bitpos,j)^bitpos; } } tmp/=2; } return senbei[s][n]; } int minimam(){ int ans=1<<30; int tmp=0; for(int i=0;i<1<<r;i++){ tmp=0; cout << "reset" << endl; for(int j=0;j<c;j++){ tmp+=bitCnt(senbei[i][j]); cout<<"tmp is "<<tmp<<endl; } if(ans>tmp)ans=tmp; } return ans; } int main(){ while(cin>>r>>c){ if(c==0)break; int tmp[c]; memset(tmp,0,sizeof(tmp)); memset(senbei,-1,sizeof(senbei)); for(int i=0;i<r;i++){ for(int j=0;j<c;j++){ tmp[j]=tmp[j]<<1; int bit; cin>>bit; if(bit==1){ tmp[j]=tmp[j]|1; } } } for(int i=0;i<c;i++){ senbei[0][i]=tmp[i]; //cout << tmp[i] << endl; } rec((1<<r)-1,0); for(int i=0;i<1<<r;i++){ for(int j=0;j<c;j++){ cout<<senbei[i][j]; } cout<<endl; } cout<<r*c-minimam()<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:56:5: error: 'memset' was not declared in this scope 56 | memset(tmp,0,sizeof(tmp)); | ^~~~~~ 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 | #define MAX_C 10000
s174105338
p00448
C++
/* AOJ 0525 * * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0525 * */ //include #include<bits/stdc++.h> //using using namespace std; //define static const typedef #define FOR(i, s, n) for(int (i) = (s); (i) < (n); (i)++) #define REP(i, n) FOR((i), 0, (n)) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SORT(a) sort(ALL(a)) #define RSORT(a) sort(RALL(a)) #define DUMP(x) cerr << #x << " = " << x << "\n" #define DEBUG(x) cerr << #x << " = " << x << " (L:" << __LINE__ << ") " << __FILE__ << "\n" #define F first #define S second typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef vector<PII> VPII; typedef long long LL; typedef vector<LL> VLL; typedef vector<VLL> VVLL; typedef unsigned long long ULL; static const int INF = 1 << 25; //global static set<vector<vector<char> > > a; static vector<vector<char> > d; static int h, w; static int ans; //function static void solve(VVI ar){ if(a.count(ar)){ return; } a.insert(ar); static int cnt; cnt = 0; REP(i, h){ REP(j, w){ cnt += ar[i][j]; } } ans = max(cnt, ans); REP(i, h){ REP(j, w){ ar[i][j] = !ar[i][j]; } solve(ar); REP(j, w){ ar[i][j] = !ar[i][j]; } } REP(i, w){ REP(j, h){ ar[j][i] = !ar[j][i]; } solve(ar); REP(j, h){ ar[j][i] = !ar[j][i]; } } } int main(){ while(scanf("%d %d", &h, &w)){ if(!h && !w){ break; } ans = 0; d.resize(h, VI(w)); REP(i, h){ REP(j, w){ scanf("%d", &d[i][j]); } } solve(d); printf("%d\n", ans); d.resize(0, vector<char>(0)); a = set<vector<vector<char> > >(); } return 0; }
a.cc: In function 'void solve(VVI)': a.cc:48:13: error: no matching function for call to 'std::set<std::vector<std::vector<char> > >::count(VVI&)' 48 | if(a.count(ar)){ | ~~~~~~~^~~~ In file included from /usr/include/c++/14/set:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158, from a.cc:9: /usr/include/c++/14/bits/stl_set.h:756:9: note: candidate: 'template<class _Kt> decltype (((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_count_tr(__x)) std::set<_Key, _Compare, _Alloc>::count(const _Kt&) const [with _Key = std::vector<std::vector<char> >; _Compare = std::less<std::vector<std::vector<char> > >; _Alloc = std::allocator<std::vector<std::vector<char> > >]' 756 | count(const _Kt& __x) const | ^~~~~ /usr/include/c++/14/bits/stl_set.h:756:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_set.h: In substitution of 'template<class _Kt> decltype (((const std::set<std::vector<std::vector<char> > >*)this)->std::set<std::vector<std::vector<char> > >::_M_t.std::_Rb_tree<std::vector<std::vector<char> >, std::vector<std::vector<char> >, std::_Identity<std::vector<std::vector<char> > >, std::less<std::vector<std::vector<char> > >, std::allocator<std::vector<std::vector<char> > > >::_M_count_tr<_Kt, _Req>(__x)) std::set<std::vector<std::vector<char> > >::count(const _Kt&) const [with _Kt = std::vector<std::vector<int> >]': a.cc:48:13: required from here 48 | if(a.count(ar)){ | ~~~~~~~^~~~ /usr/include/c++/14/bits/stl_set.h:757:37: error: no matching function for call to 'std::_Rb_tree<std::vector<std::vector<char> >, std::vector<std::vector<char> >, std::_Identity<std::vector<std::vector<char> > >, std::less<std::vector<std::vector<char> > >, std::allocator<std::vector<std::vector<char> > > >::_M_count_tr(const std::vector<std::vector<int> >&) const' 757 | -> decltype(_M_t._M_count_tr(__x)) | ~~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/map:62, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152: /usr/include/c++/14/bits/stl_tree.h:1311:9: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_count_tr(const _Kt&) const [with _Req = _Kt; _Key = std::vector<std::vector<char> >; _Val = std::vector<std::vector<char> >; _KeyOfValue = std::_Identity<std::vector<std::vector<char> > >; _Compare = std::less<std::vector<std::vector<char> > >; _Alloc = std::allocator<std::vector<std::vector<char> > >]' 1311 | _M_count_tr(const _Kt& __k) const | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:1311:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/string:49, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/stl_function.h: In substitution of 'template<class _Func, class _SfinaeType> using std::__has_is_transparent_t = typename std::__has_is_transparent<_Func, _SfinaeType>::type [with _Func = std::less<std::vector<std::vector<char> > >; _SfinaeType = std::vector<std::vector<int> >]': /usr/include/c++/14/bits/stl_tree.h:1309:9: required by substitution of 'template<class _Kt> decltype (((const std::set<std::vector<std::vector<char> > >*)this)->std::set<std::vector<std::vector<char> > >::_M_t.std::_Rb_tree<std::vector<std::vector<char> >, std::vector<std::vector<char> >, std::_Identity<std::vector<std::vector<char> > >, std::less<std::vector<std::vector<char> > >, std::allocator<std::vector<std::vector<char> > > >::_M_count_tr<_Kt, _Req>(__x)) std::set<std::vector<std::vector<char> > >::count(const _Kt&) const [with _Kt = std::vector<std::vector<int> >]' 1309 | typename _Req = __has_is_transparent_t<_Compare, _Kt>> | ^~~~~~~~ a.cc:48:13: required from here 48 | if(a.count(ar)){ | ~~~~~~~^~~~ /usr/include/c++/14/bits/stl_function.h:1427:11: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<std::vector<std::vector<char> > >, std::vector<std::vector<int> >, void>' 1427 | using __has_is_transparent_t | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:750:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::count(const key_type&) const [with _Key = std::vector<std::vector<char> >; _Compare = std::less<std::vector<std::vector<char> > >; _Alloc = std::allocator<std::vector<std::vector<char> > >; size_type = long unsigned int; key_type = std::vector<std::vector<char> >]' 750 | count(const key_type& __x) const | ^~~~~ /usr/include/c++/14/bits/stl_set.h:750:29: note: no known conversion for argument 1 from 'VVI' {aka 'std::vector<std::vector<int> >'} to 'const std::set<std::vector<std::vector<char> > >::key_type&' {aka 'const std::vector<std::vector<char> >&'} 750 | count(const key_type& __x) const | ~~~~~~~~~~~~~~~~^~~ a.cc:51:11: error: no matching function for call to 'std::set<std::vector<std::vector<char> > >::insert(VVI&)' 51 | a.insert(ar); | ~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_set.h:568:9: note: candidate: 'template<class _InputIterator> void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Key = std::vector<std::vector<char> >; _Compare = std::less<std::vector<std::vector<char> > >; _Alloc = std::allocator<std::vector<std::vector<char> > >]' 568 | insert(_InputIterator __first, _InputIterator __last) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:568:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_set.h:511:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::vector<std::vector<char> >; _Compare = std::less<std::vector<std::vector<char> > >; _Alloc = std::allocator<std::vector<std::vector<char> > >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<std::vector<std::vector<char> >, std::vector<std::vector<char> >, std::_Identity<std::vector<std::vector<char> > >, std::less<std::vector<std::vector<char> > >, std::allocator<std::vector<std::vector<char> > > >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<std::vector<std::vector<char> > >; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<std::vector<std::vector<char> > >, std::vector<std::vector<char> > >::rebind<std::vector<std::vector<char> > >; typename _Alloc::value_type = std::vector<std::vector<char> >; value_type = std::vector<std::vector<char> >]' 511 | insert(const value_type& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:511:32: note: no known conversion for argument 1 from 'VVI' {aka 'std::vector<std::vector<int> >'} to 'const std::set<std::vector<std::vector<char> > >::value_type&' {aka 'const std::vector<std::vector<char> >&'} 511 | insert(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_set.h:520:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(value_type&&) [with _Key = std::vector<std::vector<char> >; _Compare = std::less<std::vector<std::vector<char> > >; _Alloc = std::allocator<std::vector<std::vector<char> > >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<std::vector<std::vector<char> >, std::vector<std::vector<char> >, std::_Identity<std::vector<std::vector<char> > >, std::less<std::vector<std::vector<char> > >, std::allocator<std::vector<std::vector<char> > > >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<std::vector<std::vector<char> > >; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<std::vector<std::vector<char> > >, std::vector<std::vector<char> > >::rebind<std::vector<std::vector<char> > >; typename _Alloc::value_type = std::vector<std::vector<char> >; value_type = std::vector<std::vector<char> >]' 520 | insert(value_type&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_set.h:520:27: note: no known conversion for argument 1 from 'VVI' {aka 'std::vector<std::vector<int> >'} to 'std::set<std::vector<std::vector<char> > >::value_type&&' {aka 'std::vector<std::vector<char> >&&'} 520 | insert(value_type&& __x) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_set.h:548:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(const_iterator, const value_type&) [with _Key = std::vector<std::vector<char> >; _Compare = std::less<std::vector<std::vector<char> > >; _Alloc = std::allocator<std::vector<std::vector<char> > >; iterator = std::_Rb_tree<std::vector<std::vector<char> >, std::vector<std::vector<char> >, std::_Identity<std::vector<std::vector<char> > >, std::less<std::vector<std::vector<char> > >, std::allocator<std::vector<std::vector<char> > > >::const_iterator; const_iterator = std::_Rb_tree<std::vector<std::vector<char> >, std::vector<std::vector<char> >, std::_Identity<std::vector<std::vector<char> > >, std::less<std::vector<std::vector<char> > >, std::allocator<std::vector<std::vector<char> > > >::const_iterator; value_type = std::vector<std::vector<char> >]' 548 | insert(const_iterator __position, const value_type& __x) | ^~~~~~ /usr/i
s807305565
p00448
C++
/* AOJ 0525 * * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0525 * */ //include #include<bits/stdc++.h> //using using namespace std; //define static const typedef #define FOR(i, s, n) for(int (i) = (s); (i) < (n); (i)++) #define REP(i, n) FOR((i), 0, (n)) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SORT(a) sort(ALL(a)) #define RSORT(a) sort(RALL(a)) #define DUMP(x) cerr << #x << " = " << x << "\n" #define DEBUG(x) cerr << #x << " = " << x << " (L:" << __LINE__ << ") " << __FILE__ << "\n" #define F first #define S second typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef vector<PII> VPII; typedef long long LL; typedef vector<LL> VLL; typedef vector<VLL> VVLL; typedef unsigned long long ULL; static const int INF = 1 << 25; //global static set<vector<vector<char> > > a; static vector<vector<char> > d; static int h, w; static int ans; //function static void solve(){ if(a.count(d)){ return; } a.insert(d); static int cnt; cnt = 0; REP(i, h){ REP(j, w){ cnt += d[i][j]; } } ans = max(cnt, ans); REP(i, h){ REP(j, w){ d[i][j] = !d[i][j]; } solve(ar); REP(j, w){ d[i][j] = !d[i][j]; } } REP(i, w){ REP(j, h){ d[j][i] = !d[j][i]; } solve(); REP(j, h){ d[j][i] = !d[j][i]; } } } int main(){ while(scanf("%d %d", &h, &w)){ if(!h && !w){ break; } ans = 0; d.resize(h, vector<char>(w)); REP(i, h){ REP(j, w){ scanf("%d", &d[i][j]); } } solve(); printf("%d\n", ans); d.resize(0, vector<char>(0)); a = set<vector<vector<char> > >(); } return 0; }
a.cc: In function 'void solve()': a.cc:64:11: error: 'ar' was not declared in this scope; did you mean 'a'? 64 | solve(ar); | ^~ | a
s680132007
p00448
C++
#include <cstdio> #include <algorithm> #include <bitset> using namespace std; const int MAX_R = 10; const int MAX_C = 10000; //input int R, C; bitset<MAX_C> a[MAX_R]; int ans; void dfs(int k){ if(k == R){ //row certain int result = 0; //cur max value for(int j = 0; j < C; j ++){ int upNum = 0; //up numbers without fliping for(int i = 0; i < R; i ++){ if(a[i][j]) upNum ++; } result += max(upNum, R - upNum); } ans = max(ans, result); return; } //without fliping dfs(k + 1); //&#183;flip a[k].flip(); dfs(k + 1); a[k].flip(); } void solve(){ ans = 0; dfs(0); printf("%d\n", ans); } int main(int argc, char const *argv[]){ while(scanf("%d %d", &R, &C)){ if(R == 0 && C == 0) break; for(int i = 0; i < R; i ++){ for(int j = 0; j < C; j ++){ int temp; scanf("%d", &tmp); a[i][j] = tmp; } } solve(); } return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:53:30: error: 'tmp' was not declared in this scope; did you mean 'temp'? 53 | scanf("%d", &tmp); | ^~~ | temp
s345178569
p00448
C++
#include<iostream> #include<algorithm> int r, c, res = 0; int data[11][10001], buf[11][10001]; void reverse(int *ose){ for (int i = 0; i < c; i++){ ose[i] = (ose[i] + 1) % 2; } } int main(){ while (std::cin >> r >> c, r || c){ for (int i = 0; i < r; i++){ for (int j = 0; j < c; j++){ std::cin >> data[i][j]; } } int rev = (1 << 10); for (int i = 0; i < rev; i++){ memcpy(buf, data, sizeof(buf)); int ans = 0; for (int j = 0; j < r; j++){ if ((i >> j) & 1)reverse(buf[j]); } for (int j = 0; j < c; j++){ int count = 0; for (int k = 0; k < r; k++)if (buf[k][j] == 1)count++; ans += std::max(count, r - count); } res = std::max(res, ans); } std::cout << res << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:25: error: 'memcpy' was not declared in this scope 24 | memcpy(buf, data, sizeof(buf)); | ^~~~~~ a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<algorithm> +++ |+#include <cstring> 3 |
s203063927
p00448
C++
#include<iostream> #include<stdio.h> #include<math.h> #include <iomanip> #include <map> #include <set> using namespace std; #define FR(i,k,N) for(int i=k; i<N;i++) #define REP(i,N) for(int i=0; i<N;i++) int a,b; int main(){ //8bit??§131?????¨??? /* cout<<"b1="<<b1<<endl; cout<<"b1="<<(b1 ^= b2)<<endl; cout<<"b1="<<(b1 ^= b2)<<endl; cout<<"b1="<<(b1 ^= b2)<<endl; cout<<"b1="<<(b1 ^= b2)<<endl; cout<<"b1="<<(b1 ^= b2)<<endl; cout<<"b1="<<(b1 ^= 3)<<endl; cout<<"b1="<<(b1 ^= 4)<<endl; cout<<"b1="<<(b1 ^= 5)<<endl; cout<<"b1="<<(b1 ^= 6)<<endl;*/ int sen[10][100000]; auto maa=0; while(cin>>a>>b&&a!=0){ REP(i, a)REP(j, b) cin>>sen[i][j]; REP(i, pow(2, a)) { bitset<10> senbei(i); //cout<<i<<" "<<senbei<<endl; bitset<10> ichi(1); REP(j, a){ if ((((senbei >> j) & ichi)==1)){ REP(k, b) {sen[j][k]=(sen[j][k]+1)%2;} } auto sum=0; REP(jj, b){ auto temp=0; REP(ii, a){ temp+=(sen[ii][jj]+1)%2; } sum+=max(temp,(a-temp)); } if ((((senbei >> j) & ichi)==1)){ REP(k, b) {sen[j][k]=(sen[j][k]+1)%2;} } maa=(max(maa,sum)); } } cout<<maa<<endl; //REP(i, a)REP(j, b) cout<<sen[i][j]; } return 0; }
a.cc: In function 'int main()': a.cc:31:13: error: 'bitset' was not declared in this scope 31 | bitset<10> senbei(i); | ^~~~~~ a.cc:7:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>' 6 | #include <set> +++ |+#include <bitset> 7 | using namespace std; a.cc:31:24: error: 'senbei' was not declared in this scope 31 | bitset<10> senbei(i); | ^~~~~~ a.cc:33:24: error: 'ichi' was not declared in this scope 33 | bitset<10> ichi(1); | ^~~~
s770388475
p00448
C++
#include<iostream> #include<stdio.h> #include<math.h> #include <iomanip> #include <map> #include <set> using namespace std; #define FR(i,k,N) for(int i=k; i<N;i++) #define REP(i,N) for(int i=0; i<N;i++) int a,b; int main(){ //8bit??§131?????¨??? /* cout<<"b1="<<b1<<endl; cout<<"b1="<<(b1 ^= b2)<<endl; cout<<"b1="<<(b1 ^= b2)<<endl; cout<<"b1="<<(b1 ^= b2)<<endl; cout<<"b1="<<(b1 ^= b2)<<endl; cout<<"b1="<<(b1 ^= b2)<<endl; cout<<"b1="<<(b1 ^= 3)<<endl; cout<<"b1="<<(b1 ^= 4)<<endl; cout<<"b1="<<(b1 ^= 5)<<endl; cout<<"b1="<<(b1 ^= 6)<<endl;*/ int sen[10][100000]; auto maa=0; while(cin>>a>>b&&a!=0){ REP(i, a)REP(j, b) cin>>sen[i][j]; REP(i, pow(2, a)) { bitset<10> senbei(i); //cout<<i<<" "<<senbei<<endl; bitset<10> ichi(1); REP(j, a){ if ((((senbei >> j) & ichi)==1)){ REP(k, b) {sen[j][k]=(sen[j][k]+1)%2;} } auto sum=0; REP(jj, b){ auto temp=0; REP(ii, a){ temp+=(sen[ii][jj]+1)%2; } sum+=max(temp,(a-temp)); } if ((((senbei >> j) & ichi)==1)){ REP(k, b) {sen[j][k]=(sen[j][k]+1)%2;} } maa=(max(maa,sum)); } } cout<<maa<<endl; //REP(i, a)REP(j, b) cout<<sen[i][j]; } return 0; }
a.cc: In function 'int main()': a.cc:31:13: error: 'bitset' was not declared in this scope 31 | bitset<10> senbei(i); | ^~~~~~ a.cc:7:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>' 6 | #include <set> +++ |+#include <bitset> 7 | using namespace std; a.cc:31:24: error: 'senbei' was not declared in this scope 31 | bitset<10> senbei(i); | ^~~~~~ a.cc:33:24: error: 'ichi' was not declared in this scope 33 | bitset<10> ichi(1); | ^~~~
s530369670
p00448
C++
#include?<iostream> #include?<bitset> #include?<algorithm> ? using?namespace?std; ? bitset<10000>?cookie[10]; ? int?main() { ? ????int?R,?C; ????while(cin?>>?R?>>?C?&&?R?>?0) ????{ ????????int?i,?j; ????????for?(i?=?0;?i?<?R;?++i) ????????{ ????????????for?(j?=?0;?j?<?C;?++j) ????????????{ ????????????????bool?upwards; ????????????????cin?>>?upwards; ????????????????cookie[i][j]?=?upwards; ????????????} ????????} ? ????????int?permute_r?=?1?<<?R; ????????int?result?=?0; ????????for?(i?=?0;?i?<?permute_r?;?++i) ????????{ ????????????for?(j?=?0;?j?<?R;?++j) ????????????{ ????????????????if?(i?&?(1?<<?j)) ????????????????{ ????????????????????cookie[j].flip(); ????????????????} ????????????} ????????????? ? ????????????int?possible_answer?=?0; ????????????for?(j?=?0;?j?<?C;?++j) ????????????{ ????????????????int?up_cookie_count?=?0; ????????????????for?(int?k?=?0;?k?<?R;?++k) ????????????????{ ????????????????????if?(cookie[k][j]) ????????????????????{ ????????????????????????++up_cookie_count; ????????????????????} ????????????????} ????????????????possible_answer?+=?max(up_cookie_count,?R?-?up_cookie_count); ????????????} ????????????result?=?max(result,?possible_answer); ????????????? ????????????for?(j?=?0;?j?<?R;?++j) ????????????{ ????????????????if?(i?&?(1?<<?j)) ????????????????{ ????????????????????cookie[j].flip(); ????????????????} ????????????} ????????} ????????cout?<<?result?<<?endl; ????} ? ????return?0; }
a.cc:1:9: error: #include expects "FILENAME" or <FILENAME> 1 | #include?<iostream> | ^ a.cc:2:9: error: #include expects "FILENAME" or <FILENAME> 2 | #include?<bitset> | ^ a.cc:3:9: error: #include expects "FILENAME" or <FILENAME> 3 | #include?<algorithm> | ^ a.cc:4:1: error: expected unqualified-id before '?' token 4 | ? | ^ a.cc:6:1: error: expected unqualified-id before '?' token 6 | ? | ^ a.cc:8:1: error: expected unqualified-id before '?' token 8 | ? | ^
s789089258
p00448
C++
#include "bits/stdc++.h" using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) int main(){ int n,m; while(cin>>n>>m){ if(n==0&&m==0)break; int data[11][10010]; rep(i,n)rep(j,m)cin>>data[i][j]; int ans=0; rep(i,1<<n){ int t=0; rep(j,m){ int a=0; rep(k,n)a if((i&(1<<k))!=0)a+=!data[k][j]; else a+=data[k][j]; t+=max(a,n-a); } ans=max(ans,t); } cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:17:18: error: expected ';' before 'if' 17 | rep(k,n)a | ^ | ; 18 | if((i&(1<<k))!=0)a+=!data[k][j]; | ~~ a.cc:19:11: error: 'else' without a previous 'if' 19 | else a+=data[k][j]; | ^~~~ a.cc:19:24: error: 'k' was not declared in this scope 19 | else a+=data[k][j]; | ^
s594767438
p00448
C++
#include"bits/stdc++.h" using namespace std;#define rep(i,n) for(inti=0;i<(int)(n);i++) int main(){int n,m,d[11][10010],r,t,a;while(cin>>n>>m&&n&&m){rep(i,n)rep(j,m)cin>>d[i][j];r=0;rep(i,1<<n){t=0;rep(j,m){a=0;rep(k,n)a+=(d[k][j]+!!(i&(1<<k)))%2;t+=max(a,n-a);}r=max(r,t);}cout<<r<<endl;}}
a.cc:1:25: warning: extra tokens at end of #include directive 1 | #include"bits/stdc++.h" using namespace std;#define rep(i,n) for(inti=0;i<(int)(n);i++) int main(){int n,m,d[11][10010],r,t,a;while(cin>>n>>m&&n&&m){rep(i,n)rep(j,m)cin>>d[i][j];r=0;rep(i,1<<n){t=0;rep(j,m){a=0;rep(k,n)a+=(d[k][j]+!!(i&(1<<k)))%2;t+=max(a,n-a);}r=max(r,t);}cout<<r<<endl;}} | ^~~~~ /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
s008807312
p00448
C++
#include <cstdio> #include <algorithm> using namespace std; int bd[10][1000]; int main(){ int r, c; scanf_s(" %d %d", &r, &c); for (int i = 0; i < r; i++){ for (int j = 0; j < c; j++){ scanf_s(" %d", &bd[i][j]); } } int ans = -1; int up = (1 << r); for (int sl = 0; sl < up; sl++){ int h = sl; for (int i = 0; i < r; i++){ if (h % 2 == 1){ for (int j = 0; j < c; j++){ bd[i][j] = (bd[i][j] == 0) ? 1 : 0; } } h /= 2; } int cnt = 0; for (int j = 0; j < c; j++){ int sm=0; for (int i = 0; i < r; i++){ sm += bd[i][j]; } cnt += max(r - sm, sm); } ans = max(cnt, ans); h = sl; for (int i = 0; i < r; i++){ if (h % 2 == 1){ for (int j = 0; j < c; j++){ bd[i][j] = (bd[i][j] == 0) ? 1 : 0; } } h /= 2; } } printf("%d\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 10 | scanf_s(" %d %d", &r, &c); | ^~~~~~~ | scanf
s660669971
p00448
C++
#include <iostream> using namespace std; int r,c; int max_on; int row_on[11]; int col_on[10005]; bool grid[11][10005]; bool flip_pattern[11]; int cur_on = 0; // void setFlipStatus(unsigned int p){ for (int i = 0; i<r; ++i) { if (p & (1<<i)) { flip_pattern[i] = true; } else flip_pattern[i] = false; } } void flip_rows(){ for (int i = 0; i<r; ++i){ if (flip_pattern[i]) { for (int j = 0; j<c; ++j) { grid[i][j] = !grid[i][j]; if(grid[i][j]) col_on[j]++; else col_on[j]--; } row_on[i] = c - row_on[i]; cur_on += 2*row_on[i] - c; } } } void find_cur_max(){ int ori_on = cur_on; for (int j = 0; j<c; ++j) { if(r-col_on[j]>col_on[j]){ cur_on += r - 2*col_on[j]; } } if (cur_on>max_on) max_on = cur_on; cur_on = ori_on; } int main(){ while (cin>>r>>c && r &&c) { max_on = 0; cur_on = 0; memset(flip_pattern, 0, sizeof(flip_pattern)); memset(row_on, 0, sizeof(row_on)); memset(col_on, 0, sizeof(col_on)); // for (int i = 0; i < r; ++i) for (int j = 0; j<c ; ++j) { cin>>grid[i][j]; if (grid[i][j]) { cur_on++; row_on[i]++; col_on[j]++; } } max_on = cur_on; // unsigned int status_size = 1<<r; for (unsigned int i=0; i<status_size;++i ) { //??¨??????????????¬????????? setFlipStatus(i); flip_rows(); find_cur_max(); flip_rows(); } cout<<max_on<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:51:9: error: 'memset' was not declared in this scope 51 | memset(flip_pattern, 0, sizeof(flip_pattern)); | ^~~~~~ 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;
s126168715
p00448
C++
#include <iostream> using namespace std; int r,c; int max_on; int row_on[11]; int col_on[10005]; bool grid[11][10005]; bool flip_pattern[11]; int cur_on = 0; // void setFlipStatus(unsigned int p){ for (int i = 0; i<r; ++i) { if (p & (1<<i)) { flip_pattern[i] = true; } else flip_pattern[i] = false; } } void flip_rows(){ for (int i = 0; i<r; ++i){ if (flip_pattern[i]) { for (int j = 0; j<c; ++j) { grid[i][j] = !grid[i][j]; if(grid[i][j]) col_on[j]++; else col_on[j]--; } row_on[i] = c - row_on[i]; cur_on += 2*row_on[i] - c; } } } void find_cur_max(){ int ori_on = cur_on; for (int j = 0; j<c; ++j) { if(r-col_on[j]>col_on[j]){ cur_on += r - 2*col_on[j]; } } if (cur_on>max_on) max_on = cur_on; cur_on = ori_on; } int main(){ while (cin>>r>>c && r &&c) { max_on = 0; cur_on = 0; memset(flip_pattern, 0, sizeof(flip_pattern)); memset(row_on, 0, sizeof(row_on)); memset(col_on, 0, sizeof(col_on)); // for (int i = 0; i < r; ++i) for (int j = 0; j<c ; ++j) { cin>>grid[i][j]; if (grid[i][j]) { cur_on++; row_on[i]++; col_on[j]++; } } max_on = cur_on; // unsigned int status_size = 1<<r; for (unsigned int i=0; i<status_size;++i ) { //??所有翻?的可能 setFlipStatus(i); flip_rows(); find_cur_max(); flip_rows(); } cout<<max_on<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:51:9: error: 'memset' was not declared in this scope 51 | memset(flip_pattern, 0, sizeof(flip_pattern)); | ^~~~~~ 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;
s520614380
p00448
C++
#include <iostream> #include <algorithm> using namespace::std; int ans = 0; void solve(int** osenbei, int i, const int c, const int r, int temp){ int bef = 0; int aft = 0; for(int i = 0; i < c; i++){ int bef = 0; int aft = 0; for(int j = 0; j < r; j++){//i??????????????? if(osenbei[i][j] == 1){ osenbei[i][j] = 0; bef++;//i?????????1?????°???????????? } else{ osenbei[i][j] = 1; aft++;//i?????????0?????°???????????? } } if(bef <= aft){ temp = temp - bef + aft; ans = max(ans, temp); } else{ for(int j = 0; j < r; j++){//i?????????????????´??? if(osenbei[i][j] == 1) osenbei[i][j] = 0; else osenbei[i][j] = 1; } } } for(int i = 0; i < r; i++){ int bef = 0; int aft = 0; for(int j = 0; j < c; j++){//i??????????????? if(osenbei[j][i] == 1){ osenbei[j][i] = 0; bef++;//i?????????1?????°???????????? } else{ osenbei[j][i] = 1; aft++;//i?????????0?????°???????????? } } if(bef <= aft){ temp = temp - bef + aft; ans = max(ans, temp); } else{ for(int j = 0; j < c; j++){//i?????????????????´??? if(osenbei[j][i] == 1) osenbei[j][i] = 0; else osenbei[j][i] = 1; } } } } int main(){ while(1){ int temp_c, temp_r; cin >> temp_c;//??? cin >> temp_r;//??? const int r = temp_r; const int c = temp_c; if(c == 0 && r == 0) break; int** osenbei = new int*[c]; int** osenbei = new int*[c]; for(int i = 0; i < c; i++){ osenbei[i] = new int[r]; osenbei[i] = new int[r]; } for(int i = 0; i < c; i++){ for(int j = 0; j < r; j++){ osenbei[i][j] = 0; osenbei[i][j] = 0; } } int temp = 0; for(int i = 0; i < c; i++){ for(int j = 0; j < r; j++){ cin >> osenbei[i][j]; if(osenbei[i][j] != 0 && osenbei[i][j] != 1) return 1; else if(osenbei[i][j] == 1) temp++; osenbei[i][j] = osenbei[i][j]; } } ans = temp; //dfs_first(osenbei, 0, c, r, temp);//??±???????????¢?´¢??2 solve(osenbei, 0, c, r, temp);//??±???????????¢?´¢+????¬???? cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:79:15: error: redeclaration of 'int** osenbei' 79 | int** osenbei = new int*[c]; | ^~~~~~~ a.cc:78:15: note: 'int** osenbei' previously declared here 78 | int** osenbei = new int*[c]; | ^~~~~~~
s682319397
p00448
C++
#include <vector> #include <algorithm> #include <set> #include <map> #include <queue> #include <stack> #include <iostream> #include <cstdio> #include <cmath> #include <cstring> using namespace std; int sen[10][10000]; int w,h,ans,mai,x; int main() { while(1){ cin>>h>>w; if(!h&&!w) return; ans=0; for(int i=0;i<h;i++) for(int j=0;j<w;j++) cin>>sen[i][j]; for(int i=0; i < 1<<h ; i++){ mai=0; for(int j=0;j<w;j++){ x=0; for(int k=0;k<h;k++){ if( (i>>k & 1) != (sen[k][j]) ) x++; } mai+=max(x,h-x); } ans=max(ans,mai); } cout<<ans<<endl; }}
a.cc: In function 'int main()': a.cc:18:12: error: return-statement with no value, in function returning 'int' [-fpermissive] 18 | if(!h&&!w) return; | ^~~~~~
s402055444
p00448
C++
#include "iostream" #include "algorithm" using namespace std; int H, W; bool status[10][10000]; bool gap[10]; int box; int num; int ans; int main() { cin >> H >> W; while (H != 0 && W != 0) { for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cin >> status[i][j]; } } for (int j = 0; j < W; j++) { for(int i=0;i<H;i++){ if (status[i][j])box++; } box = max(box, H - box); ans += box; box = 0; } for (int n = 1; n < pow(2,H); n++) { for (int i = 0; i < H; i++) { if (n%(int)pow(2, i + 1) >= pow(2, i))gap[i] = true; else gap[i] = false; } for (int j = 0; j < W; j++) { for (int i = 0; i < W; i++) { if (status[i][j] ^ gap[i])box++; } box = max(box, H - box); num += box; box = 0; } if (ans < num)ans = num; num = 0; } cout << ans<<"\n"; ans = 0; cin >> H >> W; } return 0; }
a.cc: In function 'int main()': a.cc:28:37: error: 'pow' was not declared in this scope 28 | for (int n = 1; n < pow(2,H); n++) { | ^~~
s841306267
p00448
C++
#include "iostream" #include "algorithm" using namespace std; int H, W; bool status[10][10000]; bool gap[10]; int box; int num; int ans; int main() { cin >> H >> W; while (H != 0 && W != 0) { for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cin >> status[i][j]; } } for (int j = 0; j < W; j++) { for(int i=0;i<H;i++){ if (status[i][j])box++; } box = max(box, H - box); ans += box; box = 0; } for (int n = 1; n < pow(2,H); n++) { for (int i = 0; i < H; i++) { if (n%(int)pow(2, i + 1) >= pow(2, i))gap[i] = true; else gap[i] = false; } for (int j = 0; j < W; j++) { for (int i = 0; i < H; i++) { if (status[i][j] ^ gap[i])box++; } box = max(box, H - box); num += box; box = 0; } if (ans < num)ans = num; num = 0; } cout << ans<<"\n"; ans = 0; cin >> H >> W; } return 0; }
a.cc: In function 'int main()': a.cc:28:37: error: 'pow' was not declared in this scope 28 | for (int n = 1; n < pow(2,H); n++) { | ^~~
s521824816
p00448
C++
#include "iostream" #include "algorithm" using namespace std; int H, W; int status[10][10000]; int gap[10]; int box; int num; int ans; int main() { cin >> H >> W; while (H != 0 && W != 0) { for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cin >> status[i][j]; } } for (int j = 0; j < W; j++) { for(int i=0;i<H;i++){ if (status[i][j])box++; } box = max(box, H - box); ans += box; box = 0; } for (int n = 1; n < pow(2,H); n++) { for (int i = 0; i < H; i++) { if (n%(int)pow(2, i + 1) >= pow(2, i))gap[i] = true; else gap[i] = false; } for (int j = 0; j < W; j++) { for (int i = 0; i < H; i++) { if (status[i][j] ^ gap[i])box++; } box = max(box, H - box); num += box; box = 0; } if (ans < num)ans = num; num = 0; } cout << ans<<"\n"; ans = 0; cin >> H >> W; } return 0; }
a.cc: In function 'int main()': a.cc:28:37: error: 'pow' was not declared in this scope 28 | for (int n = 1; n < pow(2,H); n++) { | ^~~
s142923701
p00448
C++
#include <bits/stdc++> using namespace std; using ll=long long; using ull=unsigned long long; const char en='?\n'; int main(){ int r,c,buf; bool st[10][10000]; cin>>r>>c; for(int i=0;i<r;i++){ for(int k=0;k<c;k++){
a.cc:1:10: fatal error: bits/stdc++: No such file or directory 1 | #include <bits/stdc++> | ^~~~~~~~~~~~~ compilation terminated.
s752868177
p00448
C++
#include "bits/stdc++.h" using namespace std; using ll=long long; using ull=unsigned long long; const char en='?\n'; int main(){ int r,c,buf; bool st[10][10000]; cin>>r>>c; for(int i=0;i<r;i++){ for(int k=0;k<c;k++){ cin>>buf; st[r][c]=buf; } } int result=0,count; for(knt flag=0;flag<(1<<r);i++){ count=0; for(int j=0;j<r;j++){ int buft=0,buff=0; for(int i=0;i<c;i++){ bool b=(flag&&(1<<i)); if(st[i][j]^b) buft++; else buff++; } count+=max(buft,buff); } result=max(result,count); } cout<<result<<en; }
a.cc:7:15: warning: multi-character character constant [-Wmultichar] 7 | const char en='?\n'; | ^~~~~ a.cc:7:15: warning: overflow in conversion from 'int' to 'char' changes value from '16138' to '10' [-Woverflow] a.cc: In function 'int main()': a.cc:22:13: error: 'knt' was not declared in this scope; did you mean 'int'? 22 | for(knt flag=0;flag<(1<<r);i++){ | ^~~ | int a.cc:22:24: error: 'flag' was not declared in this scope 22 | for(knt flag=0;flag<(1<<r);i++){ | ^~~~ a.cc:22:36: error: 'i' was not declared in this scope 22 | for(knt flag=0;flag<(1<<r);i++){ | ^
s935803183
p00448
C++
#include "bits/stdc++.h" using namespace std; using ll=long long; using ull=unsigned long long; const char en='?\n'; int main(){ int r,c,buf; bool st[10][10000]; cin>>r>>c; for(int i=0;i<r;i++){ for(int k=0;k<c;k++){ cin>>buf; st[r][c]=buf; } } int result=0,count; for(int flag=0;flag<(1<<r);i++){ count=0; for(int j=0;j<r;j++){ int buft=0,buff=0; for(int i=0;i<c;i++){ bool b=(flag&&(1<<i)); if(st[i][j]^b) buft++; else buff++; } count+=max(buft,buff); } result=max(result,count); } cout<<result<<en; }
a.cc:7:15: warning: multi-character character constant [-Wmultichar] 7 | const char en='?\n'; | ^~~~~ a.cc:7:15: warning: overflow in conversion from 'int' to 'char' changes value from '16138' to '10' [-Woverflow] a.cc: In function 'int main()': a.cc:22:36: error: 'i' was not declared in this scope 22 | for(int flag=0;flag<(1<<r);i++){ | ^
s491171526
p00448
C++
#include <iostream> #include <string> #include <cstdio> #include <cmath> #include <algorithm> using namespace std; int s[15][10005]; int m,n; int maxn=0; void dfs(int x ) { if(x==m+1) { int term=0; for(int i=1; i<=n; i++) { int sum1=0; for(int j=1; j<=m; j++) { if(s[j][i]==1) sum1++; } term+=max(sum1,m-sum1); } maxn=max(term,maxn); return ; } dfs(x+1); for(int j=1; j<=n; j++) { s[x][j]=!s[x][j]; } dfs(x+1); } int main() { while(cin >> m >> n&&m&&n) { maxn=0; int a; ans=0; for(int i=1; i<=m; i++) { for(int j=1; j<=n; j++) { scanf("%d",&a); s[i][j]=a; } } dfs(0); cout << maxn << endl; } return 0; }
a.cc: In function 'int main()': a.cc:44:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 44 | ans=0; | ^~~ | abs
s777451537
p00448
C++
/* * AOJ 0525: Osenbei * ?¢???????R???C?????????????????????0???1???????¬?????????´????????´????????????????????¬????±??????????????????°????°????0??? * ?±?????????????????´¢???????????? * ???????????????10???????????????????????¬????????¨??¨????????????????????¶????????????1????????°???????????¬?????????????°?0???1????????°??¨????±??????? */ #include <cstdio> #include <iostream> #include <string> using namespace std; int m, n; int mat[11][10001]; int one[10001], _one[10001]; int ans; void solve() { ans = 0; memset(one, 0, sizeof(one)); for(int i = 0; i < m; ++i) { for(int j = 0; j < n; ++j) { cin >> mat[i][j]; one[j] += mat[i][j]; } } for(int no = (1 << m) -1; no >= 0; --no) { int _no = no; for(int i = 0; i < n; ++i) { _one[i] = one[i]; } for(int i = 0; i < m; ++i) { if(_no & 1){ for(int j = 0; j < n; ++j) { _one[j] += mat[i][j] ? -1 : 1; } } _no >>= 1; } int tmp = 0; for(int i = 0; i < n; ++i) { tmp += max(_one[i], m - _one[i]); } ans = max(ans, tmp); } } int main() { while(cin >> m >> n && m > 0 && n > 0) { solve(); cout << ans << endl; } return 0; }
a.cc: In function 'void solve()': a.cc:22:5: error: 'memset' was not declared in this scope 22 | memset(one, 0, sizeof(one)); | ^~~~~~ a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 10 | #include <iostream> +++ |+#include <cstring> 11 | #include <string>
s688059338
p00448
C++
#include <cstdio> int R,C; // (1 <= R <= 10, 1 <= C <= 10 000) const int MAX_ROW = 10; const int MAX_COL = 10000; bool is_flipped[MAX_ROW + 1][MAX_COL + 1]; void flip(int row) { for(int c=0;c<C;c++) is_flipped[row][c] = !is_flipped[row][c]; } int solve() { int min_score = R*C; for(int i=0;i<1<<R;i++) { for(int r=0;r<R;r++) if((i>>r)&1) flip(r); int score = 0; for(int c=0;c<C;c++) { int column_sum = 0; for(int r=0;r<R;r++) if(is_flipped[r][c]) column_sum++; score += std::min(column_sum, R-column_sum); } min_score = std::min(min_score,score); for(int r=0;r<R;r++) if((i>>r)&1) flip(r); } return R*C-min_score; } int main() { scanf("%d %d", &R, &C); int input; while(C!=0 || R!=0) { for (int r = 0; r < R; r++) for (int c = 0; c < C; c++) { scanf("%d", &input); is_flipped[r][c] = input==1; } printf("%d\n", solve()); scanf("%d %d", &R, &C); } return 0; }
a.cc: In function 'int solve()': a.cc:26:39: error: 'min' is not a member of 'std' 26 | score += std::min(column_sum, R-column_sum); | ^~~ a.cc:28:34: error: 'min' is not a member of 'std' 28 | min_score = std::min(min_score,score); | ^~~
s531752122
p00448
C++
#include<algorithm> #include<iostream> #include<bitset> using namespace std; const int MAX_R=10; const int MAX_C=1000; int R,C; bitset<MAX_C> a[MAX_R]; int ans; void check(int k) { if(k==R) { int result=0; for(int j=0;j<C;j++) { int num=0; for(int i=0;i<R;i++) if(a[i][j]) num++; } result+=max(num,R-num); ans=max(ans,result); return; } check(k+1); a[k].flip(); check(k+1); a[k].flip(); } void solve() { ans=0; check(0); cout<<ans<<endl; } int main() { while(cin>>R>>C&&R!=0&&C!=0) { for(int i=0;i<R;i++) { for(int j=0;j<C;j++) { bool tmp; cin>>tmp; a[i][j]=tmp; } } solve(); } return 0; }
a.cc: In function 'void check(int)': a.cc:22:29: error: 'num' was not declared in this scope; did you mean 'enum'? 22 | result+=max(num,R-num); | ^~~ | enum
s027871613
p00448
C++
//??????????¨????????????????????¬¬??????????¢? //??????????´¢+DFS ?????? #include <iostream> #define MAX_N 10 #define MAX_M 10000 using namespace std; bool ex[MAX_N][MAX_M]; int n,m,ans void Dfs(int x) { if(x==n) { int sum=0; for(int j=0;j<m;j++) { int right=0; for(int i=0;i<n;i++) { if(ex[i][j]) right++; } sum+=(right>(n-right))?right:(n-right); } ans=max(ans,sum); return; } //????????¢????????¬ Dfs(x+1); //????????¢?????¬ for(int i=0;i<m;i++) ex[x][i]=!ex[x][i]; Dfs(x+1); } int main() { while(true) { ans=0; cin>>n>>m; if(n!=0&&m!=0) { for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin>>ex[i][j]; Dfs(0); cout<<ans<<endl; } else break; } return 0; }
a.cc:9:1: error: expected initializer before 'void' 9 | void Dfs(int x) | ^~~~ a.cc: In function 'int main()': a.cc:37:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 37 | ans=0; | ^~~ | abs a.cc:44:13: error: 'Dfs' was not declared in this scope 44 | Dfs(0); | ^~~
s187442917
p00448
C++
#include<stdio.h> int main(void){ int i, j, k, l, R, C, count0, count1, Count[10], a[10][10000]; scanf("%d %d", &R, &C); while ( 1 ) { count0 = count1 = 0; for ( i = 0; i < R; i++ ) { for ( j = 0; j < C; j++ ) { scanf("%d", &a[i][j]); Count[i] += a[i][j]; if ( a[i][j] == 0 ) count0++; else if ( a[i][j] == 1) count1++; } } if ( count0 >= count1 ) { for ( i = 0; i < R; i++ ) { if ( Count[i] >= C / 2 ) { for ( j = 0; j < C; j++ ) { if ( a[i][j] == 0 ) a[i][j] = 1; else a[i][j] = 0; } } } } else { for ( i = 0; i < R; i++ ) { if ( Count[i] >= C / 2 ) { for ( j = 0; j < C; j++ ) { if ( a[i][j] == 0 ) a[i][j] = 1; else a[i][j] = 0; } } } } }
a.cc: In function 'int main()': a.cc:35:2: error: expected '}' at end of input 35 | } | ^ a.cc:2:15: note: to match this '{' 2 | int main(void){ | ^
s776865315
p00448
C++
#include <iostream> #include <stdio.h> #include <string.h> #include <string> #include <functional> #include <algorithm> #include <string> #include <vector> #include <algorithm> #include <time.h> #include <stdlib.h> #include <math.h> using namespace std; int main (void) { long C,c,n,m,a[10000][10000],z[10000],o[10000]; C = 0; c = 0; cin >> n >> m; c++; if (n == 0 && m == 0) { break; } if (c > 5) { break; } for (long i = 0; i < m; i++) //????????? { z[i] = 0; o[i] = 0; } for (long i = 0; i < m; i++) { for (long j = 0; j < n; j++) { cin >> a[j][i]; if (a[j][i] == 0) { z[i] += 1; } else { o[i] += 1; } } } for (long i = 0; i < m; i++) { if (z[i] < o[i]) { for (long j = 0; j < n; j++) { if (a[j][i] == 0) { a[j][i] = 0; a[j][i] = 1; } else if (a[j][i] == 1) { a[j][i] = 0; } } } } for (long i = 0; i < m; i++) //????????? { z[i] = 0; o[i] = 0; } for (long j = 0; j < n; j++) { for (long i = 0; i < m; i++) { if (a[j][i] == 0) { z[j] += 1; } else if (a[j][i] == 1) { o[j] += 1; } } } for (long j = 0; j < n; j++) { if (z[j] < o[j]) { for (long i = 0; i < m; i++) { if (a[j][i] == 0) { a[j][i] = 1; } else if (a[j][i] == 1) { a[j][i] = 0; } } } } for (long j = 0; j < n; j++) { for (long i = 0; i < m; i++) { if (a[j][i] == 0) { C += 1; } } } cout << C << endl; C = 0; } }
a.cc: In function 'int main()': a.cc:26:17: error: break statement not within loop or switch 26 | break; | ^~~~~ a.cc:30:17: error: break statement not within loop or switch 30 | break; | ^~~~~ a.cc: At global scope: a.cc:127:1: error: expected declaration before '}' token 127 | } | ^
s602280528
p00448
C++
#include <iostream> #include <stdio.h> #include <string.h> #include <string> #include <functional> #include <algorithm> #include <string> #include <vector> #include <algorithm> #include <time.h> #include <stdlib.h> #include <math.h> using namespace std; int main (void) { long C,c,n,m,a[10000][10000],z[10000],o[10000]; C = 0; c = 0; cin >> n >> m; c++; if (n == 0 && m == 0) { break; } if (c > 5) { break; } for (long i = 0; i < m; i++) //????????? { z[i] = 0; o[i] = 0; } for (long i = 0; i < m; i++) { for (long j = 0; j < n; j++) { cin >> a[j][i]; if (a[j][i] == 0) { z[i] += 1; } else { o[i] += 1; } } } for (long i = 0; i < m; i++) { if (z[i] < o[i]) { for (long j = 0; j < n; j++) { if (a[j][i] == 0) { a[j][i] = 0; a[j][i] = 1; } else if (a[j][i] == 1) { a[j][i] = 0; } } } } for (long i = 0; i < m; i++) //????????? { z[i] = 0; o[i] = 0; } for (long j = 0; j < n; j++) { for (long i = 0; i < m; i++) { if (a[j][i] == 0) { z[j] += 1; } else if (a[j][i] == 1) { o[j] += 1; } } } for (long j = 0; j < n; j++) { if (z[j] < o[j]) { for (long i = 0; i < m; i++) { if (a[j][i] == 0) { a[j][i] = 1; } else if (a[j][i] == 1) { a[j][i] = 0; } } } } for (long j = 0; j < n; j++) { for (long i = 0; i < m; i++) { if (a[j][i] == 0) { C += 1; } } } cout << C << endl; C = 0; } }
a.cc: In function 'int main()': a.cc:26:17: error: break statement not within loop or switch 26 | break; | ^~~~~ a.cc:30:17: error: break statement not within loop or switch 30 | break; | ^~~~~ a.cc: At global scope: a.cc:127:1: error: expected declaration before '}' token 127 | } | ^
s513272270
p00448
C++
#include <iostream> #include <stdio.h> #include <string.h> #include <string> #include <functional> #include <algorithm> #include <string> #include <vector> #include <algorithm> #include <time.h> #include <stdlib.h> #include <math.h> using namespace std; int main (void) { long C,c,n,m,a[10000][10000],z[10000],o[10000]; C = 0; c = 0; cin >> n >> m; c++; if (n == 0 && m == 0) { break; } if (c > 5) { break; } for (long i = 0; i < m; i++) //????????? { z[i] = 0; o[i] = 0; } for (long i = 0; i < m; i++) { for (long j = 0; j < n; j++) { cin >> a[j][i]; if (a[j][i] == 0) { z[i] += 1; } else { o[i] += 1; } } } for (long i = 0; i < m; i++) { if (z[i] < o[i]) { for (long j = 0; j < n; j++) { if (a[j][i] == 0) { a[j][i] = 0; a[j][i] = 1; } else if (a[j][i] == 1) { a[j][i] = 0; } } } } for (long i = 0; i < m; i++) //????????? { z[i] = 0; o[i] = 0; } for (long j = 0; j < n; j++) { for (long i = 0; i < m; i++) { if (a[j][i] == 0) { z[j] += 1; } else if (a[j][i] == 1) { o[j] += 1; } } } for (long j = 0; j < n; j++) { if (z[j] < o[j]) { for (long i = 0; i < m; i++) { if (a[j][i] == 0) { a[j][i] = 1; } else if (a[j][i] == 1) { a[j][i] = 0; } } } } for (long j = 0; j < n; j++) { for (long i = 0; i < m; i++) { if (a[j][i] == 0) { C += 1; } } } cout << C << endl; C = 0; } }
a.cc: In function 'int main()': a.cc:26:17: error: break statement not within loop or switch 26 | break; | ^~~~~ a.cc:30:17: error: break statement not within loop or switch 30 | break; | ^~~~~ a.cc: At global scope: a.cc:127:1: error: expected declaration before '}' token 127 | } | ^
s187104206
p00448
C++
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cmath> #include <map> #include <stack> #include <queue> #include <cstdio> #include <cstdlib> using namespace std; int a[102][10002], f[10], n, m; int calc(int f[10]){ int ans = 0; for(int i = 0;i < m;i++){ int res = 0; for(int j = 0;j < n;j++){ if(f[j])res += !a[j][i]; else res += a[j][i]; } ans += max(res, n-res); } return ans; } int solve(int k, int b){ if(k == n)return 0; int a[3]; for(int i = 0;i < 10;i++)f[i] = c[i]; f[k] = b; a[0] = calc(f); a[1] = solve(k+1, 0); a[2] = solve(k+1, 1); sort(a, a+3); return a[2]; } int main(){ while(cin >> n >> m, n){ for(int i = 0;i < n;i++) for(int j = 0;j < m;j++)cin >> a[i][j]; int x, y; fill(f, f+10, 0); x = solve(0, 0); y = solve(0, 1); cout << max(x, y) << endl; } return 0; }
a.cc: In function 'int solve(int, int)': a.cc:31:41: error: 'c' was not declared in this scope 31 | for(int i = 0;i < 10;i++)f[i] = c[i]; | ^
s520428569
p00448
C++
#include <iostream> #include <algorithm> using namespace std; const int MAX_R=10; const int MAX_C=10000; int pan[MAX_R][MAX_C]; int r,c; void reverse(int row){ for(int i=0; i<c; i++){ if(pan[row][i]==0) pan[row][i]=1; else pan[row][i]=0; } } int dfs(int row, int rev){ if(rev) reverse(row); if(row==(r-1)){ if(rev) reverse(row); int cnt=0; int a,b; for(int j=0; j<c; j++){ for(int i=0; i<r; j++){ if(pan[i][j]==1) a++; } b=r-a; b>a?(cnt+=b):(cnt+=a); } return cnt; } a=dfs(row+1, 0); b=dfs(row+1, 1); if(rev) reverse(row); return a>b?a:b; } int solve(){ int a=dfs(0,0); int b=dfs(0,1); return a>b?a:b; } int main(){ while((cin>>r)&&(cin>>c)&&(r>0)){ for(int i=0; i<r; i++){ for(int j=0; j<c; j++){ cin>>pan[i][j]; } } cout<<solve()<<endl; } }
a.cc: In function 'int dfs(int, int)': a.cc:34:5: error: 'a' was not declared in this scope 34 | a=dfs(row+1, 0); | ^ a.cc:35:5: error: 'b' was not declared in this scope 35 | b=dfs(row+1, 1); | ^
s705626067
p00448
C++
/*直接对行用dfs:TLE*/ #include <iostream> #include <algorithm> using namespace std; const int MAX_R=10; const int MAX_C=10000; int pan[MAX_R][MAX_C]; int r,c; void reverse(int row){ for(int i=0; i<c; i++){ if(pan[row][i]==0) pan[row][i]=1; else pan[row][i]=0; } } int dfs(int row){ if(rev) reverse(row); if(row==(r-1)){ if(rev) reverse(row); int cnt=0; int a,b; for(int j=0; j<c; j++){ for(int i=0; i<r; j++){ if(pan[i][j]==1) a++; } b=r-a; b>a?(cnt+=b):(cnt+=a); } return cnt; } int a=dfs(row+1); reverse(row); int b=dfs(row+1); return a>b?a:b; } int solve(){ return dfs(0); } int main(){ while((cin>>r)&&(cin>>c)&&(r>0)){ for(int i=0; i<r; i++){ for(int j=0; j<c; j++){ cin>>pan[i][j]; } } cout<<solve()<<endl; } }
a.cc: In function 'int dfs(int)': a.cc:21:8: error: 'rev' was not declared in this scope 21 | if(rev) reverse(row); | ^~~ a.cc:23:12: error: 'rev' was not declared in this scope 23 | if(rev) reverse(row); | ^~~
s460545930
p00448
C++
#include <iostream> #include <algorithm> using namespace std; const int MAX_R=10; const int MAX_C=10000; int pan[MAX_R][MAX_C]; int r,c; void reverse(int row){ for(int i=0; i<c; i++){ if(pan[row][i]==0) pan[row][i]=1; else pan[row][i]=0; } } int dfs(int row){ if(row==(r-1)){ if(rev) reverse(row); int cnt=0; int a,b; for(int j=0; j<c; j++){ for(int i=0; i<r; j++){ if(pan[i][j]==1) a++; } b=r-a; b>a?(cnt+=b):(cnt+=a); } return cnt; } int a=dfs(row+1); reverse(row); int b=dfs(row+1); return a>b?a:b; } int solve(){ return dfs(0); } int main(){ while((cin>>r)&&(cin>>c)&&(r>0)){ for(int i=0; i<r; i++){ for(int j=0; j<c; j++){ cin>>pan[i][j]; } } cout<<solve()<<endl; } }
a.cc: In function 'int dfs(int)': a.cc:21:12: error: 'rev' was not declared in this scope 21 | if(rev) reverse(row); | ^~~
s319568812
p00448
C++
#include<iostream> #include<cstring> #include<cstdio> #include<cmath> #include<algorithm> using namespace std; bool s[15][10005]= {0}; int n, m; int dfs(int x) { if(x==n+1) { int sum=0; int term=0; for(int j=1;j<=m;j++) { for(int i=1;i<=n;i++) if(s[i][j]==1)term++; sum += term > n-term ? term : n-term; term=0; } return sum; } int a=dfs(x+1); for(int i=1;i<=m;i++) s[x][i]=!s[x][i]; int b=dfs(x+1); return a>b?a:b; } int main() { //freopen("in.in","r",stdin); while(scanf("%d%d",&n,&m)!=EOF) { if(n==0&&m==0)break; ans=0; for(int i=1; i<=n; i++) for(int j=1; j<=m; j++) scanf("%d",&s[i][j]); dfs(1); printf("%d\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:41:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 41 | ans=0; | ^~~ | abs
s370305668
p00448
C++
#include<iostream> #include<cstring> #include<cstdio> #include<cmath> #include<algorithm> using namespace std; bool s[15][10005]= {0}; int n, m; void reverse(int row){ for(int i=1; i<=c; i++){ if(s[row][i]==0) s[row][i]=1; else s[row][i]=0; } } int dfs(int x) { if(x==n+1) { int sum=0; int term=0; for(int j=1;j<=m;j++) { for(int i=1;i<=n;i++) if(s[i][j]==1)term++; sum += term > n-term ? term : n-term; term=0; } return sum; } int a=dfs(x+1); reverse(x); //for(int i=1;i<=m;i++) // s[x][i]=!s[x][i]; int b=dfs(x+1); return a>b?a:b; } int main() { //freopen("in.in","r",stdin); while(scanf("%d%d",&n,&m)!=EOF) { if(n==0&&m==0)break; for(int i=1; i<=n; i++) for(int j=1; j<=m; j++) scanf("%d",&s[i][j]); cout<<dfs(1)<<endl; } return 0; }
a.cc: In function 'void reverse(int)': a.cc:14:21: error: 'c' was not declared in this scope 14 | for(int i=1; i<=c; i++){ | ^
s922620361
p00448
C++
#include<iostream> #include<cstring> #include<cstdio> #include<cmath> #include<algorithm> using namespace std; bool s[15][10005]= {0}; int n, m; void reverse(int row){ for(int i=1; i<=m; i++){ if(s[row][i]==0) s[row][i]=1; else s[row][i]=0; } } int dfs(int x) { if(x==n+1) { int sum=0; int term=0; for(int j=1;j<=m;j++) { for(int i=1;i<=n;i++) if(s[i][j]==1)term++; //sum += term > n-term ? term : n-term; tern>n-tern?(sum+=term):(sum+=(n-term)); term=0; } return sum; } int a=dfs(x+1); reverse(x); //for(int i=1;i<=m;i++) // s[x][i]=!s[x][i]; int b=dfs(x+1); return a>b?a:b; } int main() { //freopen("in.in","r",stdin); while(scanf("%d%d",&n,&m)!=EOF) { if(n==0&&m==0)break; for(int i=1; i<=n; i++) for(int j=1; j<=m; j++) scanf("%d",&s[i][j]); cout<<dfs(1)<<endl; } return 0; }
a.cc: In function 'int dfs(int)': a.cc:31:13: error: 'tern' was not declared in this scope; did you mean 'term'? 31 | tern>n-tern?(sum+=term):(sum+=(n-term)); | ^~~~ | term
s233557319
p00448
C++
#include <algorithm> #include <cstdio> using namespace std; const int MAX_R=15; const int MAX_C=10005; bool pan[MAX_R][MAX_C]={0}; int r,c; void reverse(int row){ for(int i=0; i<c; i++){ if(pan[row][i]==0) pan[row][i]=1; else pan[row][i]=0; } } int dfs(int row){ if(row==r){ int cnt=0; int a,b; for(int j=0; j<c; j++){ a=0; for(int i=0; i<r; j++){ if(pan[i][j]==1) a++; } b=r-a; a>r-a?(cnt+=a):(cnt+=(r-a)); } return cnt; } int a=dfs(row+1); reverse(row); int b=dfs(row+1); return a>b?a:b; } int main(){ while((scanf("%d%d", &r, &c)!=EOF)){ if(r==0&&c==0) break; for(int i=0; i<r; i++){ for(int j=0; j<c; j++){ cin>>pan[i][j]; } } cout<<dfs(0)<<endl; } }
a.cc: In function 'int main()': a.cc:43:17: error: 'cin' was not declared in this scope 43 | cin>>pan[i][j]; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <cstdio> +++ |+#include <iostream> 3 | using namespace std; a.cc:46:9: error: 'cout' was not declared in this scope 46 | cout<<dfs(0)<<endl; | ^~~~ a.cc:46:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:46:23: error: 'endl' was not declared in this scope 46 | cout<<dfs(0)<<endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <cstdio> +++ |+#include <ostream> 3 | using namespace std;
s321846575
p00448
C++
a
a.cc:1:1: error: 'a' does not name a type 1 | a | ^
s074552914
p00448
C++
6
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 6 | ^
s216706363
p00448
C++
#include<stdio.h> #include<algorithm.h> int n,m; int sen[10][10000]; int maxi; void saiki(int dep){ if(dep>=m){ int cont=0; for(int i=0;i<m;i++){ int con[2]; con[0]=0;con[1]=0; for(int j=0;j<n;j++){ con[sen[j][i]]++; } cont+=max(con[0],con[1]); } if(cont>maxi){ maxi=cont; } return; } saiki(dep+1); for(int i=0;i<m;i++){ if(sen[dep][i]==0){ sen[dep][i]=1; }else{ sen[dep][i]=0; } } saiki(dep+1); for(int i=0;i<m;i++){ if(sen[dep][i]==0){ sen[dep][i]=1; }else{ sen[dep][i]=0; } } } int main(){ while(1){ scanf("%d%d",&n,&m); if(n==0 && m==0){ break; } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ scanf("%d",&sen[i][j]); } } maxi=0; saiki(0); printf("%d\n",maxi); } }
a.cc:2:9: fatal error: algorithm.h: No such file or directory 2 | #include<algorithm.h> | ^~~~~~~~~~~~~ compilation terminated.
s118570602
p00448
C++
#include<stdio.h> #include<algorithm> int n,m; int sen[10][10000]; int maxi; void saiki(int dep){ if(dep>=m){ int cont=0; for(int i=0;i<m;i++){ int con[2]; con[0]=0;con[1]=0; for(int j=0;j<n;j++){ con[sen[j][i]]++; } cont+=max(con[0],con[1]); } if(cont>maxi){ maxi=cont; } return; } saiki(dep+1); for(int i=0;i<m;i++){ if(sen[dep][i]==0){ sen[dep][i]=1; }else{ sen[dep][i]=0; } } saiki(dep+1); for(int i=0;i<m;i++){ if(sen[dep][i]==0){ sen[dep][i]=1; }else{ sen[dep][i]=0; } } } int main(){ while(1){ scanf("%d%d",&n,&m); if(n==0 && m==0){ break; } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ scanf("%d",&sen[i][j]); } } maxi=0; saiki(0); printf("%d\n",maxi); } }
a.cc: In function 'void saiki(int)': a.cc:17:31: error: 'max' was not declared in this scope; did you mean 'std::max'? 17 | cont+=max(con[0],con[1]); | ^~~ | std::max In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~
s127884164
p00448
C++
#include<stdio.h> int r,c,s[10][10000],n; int f(int d[10][10000],bool t[10]){ int max=0,i,j,jk; for(i=0;i<r;i++){ if(t[i]){ for(j=0;j<c;j++){ d[i][j]= 1-d[i][j]; } } } for(i=0;i<r;i++){ jk=0; for(j=0;j<c;j++){ jk+=d[i][j]; } if(jk>c-jk) max+=jk; else max+=c-jk; } return max; } void search(bool turn[10],int k){ if(r==k){ int o; o=f(s,turn); if(o>n)n=o; } else{ turn[k]=true; search(turn,k+1); turn[k]=false; search(turn,k+1); } } void main(){ int i,j; bool b[10]; for(;;){ scanf("%d%d",&r,&c); if(!r && !c)break; n=0; for(i=0;i<r;i++) for(j=0;j<c;j++) scanf("%d",&s[i][j]); search(b,0); printf("%d\n",n+3); } }
a.cc:38:1: error: '::main' must return 'int' 38 | void main(){ | ^~~~
s436208429
p00448
C++
%23include%20%3Ciostream%3E%0Ausing%20namespace%20std;%0A%0Aint%20r,%20c;%0Aint%20s[10][10000];%0A%0Aint%20rec(int%20step)%0A%7B%0A%0A%20%20%20%20int%20ret%20=%200;%0A%20%20%20%20if(step%20==%20r)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20int%20t%20=%200;%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20t%20+=%20s[i][j];%0A%20%20%20%20%20%20%20%20%20%20%20%20ret%20+=%20max(t,%20r%20-%20t);%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%7D%0A%0A%20%20%20%20return%20ret;%0A%7D%0A%0Aint%20main()%0A%7B%0A%20%20%20%20while(cin%20%3E%3E%20r%20%3E%3E%20c%20&&%20r%20&&%20c)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cin%20%3E%3E%20s[i][j];%0A%0A%20%20%20%20%20%20%20%20cout%20%3C%3C%20rec(0)%20%3C%3C%20endl;%0A%20%20%20%20%7D%0A%7D%0A
a.cc:1:26: error: exponent has no digits 1 | %23include%20%3Ciostream%3E%0Ausing%20namespace%20std;%0A%0Aint%20r,%20c;%0Aint%20s[10][10000];%0A%0Aint%20rec(int%20step)%0A%7B%0A%0A%20%20%20%20int%20ret%20=%200;%0A%20%20%20%20if(step%20==%20r)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20int%20t%20=%200;%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20t%20+=%20s[i][j];%0A%20%20%20%20%20%20%20%20%20%20%20%20ret%20+=%20max(t,%20r%20-%20t);%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%7D%0A%0A%20%20%20%20return%20ret;%0A%7D%0A%0Aint%20main()%0A%7B%0A%20%20%20%20while(cin%20%3E%3E%20r%20%3E%3E%20c%20&&%20r%20&&%20c)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cin%20%3E%3E%20s[i][j];%0A%0A%20%20%20%20%20%20%20%20cout%20%3C%3C%20rec(0)%20%3C%3C%20endl;%0A%20%20%20%20%7D%0A%7D%0A | ^~ a.cc:1:1: warning: large fixed-point constant implicitly truncated to fixed-point type [-Woverflow] 1 | %23include%20%3Ciostream%3E%0Ausing%20namespace%20std;%0A%0Aint%20r,%20c;%0Aint%20s[10][10000];%0A%0Aint%20rec(int%20step)%0A%7B%0A%0A%20%20%20%20int%20ret%20=%200;%0A%20%20%20%20if(step%20==%20r)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20int%20t%20=%200;%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20t%20+=%20s[i][j];%0A%20%20%20%20%20%20%20%20%20%20%20%20ret%20+=%20max(t,%20r%20-%20t);%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%7D%0A%0A%20%20%20%20return%20ret;%0A%7D%0A%0Aint%20main()%0A%7B%0A%20%20%20%20while(cin%20%3E%3E%20r%20%3E%3E%20c%20&&%20r%20&&%20c)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cin%20%3E%3E%20s[i][j];%0A%0A%20%20%20%20%20%20%20%20cout%20%3C%3C%20rec(0)%20%3C%3C%20endl;%0A%20%20%20%20%7D%0A%7D%0A | ^ a.cc:1:1: warning: large fixed-point constant implicitly truncated to fixed-point type [-Woverflow] a.cc:1:1: warning: large fixed-point constant implicitly truncated to fixed-point type [-Woverflow] a.cc:1:1: warning: large fixed-point constant implicitly truncated to fixed-point type [-Woverflow] a.cc:1:604: error: exponent has no digits 1 | %23include%20%3Ciostream%3E%0Ausing%20namespace%20std;%0A%0Aint%20r,%20c;%0Aint%20s[10][10000];%0A%0Aint%20rec(int%20step)%0A%7B%0A%0A%20%20%20%20int%20ret%20=%200;%0A%20%20%20%20if(step%20==%20r)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20int%20t%20=%200;%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20t%20+=%20s[i][j];%0A%20%20%20%20%20%20%20%20%20%20%20%20ret%20+=%20max(t,%20r%20-%20t);%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%7D%0A%0A%20%20%20%20return%20ret;%0A%7D%0A%0Aint%20main()%0A%7B%0A%20%20%20%20while(cin%20%3E%3E%20r%20%3E%3E%20c%20&&%20r%20&&%20c)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cin%20%3E%3E%20s[i][j];%0A%0A%20%20%20%20%20%20%20%20cout%20%3C%3C%20rec(0)%20%3C%3C%20endl;%0A%20%20%20%20%7D%0A%7D%0A | ^~~~~~ a.cc:1:1196: error: exponent has no digits 1 | %23include%20%3Ciostream%3E%0Ausing%20namespace%20std;%0A%0Aint%20r,%20c;%0Aint%20s[10][10000];%0A%0Aint%20rec(int%20step)%0A%7B%0A%0A%20%20%20%20int%20ret%20=%200;%0A%20%20%20%20if(step%20==%20r)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20int%20t%20=%200;%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20t%20+=%20s[i][j];%0A%20%20%20%20%20%20%20%20%20%20%20%20ret%20+=%20max(t,%20r%20-%20t);%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%7D%0A%0A%20%20%20%20return%20ret;%0A%7D%0A%0Aint%20main()%0A%7B%0A%20%20%20%20while(cin%20%3E%3E%20r%20%3E%3E%20c%20&&%20r%20&&%20c)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cin%20%3E%3E%20s[i][j];%0A%0A%20%20%20%20%20%20%20%20cout%20%3C%3C%20rec(0)%20%3C%3C%20endl;%0A%20%20%20%20%7D%0A%7D%0A | ^~ a.cc:1:1199: error: exponent has no digits 1 | %23include%20%3Ciostream%3E%0Ausing%20namespace%20std;%0A%0Aint%20r,%20c;%0Aint%20s[10][10000];%0A%0Aint%20rec(int%20step)%0A%7B%0A%0A%20%20%20%20int%20ret%20=%200;%0A%20%20%20%20if(step%20==%20r)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20int%20t%20=%200;%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20t%20+=%20s[i][j];%0A%20%20%20%20%20%20%20%20%20%20%20%20ret%20+=%20max(t,%20r%20-%20t);%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%20%20%20%20ret%20=%20max(ret,%20rec(step%20+%201));%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%0A%20%20%20%20%20%20%20%20%20%20%20%20s[step][j]%20=%20(s[step][j]%20+%201)%20%25%202;%0A%20%20%20%20%7D%0A%0A%20%20%20%20return%20ret;%0A%7D%0A%0Aint%20main()%0A%7B%0A%20%20%20%20while(cin%20%3E%3E%20r%20%3E%3E%20c%20&&%20r%20&&%20c)%20%7B%0A%20%20%20%20%20%20%20%20for(int%20i%20=%200;%20i%20%3C%20r;%20i++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20for(int%20j%20=%200;%20j%20%3C%20c;%20j++)%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cin%20%3E%3E%20s[i][j];%0A%0A%20%20%2
s912747532
p00448
C++
#include<string.h> #include<math.h> #include<algorithm> #include<cstring> #include<queue> using namespace std; #define INF 10000000 int max(int a,int b){ if(a>b){ return a; }else{ return b; } } int main(){ while(1){ int senbei[10][1000]; int r,c,i,count,a,ans=0; int d[10]; cin>>r>>c; if(r==0&&c==0)break; for(i=0;i<r;i++){ d[i]=0; for(int j=0;j<c;j++){ cin>>senbei[i][j]; } } for (int i = 0; i < (1 << r); i++) { a=0; for (int j = 0; j < r; j++) { d[j]=((i >> j) & 1); } for(int j=0;j<c;j++){ count=0; for(int k=0;k<r;k++){ if(senbei[k][j]==d[k]){ count++; } } if(count>r/2){ a+=count; }else{ a+=(r-count); } } ans=max(ans,a); } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:21:17: error: 'cin' was not declared in this scope 21 | cin>>r>>c; | ^~~ a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 5 | #include<queue> +++ |+#include <iostream> 6 | using namespace std; a.cc:50:17: error: 'cout' was not declared in this scope 50 | cout<<ans<<endl; | ^~~~ a.cc:50:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:50:28: error: 'endl' was not declared in this scope 50 | cout<<ans<<endl; | ^~~~ a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 5 | #include<queue> +++ |+#include <ostream> 6 | using namespace std;
s982209739
p00448
C++
#include <cstdio> #include <algorithm> using namespace std; int main() { while(true) { int r, c; int fld[10000] = {0}; scanf("%d%d", &r, &c); if(r == 0) break; for(int i = 0; i < r; ++i) { for(int j = 0; j < c; ++j) { int t; scanf("%d", %t); fld[j] |= t << i; } } int ans = 0; for(int bit = 0; bit < (1 << r); ++bit) { int sum = 0; for(int i = 0; i < c; ++i) { int f = fld[i] ^ bit; int x = 0; for(int j = 0; j < r; ++j) x += (f >> j) & 1; sum += max(x, r - x); } ans = max(ans, sum); } printf("%d\n", ans); } return 0; }
a.cc: In function 'int main()': a.cc:16:13: error: expected primary-expression before '%' token 16 | scanf("%d", %t); | ^
s415972416
p00448
C++
using System; class _0525 { static int h, w, count, maxCount; static int[,] Osenbei; static int[] power2 = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }; public static void Main() { string str = Console.ReadLine(); string[] data; while (str != "0 0") { h = 0; w = 0; maxCount = 0; data = str.Split(); h = int.Parse(data[0]); w = int.Parse(data[1]); Osenbei = new int[h, w]; for (int i = 0; i < h; i++) { str = Console.ReadLine(); for (int j = 0; j < w; j++) Osenbei[i, j] = int.Parse(str.Split()[j]); } Judge(); Console.WriteLine(maxCount); str = Console.ReadLine(); } } public static void Judge() { int[] countBlack = new int[w]; for (int i = 0; i < power2[h]; i++) { count = 0; for (int j = 0; j < w; j++) countBlack[j] = 0; for (int j = 0; j < h; j++) { if ((i & power2[j]) == power2[j]) for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 0 ? 1 : 0; else for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 1 ? 1 : 0; } for (int j = 0; j < w; j++) { if (countBlack[j] > h / 2) count += countBlack[j]; else count += h - countBlack[j]; } if (maxCount < count) maxCount = count; if (maxCount == h * w) return; } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:5:15: error: expected unqualified-id before '[' token 5 | static int[,] Osenbei; | ^ a.cc:6:15: error: expected unqualified-id before '[' token 6 | static int[] power2 = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }; | ^ a.cc:7:11: error: expected ':' before 'static' 7 | public static void Main() | ^~~~~~~ | : a.cc:27:11: error: expected ':' before 'static' 27 | public static void Judge() | ^~~~~~~ | : a.cc:48:2: error: expected ';' after class definition 48 | } | ^ | ; a.cc: In static member function 'static void _0525::Main()': a.cc:9:9: error: 'string' was not declared in this scope 9 | string str = Console.ReadLine(); | ^~~~~~ a.cc:10:16: error: expected primary-expression before ']' token 10 | string[] data; | ^ a.cc:11:16: error: 'str' was not declared in this scope; did you mean 'std'? 11 | while (str != "0 0") | ^~~ | std a.cc:14:13: error: 'data' was not declared in this scope 14 | data = str.Split(); | ^~~~ a.cc:15:17: error: expected primary-expression before 'int' 15 | h = int.Parse(data[0]); w = int.Parse(data[1]); | ^~~ a.cc:15:41: error: expected primary-expression before 'int' 15 | h = int.Parse(data[0]); w = int.Parse(data[1]); | ^~~ a.cc:16:13: error: 'Osenbei' was not declared in this scope 16 | Osenbei = new int[h, w]; | ^~~~~~~ a.cc:19:23: error: 'Console' was not declared in this scope 19 | str = Console.ReadLine(); | ^~~~~~~ a.cc:20:61: error: expected primary-expression before 'int' 20 | for (int j = 0; j < w; j++) Osenbei[i, j] = int.Parse(str.Split()[j]); | ^~~ a.cc:23:13: error: 'Console' was not declared in this scope 23 | Console.WriteLine(maxCount); | ^~~~~~~ a.cc: In static member function 'static void _0525::Judge()': a.cc:29:12: error: structured binding declaration cannot have type 'int' 29 | int[] countBlack = new int[w]; | ^~ a.cc:29:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:29:12: error: empty structured binding declaration a.cc:29:15: error: expected initializer before 'countBlack' 29 | int[] countBlack = new int[w]; | ^~~~~~~~~~ a.cc:30:29: error: 'power2' was not declared in this scope 30 | for (int i = 0; i < power2[h]; i++) | ^~~~~~ a.cc:33:41: error: 'countBlack' was not declared in this scope 33 | for (int j = 0; j < w; j++) countBlack[j] = 0; | ^~~~~~~~~~ a.cc:36:79: error: 'countBlack' was not declared in this scope 36 | if ((i & power2[j]) == power2[j]) for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 0 ? 1 : 0; | ^~~~~~~~~~ a.cc:36:96: error: 'Osenbei' was not declared in this scope 36 | if ((i & power2[j]) == power2[j]) for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 0 ? 1 : 0; | ^~~~~~~ a.cc:37:50: error: 'countBlack' was not declared in this scope 37 | else for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 1 ? 1 : 0; | ^~~~~~~~~~ a.cc:37:67: error: 'Osenbei' was not declared in this scope 37 | else for (int k = 0; k < w; k++) countBlack[k] += Osenbei[j, k] == 1 ? 1 : 0; | ^~~~~~~ a.cc:41:21: error: 'countBlack' was not declared in this scope 41 | if (countBlack[j] > h / 2) count += countBlack[j]; | ^~~~~~~~~~
s195166313
p00448
C++
#include <iostream> using namespace std; const int MAX_R = 10, MAX_C = 10000; int osenbei[MAX_R][MAX_C]; int tosenbei[MAX_R][MAX_C]; int R, C; int A; void dfs(int depth, int turn){ if(depth == R){ int a = 0; memcpy(tosenbei, osenbei, sizeof(osenbei)); for(int i=0; i<R; i++){ if(turn & 1<<i){ int *row = tosenbei[i]; for(int j=0; j<C; j++) row[j] ^= 1; } } for(int i=0; i<C; i++){ int s = 0; for(int j=0; j<R; j++) s += tosenbei[j][i]; a += max(s, R-s); } A = max(a, A); }else{ dfs(depth + 1, turn); dfs(depth + 1, turn ^ (1<<depth)); } } void solve(){ A = 0; dfs(0, 0); cout << A << endl; } int main(){ while(scanf("%d %d", &R, &C), R|C){ for(int i=0; i<R; i++) for(int j=0; j<C; j++) scanf("%d", &osenbei[i][j]); solve(); } return 0; }
a.cc: In function 'void dfs(int, int)': a.cc:14:9: error: 'memcpy' was not declared in this scope 14 | memcpy(tosenbei, osenbei, sizeof(osenbei)); | ^~~~~~ a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 |
s091706316
p00448
C++
#include <cstdio> #include <iostream> #include <algorithm> #include <cstdlib> #include <vector> #include <queue> #include <map> #include <functional> #include <cstring> using namespace std; int main(){ int h,w; while(scanf("%d%d",&h,&w),(h|w)){ bool field[16][100010] = {{0}}; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ int a; scanf("%d",&a); field[i][j] = a == 1; } } int ans = 0; for(int i = 0; i < (1 << h); i++){ bool board[16][100010]; for(int j = 0; j < h; j++){ //j陦檎岼繧偵?縺」縺上j霑斐☆縺ェ繧? if(i & (1 << j)){ for(int k = 0; k < w; k++){ board[j][k] = !field[j][k]; } } else{ for(int k = 0; k < w; k++){ board[j][k] = field[j][k]; } } } for(int j = 0; j < w; j++){ int black = 0,white = 0; for(int k = 0; k < h; k++){ if(board[k][j]) black++; else white++; } if(black > white){ for(int k = 0; k < h; k++){ board[k][j] = !board[k][j]; } } } int cnt = 0; for(int j = 0; j < h; j++){ for(int k = 0; k < w; k++){ if(!board[j][k])cnt++; } } ans = max(ans,cnt); } printf("%d\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:31:33: error: 'else' without a previous 'if' 31 | else{ | ^~~~ a.cc:33:55: error: 'j' was not declared in this scope 33 | board[j][k] = field[j][k]; | ^ a.cc:40:44: error: 'board' was not declared in this scope 40 | if(board[k][j]) black++; | ^~~~~ a.cc:45:49: error: 'board' was not declared in this scope 45 | board[k][j] = !board[k][j]; | ^~~~~ a.cc:52:45: error: 'board' was not declared in this scope 52 | if(!board[j][k])cnt++; | ^~~~~ a.cc:57:31: error: 'ans' was not declared in this scope; did you mean 'abs'? 57 | printf("%d\n",ans); | ^~~ | abs a.cc: At global scope: a.cc:59:5: error: expected unqualified-id before 'return' 59 | return 0; | ^~~~~~ a.cc:60:1: error: expected declaration before '}' token 60 | } | ^
s285688163
p00449
Java
import java.util.*; public class P0526{ int[][] M = new int[101][101]; int [] d = new int[101]; int[] flg = new int[101]; int a,n,m,c,e,k,min,z; public void compute(){ Scanner scan = new Scanner(System.in); for(int i=0;i<101;i++){ for(int j=0;j<101;j++){ M[i][j]=99999999; } d[i]=99999999; flg[i]=0; } n=scan.nextInt(); k=scan.nextInt(); for(int i=0;i<k;i++){ a=scan.nextInt(); if(a==0){ c=scan.nextInt(); e=scan.nextInt(); for(int j=1;j<=n;j++){ d[j]=99999999; flg[j]=0; } d[c]=0; while(true){ min=99999999; for(int j=1;j<=n;j++){ if(d[j]<min&&flg[j]==0){ min=d[j]; m=j; } } if(min==99999999)break; flg[m]=1; for(int j=1;j<=n;j++){ if(d[j]>d[m]+M[m][j]){ d[j]=d[m]+M[m][j]; } } } if(d[e]==99999999){ System.out.println(-1); }else{ System.out.println(d[e]); } }else{ c=scan.nextInt(); e=scan.nextInt(); z=scan.nextInt(); if(M[c][e]>z){ M[c][e]=z; M[e][c]=z; } } } } public static void main(String[] args){ P0526 p = new P0526(); p.compute(); } }
Main.java:2: error: class P0526 is public, should be declared in a file named P0526.java public class P0526{ ^ 1 error
s210702650
p00449
Java
import java.util.*; public class Main{ int max =(1<<27); int[][] M = new int[101][101]; int [] d = new int[101]; int[] flg = new int[101]; int a,n,m,c,e,k,min,z; public void compute(){ Scanner scan = new Scanner(System.in); for(int i=0;i<101;i++){ for(int j=0;j<101;j++){ M[i][j]=; } d[i]=max; flg[i]=0; } n=scan.nextInt(); k=scan.nextInt(); for(int i=0;i<k;i++){ a=scan.nextInt(); if(a==0){ c=scan.nextInt(); e=scan.nextInt(); for(int j=1;j<=n;j++){ d[j]=max; flg[j]=0; } d[c]=0; while(true){ min=max; for(int j=1;j<=n;j++){ if(d[j]<min&&flg[j]==0){ min=d[j]; m=j; } } if(min==max)break; flg[m]=1; for(int j=1;j<=n;j++){ if(d[j]>d[m]+M[m][j]){ d[j]=d[m]+M[m][j]; } } } if(d[e]==max){ System.out.println(-1); }else{ System.out.println(d[e]); } }else{ c=scan.nextInt(); e=scan.nextInt(); z=scan.nextInt(); if(M[c][e]>z){ M[c][e]=z; M[e][c]=z; } } } } public static void main(String[] args){ Main p = new Main(); p.compute(); } }
Main.java:12: error: illegal start of expression M[i][j]=; ^ 1 error
s109840761
p00449
C
#include<stdio.h> #include<string.h> long ship[100][100]; int main(){ int k,r,i,a,b,n,j; long p; while(1){ scanf("%d %d",&n,&k); if(n==0) break; memset(ship,8,sizeof(ship)); for(i=0;i<n;i++){ ship[i][i]=0; } for(i=0;i<k;i++){ scanf("%d",&r); if(r==0){ scanf("%d %d",&a,&b); printf("%ld\n",(ship[a-1][b-1]>100000001)?-1:ship[a-1][b-1]); }else{ scanf("%d %d %ld",&a,&b,&p); for(j=0;j<n;j++){ for(ii=0;ii<n;ii++){ if(ship[j][b-1]+p+ship[a-1][ii]<ship[j][ii]){ ship[j][ii]=ship[j][b-1]+p+ship[a-1][ii]; ship[ii][j]=ship[j][b-1]+p+ship[a-1][ii]; } if(ship[j][a-1]+p+ship[b-1][ii]<ship[j][ii]){ ship[j][ii]=ship[j][a-1]+p+ship[b-1][ii]; ship[ii][j]=ship[j][a-1]+p+ship[b-1][ii]; } } } } } } return 0; }
main.c: In function 'main': main.c:24:21: error: 'ii' undeclared (first use in this function); did you mean 'i'? 24 | for(ii=0;ii<n;ii++){ | ^~ | i main.c:24:21: note: each undeclared identifier is reported only once for each function it appears in
s073935461
p00449
C
#include<stdio.h> #define INF 1000000 int graph[101][101],n,c,d; void warshall_floyd(){ int i,j; for(i=1;i<=n;i++) for(j=1;j<=n;j++) graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]); } int min(int x,int y){ return x<y?x:y; } int main(){ int k,i,j,x,e,a,b; while(scanf("%d %d",&n,&k),n,k){ for(i=0;i<=n;i++) for(j=0;j<=n;j++) graph[i][j]=i==j?0:INF; for(i=0;i<k;i++){ if(scanf("%d",&x),x){ scanf("%d %d %d",&c,&d,&e); if(graph[c][d]>e){ graph[c][d]=e; graph[d][c]=e warshall_floyd(); } }else{ scanf("%d %d",&a,&b); printf(graph[a][b]>=INF?"-1\n":"%d\n",graph[a][b]); } } } return 0; }
main.c: In function 'warshall_floyd': main.c:9:31: error: implicit declaration of function 'min' [-Wimplicit-function-declaration] 9 | graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]); | ^~~ main.c: In function 'main': main.c:31:14: error: expected ';' before 'warshall_floyd' 31 | graph[d][c]=e | ^ | ; 32 | warshall_floyd(); | ~~~~~~~~~~~~~~
s595188722
p00449
C
#include<stdio.h> #define INF 1000000 int graph[101][101],n,c,d; void warshall_floyd(){ int i,j; for(i=1;i<=n;i++) for(j=1;j<=n;j++) graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]); } int min(int x,int y){ return x<y?x:y; } int main(){ int k,i,j,x,e,a,b; while(scanf("%d %d",&n,&k),n,k){ for(i=0;i<=n;i++){ for(j=0;j<=n;j++) graph[i][j]=INF; garph[i][i]=0; } for(i=0;i<k;i++){ if(scanf("%d",&x),x){ scanf("%d %d %d",&c,&d,&e); if(graph[c][d]>e){ graph[c][d]=e; graph[d][c]=e; warshall_floyd(); } }else{ scanf("%d %d",&a,&b); printf(graph[a][b]>=INF?"-1\n":"%d\n",graph[a][b]); } } } return 0; }
main.c: In function 'warshall_floyd': main.c:9:31: error: implicit declaration of function 'min' [-Wimplicit-function-declaration] 9 | graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]); | ^~~ main.c: In function 'main': main.c:24:7: error: 'garph' undeclared (first use in this function); did you mean 'graph'? 24 | garph[i][i]=0; | ^~~~~ | graph main.c:24:7: note: each undeclared identifier is reported only once for each function it appears in
s912989101
p00449
C
#include <iostream> #include <vector> #include <queue> #include <algorithm> #include <cstring> #define INF 1 << 29 using namespace std; typedef int Weight; struct Edge{ int src; int dst; Weight weight; Edge(int src, int dst, Weight weight): src(src), dst(dst), weight(weight){ } }; struct Node{ int index; Weight cost; int prev; Node(int index, Weight cost, int prev) : index(index), cost(cost), prev(prev){ } }; bool operator <(const Node &a, const Node &b){ if(a.cost == b.cost){ return a.index > b.index; }else{ return a.cost > b.cost; } } void dijkstra(int s, vector<Weight> &costs, vector<int> &prev, vector<vector<Edge> > &edges){ int n=costs.size(); priority_queue<Node> q; costs.assign(n,INF); prev.assign(n,-1); costs[s] = 0; q.push(Node(s,0,-2)); while(!q.empty()){ Node fix = q.top(); q.pop(); if(prev[fix.index] != -1) continue; costs[fix.index] = fix.cost; prev[fix.index] = fix.prev; for(int i=0;i<edges[fix.index].size();i++){ //foreach edge from fixed if(costs[edges[fix.index][i].dst] > costs[fix.index] + edges[fix.index][i].weight){ q.push(Node(edges[fix.index][i].dst, edges[fix.index][i].weight + costs[fix.index], fix.index)); } } } } int main(){ int n,k,req,a,b,c; cin >> n >> k; vector<Weight> costs(n); vector<int> prev(n); vector<vector<Edge> > edges(n); for(int i=0;i<k;i++){ cin >> req; if(req){ cin >> a >> b >> c; edges[a-1].push_back(Edge(a-1,b-1,c)); edges[b-1].push_back(Edge(b-1,a-1,c)); }else{ cin >> a >> b; dijkstra(a-1,costs,prev,edges); if(costs[b-1] == INF){ cout << -1 << endl; }else{ cout << costs[b-1] << endl; } } } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s186768596
p00449
C
#include <iostream> #include <vector> #include <queue> #include <algorithm> #include <cstring> #define INF 1 << 29 using namespace std; typedef int Weight; struct Edge{ int src; int dst; Weight weight; Edge(int src, int dst, Weight weight): src(src), dst(dst), weight(weight){ } }; struct Node{ int index; Weight cost; int prev; Node(int index, Weight cost, int prev) : index(index), cost(cost), prev(prev){ } }; bool operator <(const Node &a, const Node &b){ if(a.cost == b.cost){ return a.index > b.index; }else{ return a.cost > b.cost; } } void dijkstra(int s, vector<Weight> &costs, vector<int> &prev, vector<vector<Edge> > &edges){ int n=costs.size(); priority_queue<Node> q; costs.assign(n,INF); prev.assign(n,-1); costs[s] = 0; q.push(Node(s,0,-2)); while(!q.empty()){ Node fix = q.top(); q.pop(); if(prev[fix.index] != -1) continue; costs[fix.index] = fix.cost; prev[fix.index] = fix.prev; for(int i=0;i<edges[fix.index].size();i++){ //foreach edge from fixed if(costs[edges[fix.index][i].dst] > costs[fix.index] + edges[fix.index][i].weight){ q.push(Node(edges[fix.index][i].dst, edges[fix.index][i].weight + costs[fix.index], fix.index)); } } } } int main(){ int n,k,req,a,b,c; cin >> n >> k; vector<Weight> costs(n); vector<int> prev(n); vector<vector<Edge> > edges(n); for(int i=0;i<k;i++){ cin >> req; if(req){ cin >> a >> b >> c; bool isexist = false; for(int j=0;j<edges[a-1].size();j++){ if(edges[a-1][j].dst == b-1 && edges[a-1][j].weight > c){ edges[a-1][j].weight = c; isexist = true; } } if(!isexist){ edges[a-1].push_back(Edge(a-1,b-1,c)); } isexist = false; for(int j=0;j<edges[b-1].size();j++){ if(edges[b-1][j].dst == a-1 && edges[b-1][j].weight > c){ edges[b-1][j].weight = c; isexist = true; } } if(!isexist){ edges[b-1].push_back(Edge(b-1,a-1,c)); } }else{ cin >> a >> b; dijkstra(a-1,costs,prev,edges); if(costs[b-1] == INF){ cout << -1 << endl; }else{ cout << costs[b-1] << endl; } } } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s220636866
p00449
C
#include <iostream> #include <vector> #include <queue> #include <algorithm> #include <cstring> #define INF 1 << 29 using namespace std; typedef int Weight; struct Edge{ int src; int dst; Weight weight; Edge(int src, int dst, Weight weight): src(src), dst(dst), weight(weight){ } }; struct Node{ int index; Weight cost; int prev; Node(int index, Weight cost, int prev) : index(index), cost(cost), prev(prev){ } }; bool operator <(const Node &a, const Node &b){ if(a.cost == b.cost){ return a.index > b.index; }else{ return a.cost > b.cost; } } void dijkstra(int s, vector<Weight> &costs, vector<int> &prev, vector<vector<Edge> > &edges){ int n=costs.size(); priority_queue<Node> q; costs.assign(n,INF); prev.assign(n,-1); costs[s] = 0; q.push(Node(s,0,-2)); while(!q.empty()){ Node fix = q.top(); q.pop(); if(prev[fix.index] != -1) continue; costs[fix.index] = fix.cost; prev[fix.index] = fix.prev; for(int i=0;i<edges[fix.index].size();i++){ //foreach edge from fixed if(costs[edges[fix.index][i].dst] > costs[fix.index] + edges[fix.index][i].weight){ q.push(Node(edges[fix.index][i].dst, edges[fix.index][i].weight + costs[fix.index], fix.index)); } } } } int main(){ int n,k,req,a,b,c; while(cin >> n >> k){ if((n|k) == 0) break; vector<Weight> costs(n); vector<int> prev(n); vector<vector<Edge> > edges(n); for(int i=0;i<k;i++){ cin >> req; if(req){ cin >> a >> b >> c; bool isexist = false; for(int j=0;j<edges[a-1].size();j++){ if(edges[a-1][j].dst == b-1 && edges[a-1][j].weight > c){ edges[a-1][j].weight = c; isexist = true; } } if(!isexist){ edges[a-1].push_back(Edge(a-1,b-1,c)); } isexist = false; for(int j=0;j<edges[b-1].size();j++){ if(edges[b-1][j].dst == a-1 && edges[b-1][j].weight > c){ edges[b-1][j].weight = c; isexist = true; } } if(!isexist){ edges[b-1].push_back(Edge(b-1,a-1,c)); } }else{ cin >> a >> b; dijkstra(a-1,costs,prev,edges); if(costs[b-1] == INF){ cout << -1 << endl; }else{ cout << costs[b-1] << endl; } } } } }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s120996055
p00449
C++
#include<iostream> #include<queue> #include<vector> #define INF 1<<28 #define F first #define S second using namespace std; typedef pair < int, int > P; int ans[111]; int n; int solve(int a){ vector < P > g[111]; priority_queue < P, vector<P>, greater<P> > que; fill(ans, ans+n+1, INF); ans[a] = 0; que.push( P(0, a) ); while(!que.empty()){ P p = que.top(); que.pop(); if(ans[p.S] < p.F) continue; for(int i=0;i<g[p.S].size();i++){ P pp = g[p.S][i]; if(ans[pp.F] > ans[p.S] + pp.S){ ans[pp.F] = ans[p.S] + pp.S; que.push( P(ans[pp.F], pp.F) ); } } } } int main(){ int k; int q, a, b, c; while(true){ cin >> n >> k; if(!n && !k) break; while(k--){ cin >> q; if(q){ cin >> a >> b >> c; g[a].push_back( P(b, c) ); g[b].push_back( P(a, c) ); } else{ cin >> a >> b; solve(a); if(ans[b] == INF) cout << -1 << endl; else cout << ans[b] << endl; } } } }
a.cc: In function 'int solve(int)': a.cc:33:1: warning: no return statement in function returning non-void [-Wreturn-type] 33 | } | ^ a.cc: In function 'int main()': a.cc:49:11: error: 'g' was not declared in this scope 49 | g[a].push_back( P(b, c) ); | ^
s398406018
p00449
C++
#include<cstdio> #include<iostream> #include<algorithm> using namespace std; int n,k; int x,a,b,c,d,e; int f[100][100]; int fod() { int mi[100]; bool used[100]; for(int j=0;j<n;j++){ mi[j]=INT_MAX; used[j]=false; } mi[a-1]=0; while(true){ int v=-1; for(int j=0;j<n;j++){ if(!used[j]&&(v==-1||mi[j]<mi[v]))v=j; } if(v==-1)break; used[v]=true; bool z=false; for(int j=0;j<n;j++){ if(f[v][j]!=INT_MAX){ mi[j]=min(mi[j],mi[v]+f[v][j]); z=true; } } if(!z)break; } if(mi[b-1]==INT_MAX)return -1; return mi[b-1]; } int main() { for(;;){ scanf("%d%d",&n,&k); if(!n&&!k)return 0; for(int i=0;i<n;i++)for(int j=0;j<n;j++)f[i][j]=INT_MAX; for(int i=0;i<k;i++){ scanf("%d",&x); if(x==0){ scanf("%d%d",&a,&b); printf("%d\n",fod()); } else{ scanf("%d%d%d",&c,&d,&e); f[c-1][d-1]=min(f[c-1][d-1],e); f[d-1][c-1]=min(f[d-1][c-1],e); } } } }
a.cc: In function 'int fod()': a.cc:14:23: error: 'INT_MAX' was not declared in this scope 14 | mi[j]=INT_MAX; | ^~~~~~~ a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include<algorithm> +++ |+#include <climits> 4 | using namespace std; a.cc:28:37: error: 'INT_MAX' was not declared in this scope 28 | if(f[v][j]!=INT_MAX){ | ^~~~~~~ a.cc:28:37: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' a.cc:35:21: error: 'INT_MAX' was not declared in this scope 35 | if(mi[b-1]==INT_MAX)return -1; | ^~~~~~~ a.cc:35:21: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' a.cc: In function 'int main()': a.cc:43:65: error: 'INT_MAX' was not declared in this scope 43 | for(int i=0;i<n;i++)for(int j=0;j<n;j++)f[i][j]=INT_MAX; | ^~~~~~~ a.cc:43:65: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
s689868965
p00449
C++
#include<cstdio> #include<iostream> #include<algorithm> using namespace std; int n,k; int x,a,b,c,d,e; int f[100][100]; /*int INT_MAX=2147483467;*/ int fod() { int mi[100]; bool used[100]; for(int j=0;j<n;j++){ mi[j]=INT_MAX/3; used[j]=false; } mi[a-1]=0; while(true){ int v=-1; for(int j=0;j<n;j++){ if(!used[j]&&(v==-1||mi[j]<mi[v]))v=j; } if(v==-1)break; used[v]=true; bool z=false; for(int j=0;j<n;j++){ if(f[v][j]!=INT_MAX/3){ mi[j]=min(mi[j],mi[v]+f[v][j]); z=true; } } if(!z)break; } if(mi[b-1]==INT_MAX/3)return -1; return mi[b-1]; } int main() { for(;;){ scanf("%d%d",&n,&k); if(!n&&!k)return 0; for(int i=0;i<n;i++)for(int j=0;j<n;j++){ f[i][j]=INT_MAX; if(i==j)f[i][j]=0; } for(int i=0;i<k;i++){ scanf("%d",&x); if(x==0){ scanf("%d%d",&a,&b); printf("%d\n",fod()); } else{ scanf("%d%d%d",&c,&d,&e); f[c-1][d-1]=min(f[c-1][d-1],e); f[d-1][c-1]=min(f[d-1][c-1],e); } } } }
a.cc: In function 'int fod()': a.cc:14:23: error: 'INT_MAX' was not declared in this scope 14 | mi[j]=INT_MAX/3; | ^~~~~~~ a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 3 | #include<algorithm> +++ |+#include <climits> 4 | using namespace std; a.cc:28:37: error: 'INT_MAX' was not declared in this scope 28 | if(f[v][j]!=INT_MAX/3){ | ^~~~~~~ a.cc:28:37: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' a.cc:35:21: error: 'INT_MAX' was not declared in this scope 35 | if(mi[b-1]==INT_MAX/3)return -1; | ^~~~~~~ a.cc:35:21: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' a.cc: In function 'int main()': a.cc:44:33: error: 'INT_MAX' was not declared in this scope 44 | f[i][j]=INT_MAX; | ^~~~~~~ a.cc:44:33: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
s449093568
p00449
C++
#include<iostream> using namespace std; int INF=1e9; void dijkstra(int a,int b,int *mindist,int cost[101][101],bool *used,int n){ int cur,cur_spot; for(int i=0 ; i < 101 ; i++){ mindist[i]=INF; used[i]=0; } mindist[a]=0; for(int _=0 ; _ < n ; _++){ cur=INT_MAX; for(int i=1 ; i <= n ;i++){ if(mindist[i] <= cur && used[i] == 0){ cur = mindist[i]; cur_spot=i; } } used[cur_spot]=1; for(int i=1 ; i <= n ; i++){ if(cost[cur_spot][i] != -1){ if(mindist[i] > mindist[cur_spot]+cost[cur_spot][i]){ mindist[i]=mindist[cur_spot]+cost[cur_spot][i]; } } } } if(mindist[b] != INF){ cout <<mindist[b]<<endl; }else{ cout <<"-1"<<endl; } } int main(){ int n,k,mindist[101],a,b,c,d,e,first; int cost[101][101]; bool used[101]; while(1){ cin >>n>>k; if( n == 0 && k == 0)break; for(int i=0 ; i < 101 ; i++){ for(int j=0 ; j < 101 ; j++){ cost[i][j]= -1; } } for(int i=0 ; i < k ; i++){ cin >>first; if(first == 0){ cin >>a>>b; dijkstra(a,b,mindist,cost,used,n); }else{ cin >>c>>d>>e; if(cost[c][d] > e || cost[c][d] == -1){ cost[c][d]=e; cost[d][c]=e; } } } } return 0; }
a.cc: In function 'void dijkstra(int, int, int*, int (*)[101], bool*, int)': a.cc:18:9: error: 'INT_MAX' was not declared in this scope 18 | cur=INT_MAX; | ^~~~~~~ a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include<iostream> +++ |+#include <climits> 2 | using namespace std;
s448162395
p00449
C++
#include <iostream> #include <vector> #include <queue> #include <functional> using namespace std; struct edge { int to, cost; edge(int _to, int _cost) {to = _to; cost=_cost;} }; typedef pair<int, int> pii; int INF = 1012012012; vector<edge> e[100]; int ds(int s, int g) { int field[100]; priority_queue<pii, vector<pii>, greater<pii> > q; for(int i = 0; i < 100; i++) field[i] = INF; field[s-1] = 0; q.push(pii(0, s)); while(!q.empty()) { pii p = q.top(); q.pop(); int m = p.second; if(field[m] < p.first) continue; for(int i = 0; i < (int)e[m].size(); i++) { edge ee = e[m][i]; if(field[ee.to] > field[m] + ee.cost) { field[ee.to] = field[m] + ee.cost; q.push(pii(field[ee.to], ee.to)); } } } return (field[g] == INF) ? -1 : field[g]; } int main() { int n, k; int a, b, c, d, e, f; cin >> n >> k; while(k--, k != -1) { cin >> f; if(f == 0) { cin >> a >> b; cout << ds(a-1, b-1) << endl; } else { cin >> c >> d >> e; if(e[c-1].empty()) { e[c-1].push_back(edge(d-1, e)); } else { bool add = true; for(int i = 0; i < e[c-1].size(); i++) { if(e[c-1][i].to == d-1) { add = false; if(e[c-1][i].cost > e) { e[c-1][i].cost = e; } break; } } if(add) e[c-1].pushback(edge(d-1, e)); } if(e[d-1].empty()) { e[d-1].push_back(edge(c-1, e)); } else { bool add = true; for(int i = 0; i < e[d-1].size(); i++) { if(e[d-1][i].to == c-1) { add = false; if(e[d-1][i].cost > e) { e[d-1][i].cost = e; } break; } } if(add) e[d-1].pushback(edge(c-1, e)); } } } return 0; }
a.cc: In function 'int main()': a.cc:55:29: error: invalid types 'int[int]' for array subscript 55 | if(e[c-1].empty()) { | ^ a.cc:56:34: error: invalid types 'int[int]' for array subscript 56 | e[c-1].push_back(edge(d-1, e)); | ^ a.cc:59:53: error: invalid types 'int[int]' for array subscript 59 | for(int i = 0; i < e[c-1].size(); i++) { | ^ a.cc:60:45: error: invalid types 'int[int]' for array subscript 60 | if(e[c-1][i].to == d-1) { | ^ a.cc:62:53: error: invalid types 'int[int]' for array subscript 62 | if(e[c-1][i].cost > e) { | ^ a.cc:63:58: error: invalid types 'int[int]' for array subscript 63 | e[c-1][i].cost = e; | ^ a.cc:68:42: error: invalid types 'int[int]' for array subscript 68 | if(add) e[c-1].pushback(edge(d-1, e)); | ^ a.cc:70:29: error: invalid types 'int[int]' for array subscript 70 | if(e[d-1].empty()) { | ^ a.cc:71:34: error: invalid types 'int[int]' for array subscript 71 | e[d-1].push_back(edge(c-1, e)); | ^ a.cc:74:53: error: invalid types 'int[int]' for array subscript 74 | for(int i = 0; i < e[d-1].size(); i++) { | ^ a.cc:75:45: error: invalid types 'int[int]' for array subscript 75 | if(e[d-1][i].to == c-1) { | ^ a.cc:77:53: error: invalid types 'int[int]' for array subscript 77 | if(e[d-1][i].cost > e) { | ^ a.cc:78:58: error: invalid types 'int[int]' for array subscript 78 | e[d-1][i].cost = e; | ^ a.cc:83:42: error: invalid types 'int[int]' for array subscript 83 | if(add) e[d-1].pushback(edge(c-1, e)); | ^
s561937400
p00449
C++
#include <iostream> #include <vector> #include <queue> #include <functional> using namespace std; struct edge { int to, cost; edge(int _to, int _cost) {to = _to; cost=_cost;} }; typedef pair<int, int> pii; int INF = 1012012012; vector<edge> e[100]; int ds(int s, int g) { int field[100]; priority_queue<pii, vector<pii>, greater<pii> > q; for(int i = 0; i < 100; i++) field[i] = INF; field[s-1] = 0; q.push(pii(0, s)); while(!q.empty()) { pii p = q.top(); q.pop(); int m = p.second; if(field[m] < p.first) continue; for(int i = 0; i < (int)e[m].size(); i++) { edge ee = e[m][i]; if(field[ee.to] > field[m] + ee.cost) { field[ee.to] = field[m] + ee.cost; q.push(pii(field[ee.to], ee.to)); } } } return (field[g] == INF) ? -1 : field[g]; } int main() { int n, k; int a, b, c, d, e, f; cin >> n >> k; while(k--, k != -1) { cin >> f; if(f == 0) { cin >> a >> b; cout << ds(a-1, b-1) << endl; } else { cin >> c >> d >> e; if(e[c-1].empty()) { e[c-1].push_back(edge(d-1, e)); } else { bool add = true; for(int i = 0; i < e[c-1].size(); i++) { if(e[c-1][i].to == d-1) { add = false; if(e[c-1][i].cost > e) { e[c-1][i].cost = e; } break; } } if(add) e[c-1].pushback(edge(d-1, e)); } if(e[d-1].empty()) { e[d-1].push_back(edge(c-1, e)); } else { bool add = true; for(int i = 0; i < e[d-1].size(); i++) { if(e[d-1][i].to == c-1) { add = false; if(e[d-1][i].cost > e) { e[d-1][i].cost = e; } break; } } if(add) e[d-1].pushback(edge(c-1, e)); } } } return 0; }
a.cc: In function 'int main()': a.cc:55:29: error: invalid types 'int[int]' for array subscript 55 | if(e[c-1].empty()) { | ^ a.cc:56:34: error: invalid types 'int[int]' for array subscript 56 | e[c-1].push_back(edge(d-1, e)); | ^ a.cc:59:53: error: invalid types 'int[int]' for array subscript 59 | for(int i = 0; i < e[c-1].size(); i++) { | ^ a.cc:60:45: error: invalid types 'int[int]' for array subscript 60 | if(e[c-1][i].to == d-1) { | ^ a.cc:62:53: error: invalid types 'int[int]' for array subscript 62 | if(e[c-1][i].cost > e) { | ^ a.cc:63:58: error: invalid types 'int[int]' for array subscript 63 | e[c-1][i].cost = e; | ^ a.cc:68:42: error: invalid types 'int[int]' for array subscript 68 | if(add) e[c-1].pushback(edge(d-1, e)); | ^ a.cc:70:29: error: invalid types 'int[int]' for array subscript 70 | if(e[d-1].empty()) { | ^ a.cc:71:34: error: invalid types 'int[int]' for array subscript 71 | e[d-1].push_back(edge(c-1, e)); | ^ a.cc:74:53: error: invalid types 'int[int]' for array subscript 74 | for(int i = 0; i < e[d-1].size(); i++) { | ^ a.cc:75:45: error: invalid types 'int[int]' for array subscript 75 | if(e[d-1][i].to == c-1) { | ^ a.cc:77:53: error: invalid types 'int[int]' for array subscript 77 | if(e[d-1][i].cost > e) { | ^ a.cc:78:58: error: invalid types 'int[int]' for array subscript 78 | e[d-1][i].cost = e; | ^ a.cc:83:42: error: invalid types 'int[int]' for array subscript 83 | if(add) e[d-1].pushback(edge(c-1, e)); | ^
s299877870
p00449
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; vector<pair<int,int>???> edge[102];//[?§????] <??????????????????> int N,K; int map[102];//????????°????????????????????¢ int main(){ while(1){ scanf("%d %d",&N,&K); if(N==0&&K==0)break; rep(i,K){ int type; scanf("%d",&type); if(type==0){//??¨????\¨ int s,g; scanf("%d %d",&s,&g); s--;g--; priority_queue< pair<int,int>, vector< pair<int,int> >, greater< pair<int,int> > > q; rep(i,N)map[i]=INF; map[s]=0; q.push( make_pair(0,s) ); while(!q.empty()){ pair<int,int> p=q.top(); q.pop(); int c=p.second; if(map[c]<p.first) continue; rep(i,edge[c].size()){ pair<int,int> e=edge[c][i]; if(map[e.first]>map[c]+e.second){ map[e.first]=map[c]+e.second; q.push( make_pair(map[e.first],e.first)); } } } if(map[g]==INF)map[g]=-1; printf("%d\n",map[g]); }else{ int a,b,c; scanf("%d %d %d",&a,&b,&c); a--;b--; edge[a].push_back(make_pair(b,c)); edge[b].push_back(make_pair(a,c)); } } } }
a.cc:13:22: warning: trigraph ??> ignored, use -trigraphs to enable [-Wtrigraphs] 13 | vector<pair<int,int>???> edge[102];//[?§????] <??????????????????> a.cc:13:24: error: template argument 1 is invalid 13 | vector<pair<int,int>???> edge[102];//[?§????] <??????????????????> | ^ a.cc:13:24: error: template argument 2 is invalid a.cc: In function 'int main()': a.cc:38:55: error: request for member 'size' in 'edge[c]', which is of non-class type 'int' 38 | rep(i,edge[c].size()){ | ^~~~ a.cc:11:32: note: in definition of macro 'rep' 11 | #define rep(i,n) for(int i=0;i<n;i++) | ^ a.cc:39:72: error: invalid types 'int[int]' for array subscript 39 | pair<int,int> e=edge[c][i]; | ^ a.cc:52:41: error: request for member 'push_back' in 'edge[a]', which is of non-class type 'int' 52 | edge[a].push_back(make_pair(b,c)); | ^~~~~~~~~ a.cc:53:41: error: request for member 'push_back' in 'edge[b]', which is of non-class type 'int' 53 | edge[b].push_back(make_pair(a,c)); | ^~~~~~~~~
s687681872
p00449
C++
#include <iostream> #include <algorithm> using namespace std; int mp[101][101]; bool flg[101] ={}; int n,q; int dis[101]; int sssp(int s,int g) { for(int i=1;i<=n;i++) dis[i] = 1000000000,flg[i] = 0; //flg[s] = 1; dis[s] = 0; int ima; while(1) { int mindis = 1000000000; for(int i=1;i<=n;i++) if(mindis > dis[i] && flg[i] == 0) { ima = i; mindis = dis[i]; } /* if(mindis == 1000000000) return -1; flg[ima] = 1; if(ima == g) return dis[ima]; */ if(mindis == 1000000000) break; flg[ima] = 1; for(int i=1;i<=n;i++) if(dis[i] >dis[ima] + mp[ima][i] && mp[ima][i] != -1) dis[i] = dis[ima]+mp[ima][i]; } return dis[g]; } int main() { while(1) { cin >> n >> q; if(n == 0 && q == 0) break; for(int i=0;i<=n;i++){ // dis[i] = 1000000000; //flg[i] = 0; for(int j=0;j<=n;j++) mp[i][j] = -1; } bool sta; int s,g,c; for(int i=0;i<q;i++) { cin >> sta; if(sta == 0) { cin >> s >> g; //for(int i=1;i<=n;i++) if(mp[s][i] !=-1)dis[i] = mp[s][i]; int ans = sssp(s,g); cout << ans<< endl; } else { cin >> s >> g >> c; if(mp[s][g] != -1) { mp[s][g] = min(c ,mp[s][g]); mp[g][s] = min( mp[g][s] ,c); } else { mp[s][g] = c; mp[g][s] = c; } } } return 0; }
a.cc: In function 'int main()': a.cc:83:4: error: expected '}' at end of input 83 | } | ^ a.cc:43:12: note: to match this '{' 43 | int main() { | ^
s820532688
p00449
C++
# include <iostream> # include <queue> # include <vector> # include <algorithm> # include <functional> const int MAX_N = 100; const int INF = 100000000; typedef std::pair<int, int> P; struct edge { int to, cost; edge(int _t, int _c) : to(_t), cost(_c) {} }; int n, k; std::vector<edge> G[MAX_N]; int d[MAX_N]; int dijkstra(int s, int g) { std::priority_queue<P, std::vector<P>, std::greater<P>()> que; std::fill(d, d + n, INF); d[s] = 0; que.push(P(0, s)); while (!que.empty()) { P p = que.top(); que.pop(); int v = p.second; if (v == g) break; if (d[v] < p.first) continue; for (int i = 0; i < G[v].size(); ++i) { edge e = G[v][i]; if (d[e.to] > d[v] + e.cost) { d[e.to] = d[v] + e.cost; que.push(P(d[e.to], e.to)); } } } return d[g]; } bool check(int a, int b) { if (G[a].empty()) return false; else { for (int i = 0; i < G[a].size(); ++i) { if (G[a][i].to == b) return true; } } return false; } int main() { while (1) { int f; int c, d, e; std::cin >> n >> k; if (n == 0 && k == 0) break; for (int i = 0; i < k; ++i) { std::cin >> f; if (f == 0) { std::cin >> c >> d; --c; --d; int res = dijkstra(c, d); if (res == INF) res = -1; std::cout << res << std::endl; } else { std::cin >> c >> d >> e; --c; --d; if (check(c, d)) { for (int i = 0; i < G[c].size(); ++i) { if (G[c][i].to == d&&G[c][i].cost>e) { G[c][i].cost = e; for (int j = 0; j < G[d].size(); ++j) { if (G[d][j].to == c) G[d][j].cost = e; } } } } else { G[c].push_back(edge(d, e)); G[d].push_back(edge(c, e)); } } } } return 0; }
In file included from /usr/include/c++/14/queue:66, from a.cc:2: /usr/include/c++/14/bits/stl_queue.h: In instantiation of 'class std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> >()>': a.cc:22:60: required from here 22 | std::priority_queue<P, std::vector<P>, std::greater<P>()> que; | ^~~ /usr/include/c++/14/bits/stl_queue.h:538:18: error: data member 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> >()>::comp' invalidly declared function type 538 | _Compare comp; | ^~~~ a.cc: In function 'int dijkstra(int, int)': a.cc:22:67: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> >()>::priority_queue()' 22 | std::priority_queue<P, std::vector<P>, std::greater<P>()> que; | ^~~ /usr/include/c++/14/bits/stl_queue.h:691:9: note: candidate: 'template<class _InputIterator, class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&, const _Alloc&) [with _Alloc = _InputIterator; _Requires = _Alloc; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 691 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:691:9: note: candidate expects 5 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:679:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 679 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:679:9: note: candidate expects 5 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:671:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 671 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:671:9: note: candidate expects 4 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:663:9: note: candidate: 'template<class _InputIterator, class _Alloc, class, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Alloc&) [with _Alloc = _InputIterator; <template-parameter-2-3> = _Alloc; _Requires = <template-parameter-1-3>; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 663 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:663:9: note: candidate expects 3 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:649:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, _Sequence&&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 649 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:649:9: note: candidate expects 4 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:638:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&, const _Sequence&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 638 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:638:9: note: candidate expects 4 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:629:9: note: candidate: 'template<class _InputIterator, class> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(_InputIterator, _InputIterator, const _Compare&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 629 | priority_queue(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:629:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:594:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(std::priority_queue<_Tp, _Sequence, _Compare>&&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 594 | priority_queue(priority_queue&& __q, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:594:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:590:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const std::priority_queue<_Tp, _Sequence, _Compare>&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 590 | priority_queue(const priority_queue& __q, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:590:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:585:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, _Sequence&&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 585 | priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:585:9: note: candidate expects 3 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:579:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 579 | priority_queue(const _Compare& __x, const _Sequence& __c, | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:579:9: note: candidate expects 3 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:573:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 573 | priority_queue(const _Compare& __x, const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:573:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:569:9: note: candidate: 'template<class _Alloc, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Alloc&) [with _Requires = _Alloc; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 569 | priority_queue(const _Alloc& __a) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:569:9: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_queue.h:554:9: note: candidate: 'template<class _Seq, class _Requires> std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue() [with _Requires = _Seq; _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 554 | priority_queue() | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:554:9: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_queue.h:551:43: error: no type named 'type' in 'struct std::enable_if<false, void>' 551 | template<typename _Seq = _Sequence, typename _Requires = typename | ^~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:563:7: note: candidate: 'std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, _Sequence&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >()]' 563 | priority_queue(const _Compare& __x, _Sequence&& __s = _Sequence()) | ^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:563:7: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:558:7: note: candidate: 'std:
s495424390
p00449
C++
#include <cstdio> #include <algorithm> using namespace std; #define REP(i,n) for(int i = 0; i < (int)(n); ++i) const int INF = 100000000; const int MAX_V = 100; int graph[MAX_V][MAX_V]; int N, k; bool visited[MAX_V]; int cost[MAX_V]; void init_graph() { REP(i, N) { REP(j, N) { if (i == j) graph[i][j] = 0; else graph[i][j] = INF; } } } void solve() { while (true) { scanf("%d %d", &N, &k); if (N == 0 and k == 0) break; init_graph(); REP(_, k) { int mode; scanf("%d", &mode); if (mode == 0) { int a, b; scanf("%d %d", &a, &b); a--; b--; } else { int c, d, e; scanf("%d %d %d", &c, &d, &e); c--; d--; make_edge(c, d, e); if (c < graph[u][v]) { graph[u][v] = graph[v][u] = c; REP(i, N) { REP(j, N) { graph[i][j] = min(graph[i][j], graph[i][c] + graph[c][d] + graph[d][j]); graph[i][j] = min(graph[i][j], graph[i][d] + graph[d][c] + graph[c][j]); } } } } } } } int main() { solve(); return 0; }
a.cc: In function 'void solve()': a.cc:45:17: error: 'make_edge' was not declared in this scope 45 | make_edge(c, d, e); | ^~~~~~~~~ a.cc:47:31: error: 'u' was not declared in this scope 47 | if (c < graph[u][v]) { | ^ a.cc:47:34: error: 'v' was not declared in this scope 47 | if (c < graph[u][v]) { | ^
s012486175
p00449
C++
#include <cstdio> #include <algorithm> using namespace std; #define REP(i,n) for(int i = 0; i < (int)(n); ++i) const int INF = 100000000; const int MAX_V = 100; int graph[MAX_V][MAX_V]; int N, k; bool visited[MAX_V]; int cost[MAX_V]; void init_graph() { REP(i, N) { REP(j, N) { if (i == j) graph[i][j] = 0; else graph[i][j] = INF; } } } void solve() { while (true) { scanf("%d %d", &N, &k); if (N == 0 and k == 0) break; init_graph(); REP(_, k) { int mode; scanf("%d", &mode); if (mode == 0) { int a, b; scanf("%d %d", &a, &b); a--; b--; } else { int c, d, e; scanf("%d %d %d", &c, &d, &e); c--; d--; make_edge(c, d, e); if (c < graph[u][v]) { graph[u][v] = graph[v][u] = c; REP(i, N) { REP(j, N) { graph[i][j] = min(graph[i][j], graph[i][c] + graph[c][d] + graph[d][j]); graph[i][j] = min(graph[i][j], graph[i][d] + graph[d][c] + graph[c][j]); } } } } } } } int main() { solve(); return 0; }
a.cc: In function 'void solve()': a.cc:45:17: error: 'make_edge' was not declared in this scope 45 | make_edge(c, d, e); | ^~~~~~~~~ a.cc:46:31: error: 'u' was not declared in this scope 46 | if (c < graph[u][v]) { | ^ a.cc:46:34: error: 'v' was not declared in this scope 46 | if (c < graph[u][v]) { | ^
s524485011
p00449
C++
#include <cstdio> #include <algorithm> using namespace std; #define REP(i,n) for(int i = 0; i < (int)(n); ++i) const int INF = 100000000; const int MAX_V = 100; int graph[MAX_V][MAX_V]; int N, k; bool visited[MAX_V]; int cost[MAX_V]; void init_graph() { REP(i, N) { REP(j, N) { if (i == j) graph[i][j] = 0; else graph[i][j] = INF; } } } void solve() { while (true) { scanf("%d %d", &N, &k); if (N == 0 and k == 0) break; init_graph(); REP(_, k) { int mode; scanf("%d", &mode); if (mode == 0) { int a, b; scanf("%d %d", &a, &b); a--; b--; } else { int c, d, e; scanf("%d %d %d", &c, &d, &e); c--; d--; make_edge(c, d, e); if (e < graph[c][d]) { graph[c][d] = graph[d][c] = e; REP(i, N) { REP(j, N) { graph[i][j] = min(graph[i][j], graph[i][c] + graph[c][d] + graph[d][j]); graph[i][j] = min(graph[i][j], graph[i][d] + graph[d][c] + graph[c][j]); } } } } } } } int main() { solve(); return 0; }
a.cc: In function 'void solve()': a.cc:45:17: error: 'make_edge' was not declared in this scope 45 | make_edge(c, d, e); | ^~~~~~~~~
s797666930
p00449
C++
#include <iostream> #include <algorithm> #include <vector> #include <cstdio> #include <cstdlib> #include <string> #include <cmath> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) #define fi first #define se second void floyd (int n){//n??????????????° rep(k, n) rep(i, n) rep(j, n) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);//???????????????????????¢?????\??? //???????????? printf("%d ", s); int now = s;//now????¬????????????????????????? while (now != g){ rep(i, n){//??¨????????????????¢?????????? if (now == i) continue;//??????????????§??????????????? //?????????????????????????????? distmemo[now][i] ???????????°?????? //???????????????????????¨???????????£???????????????????????£????±????????????????????????????????????????????????¨?????´?????????????¢???????????????? if (dist[now][g] == distmemo[now][i] + dist[i][g] && distmemo[now][i] > 0){ now = i; if (now == g) printf("%d\n", g); else printf("%d ", now); break; } } } } int main(void){ int n, m; cin >> n >> m >> s >> g; //??§???????????°?????§????????? rep(i, n)rep(j, n) dist[i][j] = dist[j][i] = INF; //????????¨???0??§??????????????????????? rep(i, n)rep(j, n) distmemo[i][j] = distmemo[j][i] = 0; //????????¨?????????0 rep(i, n) dist[i][i] = 0; //??\??? rep(i, m){ int a, b, c; scanf("%d%d%d", &a,&b,&c); dist[a][b] = dist[b][a] = c;//?????????????????????????????§???2????????£??\???????????¨ distmemo[a][b] = distmemo[b][a] = c;//??????????????????????????¢??¨ } rep(i, ) floyd(n);//???????????° return 0; }
a.cc: In function 'void floyd(int)': a.cc:16:17: error: 'dist' was not declared in this scope 16 | dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);//???????????????????????¢?????\??? | ^~~~ a.cc:19:19: error: 's' was not declared in this scope 19 | printf("%d ", s); | ^ a.cc:21:19: error: 'g' was not declared in this scope 21 | while (now != g){ | ^ a.cc:26:21: error: 'dist' was not declared in this scope 26 | if (dist[now][g] == distmemo[now][i] + dist[i][g] && distmemo[now][i] > 0){ | ^~~~ a.cc:26:37: error: 'distmemo' was not declared in this scope 26 | if (dist[now][g] == distmemo[now][i] + dist[i][g] && distmemo[now][i] > 0){ | ^~~~~~~~ a.cc: In function 'int main()': a.cc:39:26: error: 's' was not declared in this scope 39 | cin >> n >> m >> s >> g; | ^ a.cc:39:31: error: 'g' was not declared in this scope 39 | cin >> n >> m >> s >> g; | ^ a.cc:41:28: error: 'dist' was not declared in this scope 41 | rep(i, n)rep(j, n) dist[i][j] = dist[j][i] = INF; | ^~~~ a.cc:41:54: error: 'INF' was not declared in this scope 41 | rep(i, n)rep(j, n) dist[i][j] = dist[j][i] = INF; | ^~~ a.cc:43:28: error: 'distmemo' was not declared in this scope 43 | rep(i, n)rep(j, n) distmemo[i][j] = distmemo[j][i] = 0; | ^~~~~~~~ a.cc:46:19: error: 'dist' was not declared in this scope 46 | rep(i, n) dist[i][i] = 0; | ^~~~ a.cc:51:17: error: 'dist' was not declared in this scope 51 | dist[a][b] = dist[b][a] = c;//?????????????????????????????§???2????????£??\???????????¨ | ^~~~ a.cc:52:17: error: 'distmemo' was not declared in this scope 52 | distmemo[a][b] = distmemo[b][a] = c;//??????????????????????????¢??¨ | ^~~~~~~~ a.cc:9:34: error: expected primary-expression before ')' token 9 | #define rep(i,n) for(int i=0;i<(n);i++) | ^ a.cc:54:9: note: in expansion of macro 'rep' 54 | rep(i, ) | ^~~
s140120615
p00449
C++
#include <iostream> #include <algorithm> using namespace std; #define INF 100000000 int map[100][100]={}; int n,k,count,tmin=100; int dd[101],col[100]={}; int main(){ int t,a,b,c,d,e; cin >> n >> k; while(n!=0&&k!=0){ for (int i=0;i<10000;i++)map[i/100][i%100]=0; for (int i=0;i<k;i++){ cin >> t; // for (int y=0;y<k;y++){ //for (int x=0;x<k;x++) // cout << map[y][x] << " "; //cout << endl; //} if (t == 0){ cin >> a >> b; for (int j=0;j<101;j++)dd[j]=INF; for (int j=0;j<101;j++)col[j]=0; dd[a-1]=0; count = 1; col[a-1]=1; for (int m=0;m<n;m++) if(map[a-1][m]>0) dd[m]=min(dd[m],dd[a-1]+map[a-1][m]); while (count < n){ for (int m=0;m<n;m++) if (col[m]==0) if (dd[tmin]>dd[m]) tmin = m; // for (int m=0;m<n;m++)cout << dd[m] << " ";//Dbg // cout << endl;//Dbg col[tmin]=1; count ++; for (int m=0;m<n;m++) if(map[tmin][m]>0) dd[m]=min(dd[m],dd[tmin]+map[tmin][m]); tmin=100; } if (dd[b-1]==INF)cout << -1 << endl; else cout << dd[b-1] <<endl; }else{ cin >> c >> d >> e; c--;d--; if (map[c][d]==0){ map[c][d]=e; map[d][c]=e; } map[c][d]=min(map[c][d],e); map[d][c]=min(map[d][c],e); } } cin >> n >> k; } return 0; }
a.cc: In function 'int main()': a.cc:26:9: error: reference to 'count' is ambiguous 26 | count = 1; | ^~~~~ In file included from /usr/include/c++/14/algorithm:86, from a.cc:2: /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:6:11: note: 'int count' 6 | int n,k,count,tmin=100; | ^~~~~ a.cc:32:16: error: reference to 'count' is ambiguous 32 | while (count < n){ | ^~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:6:11: note: 'int count' 6 | int n,k,count,tmin=100; | ^~~~~ a.cc:41:11: error: reference to 'count' is ambiguous 41 | count ++; | ^~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:6:11: note: 'int count' 6 | int n,k,count,tmin=100; | ^~~~~
s622477343
p00449
C++
#include <iostream> #include <algorithm> using namespace std; #define INF 100000000 int map[100][100]; int n,k,count,tmin=100; int dd[101],col[100]; int main(){ int t,a,b,c,d,e; cin >> n >> k; while(n!=0&&k!=0){ for (int i=0;i<10000;i++)map[i/100][i%100]=0; for (int i=0;i<k;i++){ cin >> t; // for (int y=0;y<k;y++){ //for (int x=0;x<k;x++) // cout << map[y][x] << " "; //cout << endl; //} if (t == 0){ cin >> a >> b; for (int j=0;j<101;j++)dd[j]=INF; for (int j=0;j<101;j++)col[j]=0; dd[a-1]=0; count = 1; col[a-1]=1; for (int m=0;m<n;m++) if(map[a-1][m]>0) dd[m]=min(dd[m],dd[a-1]+map[a-1][m]); while (count < n){ for (int m=0;m<n;m++) if (col[m]==0) if (dd[tmin]>dd[m]) tmin = m; // for (int m=0;m<n;m++)cout << dd[m] << " ";//Dbg // cout << endl;//Dbg col[tmin]=1; count ++; for (int m=0;m<n;m++) if(map[tmin][m]>0) dd[m]=min(dd[m],dd[tmin]+map[tmin][m]); tmin=100; } if (dd[b-1]==INF)cout << -1 << endl; else cout << dd[b-1] <<endl; }else{ cin >> c >> d >> e; c--;d--; if (map[c][d]==0){ map[c][d]=e; map[d][c]=e; } map[c][d]=min(map[c][d],e); map[d][c]=min(map[d][c],e); } } cin >> n >> k; } return 0; }
a.cc: In function 'int main()': a.cc:27:9: error: reference to 'count' is ambiguous 27 | count = 1; | ^~~~~ In file included from /usr/include/c++/14/algorithm:86, from a.cc:2: /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:7:9: note: 'int count' 7 | int n,k,count,tmin=100; | ^~~~~ a.cc:33:16: error: reference to 'count' is ambiguous 33 | while (count < n){ | ^~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:7:9: note: 'int count' 7 | int n,k,count,tmin=100; | ^~~~~ a.cc:42:11: error: reference to 'count' is ambiguous 42 | count ++; | ^~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:7:9: note: 'int count' 7 | int n,k,count,tmin=100; | ^~~~~
s170097761
p00449
C++
#include<bits/stdc++.h> using namespace std; int dist[105],n,m,a,b,c,d; queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> Q; vector<pair<int,int>>x[105]; void add_edge(int a1,int a2,int a3){ x[a1].push_back(make_pair(a2,a3)); x[a2].push_back(make_pair(a1,a3)); } int solve(int b1,int b2){ for(int i=0;i<105;i++)dist[i]=100000000;dist[b1]=0; while(!Q.empty()){ int a1=Q.front().first,a2=Q.front().second;Q.pop(); for(int i=0;i<x[a2].size();i++){ int to=x[a2][i].first,len=x[a2][i].second; if(dist[to]>a1+len){ dist[to]=a1+len; Q.push(make_pair(dist[to],to)); } } } if(dist[b2]==100000000)return -1; return dist[b2]; } int main(){ while(true){ cin>>n>>m;for(int i=0;i<105;i++)x[i].clear(); if(n==0 && m==0)break; for(int i=0;i<m;i++){ cin>>a;if(a==0)break; if(a==0){cin>>b>>c;cout<<solve(b,c)<<endl;} if(a==1){cin>>b>>c>>d;add_edge(b,c,d);} } } }
a.cc:4:65: error: wrong number of template arguments (3, should be at least 1) 4 | queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> Q; | ^ In file included from /usr/include/c++/14/queue:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157, from a.cc:1: /usr/include/c++/14/bits/stl_queue.h:96:11: note: provided for 'template<class _Tp, class _Sequence> class std::queue' 96 | class queue | ^~~~~ a.cc: In function 'int solve(int, int)': a.cc:12:18: error: request for member 'empty' in 'Q', which is of non-class type 'int' 12 | while(!Q.empty()){ | ^~~~~ a.cc:13:26: error: request for member 'front' in 'Q', which is of non-class type 'int' 13 | int a1=Q.front().first,a2=Q.front().second;Q.pop(); | ^~~~~ a.cc:13:62: error: request for member 'pop' in 'Q', which is of non-class type 'int' 13 | int a1=Q.front().first,a2=Q.front().second;Q.pop(); | ^~~ a.cc:14:33: error: 'a2' was not declared in this scope; did you mean 'a1'? 14 | for(int i=0;i<x[a2].size();i++){ | ^~ | a1 a.cc:16:40: error: 'len' was not declared in this scope 16 | if(dist[to]>a1+len){ | ^~~ a.cc:18:35: error: request for member 'push' in 'Q', which is of non-class type 'int' 18 | Q.push(make_pair(dist[to],to)); | ^~~~
s149152362
p00449
C++
#include<bits/stdc++.h> using namespace std; int dist[105],n,m,a,b,c,d; queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> Q; vector<pair<int,int>>x[105]; void add_edge(int a1,int a2,int a3){ x[a1].push_back(make_pair(a2,a3)); x[a2].push_back(make_pair(a1,a3)); } int solve(int b1,int b2){ for(int i=0;i<105;i++)dist[i]=100000000;dist[b1]=0; while(!Q.empty()){ int a1=Q.front().first,a2=Q.front().second;Q.pop(); for(int i=0;i<x[a2].size();i++){ int to=x[a2][i].first,len=x[a2][i].second; if(dist[to]>a1+len){ dist[to]=a1+len; Q.push(make_pair(dist[to],to)); } } } if(dist[b2]==100000000)return -1; return dist[b2]; } int main(){ while(true){ cin>>n>>m;for(int i=0;i<105;i++)x[i].clear(); if(n==0 && m==0)break; for(int i=0;i<m;i++){ cin>>a;if(a==0)break; if(a==0){cin>>b>>c;cout<<solve(b,c)<<endl;} if(a==1){cin>>b>>c>>d;add_edge(b,c,d);} } } }
a.cc:4:65: error: wrong number of template arguments (3, should be at least 1) 4 | queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> Q; | ^ In file included from /usr/include/c++/14/queue:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157, from a.cc:1: /usr/include/c++/14/bits/stl_queue.h:96:11: note: provided for 'template<class _Tp, class _Sequence> class std::queue' 96 | class queue | ^~~~~ a.cc: In function 'int solve(int, int)': a.cc:12:18: error: request for member 'empty' in 'Q', which is of non-class type 'int' 12 | while(!Q.empty()){ | ^~~~~ a.cc:13:26: error: request for member 'front' in 'Q', which is of non-class type 'int' 13 | int a1=Q.front().first,a2=Q.front().second;Q.pop(); | ^~~~~ a.cc:13:62: error: request for member 'pop' in 'Q', which is of non-class type 'int' 13 | int a1=Q.front().first,a2=Q.front().second;Q.pop(); | ^~~ a.cc:14:33: error: 'a2' was not declared in this scope; did you mean 'a1'? 14 | for(int i=0;i<x[a2].size();i++){ | ^~ | a1 a.cc:16:40: error: 'len' was not declared in this scope 16 | if(dist[to]>a1+len){ | ^~~ a.cc:18:35: error: request for member 'push' in 'Q', which is of non-class type 'int' 18 | Q.push(make_pair(dist[to],to)); | ^~~~
s287817610
p00449
C++
#include <iostream> #include <vector> #include <queue> #include <utility> #include <climits> #include <functional> using Pair = std::pair<int, int>; struct Node { std::vector<Pair> edges; int minCost = std::numeric_limits<int>::max(); bool done; }; int main() { int n, k; while (std::cin >> n >> k, n + k != 0) { std::vector<Node> nodes(n); for (int i = 0; i < k; ++i) { int req; std::cin >> req; if (req == 1) { int c, d, e; std::cin >> c >> d >> e; nodes[c - 1].edges.push_back({ d - 1, e }); nodes[d - 1].edges.push_back({ c - 1, e }); } else { int a, b; std::cin >> a >> b; // first: cost, second: node std::priority_queue<Pair, std::vector<Pair>, std::greater<Pair>> que; que.push({ 0, a - 1 }); while (!que.empty()) { const auto top = que.top(); if (top.second == b - 1) { std::cout << top.first << std::endl; break; } que.pop(); auto& now = nodes[top.second]; if (now.done) continue; now.minCost = top.first; now.done = true; for (auto&& edge : now.edges) if (nodes[edge.first].done == false && nodes[edge.first].minCost > top.first + edge.second) que.push({ top.first + edge.second, edge.first }); } if (que.empty()) std::cout << -1 << std::endl; for (auto&& n : nodes) { n.done = false; n.minCost = std::numeric_limits<int>::max(); } } } } }
a.cc:13:28: error: 'numeric_limits' is not a member of 'std' 13 | int minCost = std::numeric_limits<int>::max(); | ^~~~~~~~~~~~~~ a.cc:13:43: error: expected primary-expression before 'int' 13 | int minCost = std::numeric_limits<int>::max(); | ^~~ a.cc: In function 'int main()': a.cc:67:58: error: 'numeric_limits' is not a member of 'std' 67 | n.minCost = std::numeric_limits<int>::max(); | ^~~~~~~~~~~~~~ a.cc:67:73: error: expected primary-expression before 'int' 67 | n.minCost = std::numeric_limits<int>::max(); | ^~~
s880919163
p00449
C++
3 8 1 3 1 10 0 2 3 1 2 3 20 1 1 2 5 0 3 2 1 1 3 7 1 2 1 9 0 2 3 5 16 1 1 2 343750 1 1 3 3343 1 1 4 347392 1 1 5 5497 1 2 3 123394 1 2 4 545492 1 2 5 458 1 3 4 343983 1 3 5 843468 1 4 5 15934 0 2 1 0 4 1 0 3 2 0 4 2 0 4 3 0 5 3 0 0
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 3 8 | ^
s707597626
p00449
C++
#include<map> #include<queue> #include<utility> #include<cstdio> #include<vector> #include<algorithm> #include<numeric> #include<functional> #include<string> #include<iostream> using namespace std; const long long int one = 1; const long long int big = (one<<40); typedef long long int llint; map<int,llint> cost[100]; llint dike(int from,int to){ priority_queue<pair<llint,int>,vector<pair<llint,int> >,greater<pair<llint,int> > > que; pair<llint,int> p,b; llint nedan[100]; llint sokane; int doko; int i=0; std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it; for(i=0;i<100;i++){ nedan[i]=big; } que.push(make_pair((llint)0,from)); while(!que.empty()){ p=que.top(); sokane=p.first; doko=p.second; que.pop(); if(nedan[doko]<big){continue;} for(it=cost[doko].begin();it!=cost[doko].end();it++){ que.push(make_pair(sokane+it->second,it->first)); } nedan[doko]=sokane; } return nedan[to]; } int solve(int Q){ int h,i,j,a,b,info; llint c; for(h=0;h<Q;h++){ scanf("%d",&info); if(info==1){ scanf("%d %d %lld",&a,&b,&c); a--;b--; if(cost[a].count(b)==1){ cost[a][b]=min(c,cost[a][b]); cost[b][a]=min(c,cost[a][b]); } else{ cost[a][b]=c; cost[b][a]=c; } } else{ scanf("%d %d",&a,&b); a--;b--; c=dike(a,b); if(big<=c){c=-1;} printf("%lld\n",c); } } return 0; } int main(void){ int a,Q; while(-1){ scanf("%d %d",&a,&Q); if(a==0){ return 0; } solve(Q); } return 0; }
a.cc: In function 'llint dike(int, int)': a.cc:24:14: error: '_Tree_iterator' is not a member of 'std'; did you mean '_Rb_tree_iterator'? 24 | std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it; | ^~~~~~~~~~~~~~ | _Rb_tree_iterator a.cc:24:34: error: '_Tree_val' is not a member of 'std' 24 | std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it; | ^~~~~~~~~ a.cc:24:49: error: '_Tree_simple_types' is not a member of 'std' 24 | std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it; | ^~~~~~~~~~~~~~~~~~ a.cc:24:95: error: expected primary-expression before '>' token 24 | std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it; | ^ a.cc:24:97: error: expected primary-expression before '>' token 24 | std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it; | ^ a.cc:24:99: error: expected primary-expression before '>' token 24 | std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it; | ^ a.cc:24:101: error: 'it' was not declared in this scope; did you mean 'i'? 24 | std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const int,llint> > > > it; | ^~ | i