submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s411235947
p00127
C++
/* 0127:Pocket Pager Input */ #include <iostream> #include <string> using namespace std; const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; int main(void) { char WORDSET[6][5]; int w = 0; for(int i = 0; i < 6; i++) { for(int j = 0; j < 5; j++) { WORDSET[i][j] = WORDS[w]; w++; } } while(1) { string str; string ans; bool fl = true; cin >> str; if( cin.eof() ) { break; } else if( (int)str.size() % 2 != 0 ) { cout << "NA" << endl; continue; } string::iterator it = str.begin(); while( it != str.end() ) { int a, b; a = *it - '0' - 1; it++; b = *it - '0' - 1; it++; if(0 <= a && a < 6 && 0 <= b && b < 5) { ans += WORDSET[a][b]; } else { fl = false; break; } } if(fl) { cout << ans << endl; } else { cout << "NA" << endl; } } return 0; }
a.cc:9:24: error: initializer-string for 'const char [30]' is too long [-fpermissive] 9 | const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s615492120
p00127
C++
/* 0127:Pocket Pager Input */ #include <iostream> #include <string> using namespace std; const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; int main(void) { char WORDSET[6][5]; int w = 0; for(int i = 0; i < 6; i++) { for(int j = 0; j < 5; j++) { WORDSET[i][j] = WORDS[w]; w++; } } while(1) { string str; string ans; bool fl = true; cin >> str; if( cin.eof() ) { break; } else if( (int)str.size() % 2 != 0 ) { cout << "NA" << endl; continue; } string::iterator it = str.begin(); while( it != str.end() ) { int a, b; a = *it - '0' - 1; it++; b = *it - '0' - 1; it++; if(0 <= a && a < 6 && 0 <= b && b < 5) { ans += WORDSET[a][b]; } else { fl = false; break; } } if(fl) { cout << ans << endl; } else { cout << "NA" << endl; } } return 0; }
a.cc:9:24: error: initializer-string for 'const char [30]' is too long [-fpermissive] 9 | const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s668960804
p00127
C++
/* 0127:Pocket Pager Input */ #include <iostream> #include <string> using namespace std; const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; int main(void) { char WORDSET[6][5]; int w = 0; for(int i = 0; i < 6; i++) { for(int j = 0; j < 5; j++) { WORDSET[i][j] = WORDS[w]; w++; } } while(1) { string str; string ans; bool fl = true; cin >> str; if( cin.eof() ) { break; } else if( (int)str.size() % 2 != 0 ) { cout << "NA" << endl; continue; } string::iterator it = str.begin(); while( it != str.end() ) { int a, b; a = *it - '0' - 1; it++; b = *it - '0' - 1; it++; if(0 <= a && a < 6 && 0 <= b && b < 5) { ans += WORDSET[a][b]; } else { fl = false; break; } } if(fl) { cout << ans << endl; } else { cout << "NA" << endl; } } return 0; }
a.cc:9:24: error: initializer-string for 'const char [30]' is too long [-fpermissive] 9 | const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s048761520
p00127
C++
/* 0127:Pocket Pager Input */ #include <iostream> #include <string> using namespace std; const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; int main(void) { char WORDSET[6][5]; int w = 0; for(int i = 0; i < 6; i++) { for(int j = 0; j < 5; j++) { WORDSET[i][j] = WORDS[w]; w++; } } while(1) { string str; string ans; bool fl = true; cin >> str; if( cin.eof() ) { break; } else if( (int)str.size() % 2 != 0 ) { cout << "NA" << endl; continue; } string::iterator it = str.begin(); while( it != str.end() ) { int a, b; a = *it - '0' - 1; it++; b = *it - '0' - 1; it++; if(0 <= a && a < 6 && 0 <= b && b < 5) { ans += WORDSET[a][b]; } else { fl = false; break; } } if(fl) { cout << ans << endl; } else { cout << "NA" << endl; } } return 0; }
a.cc:9:24: error: initializer-string for 'const char [30]' is too long [-fpermissive] 9 | const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s055941018
p00127
C++
/* 0127:Pocket Pager Input */ #include <iostream> #include <string> using namespace std; const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; int main(void) { char WORDSET[6][5]; int w = 0; for(int i = 0; i < 6; i++) { for(int j = 0; j < 5; j++) { WORDSET[i][j] = WORDS[w]; w++; } } while(1) { string str; string ans; bool fl = true; cin >> str; if( cin.eof() ) { break; } else if( (int)str.size() % 2 != 0 ) { cout << "NA" << endl; continue; } string::iterator it = str.begin(); while( it != str.end() ) { int a, b; a = *it - '0' - 1; it++; b = *it - '0' - 1; it++; if(0 <= a && a < 6 && 0 <= b && b < 5) { ans += WORDSET[a][b]; } else { fl = false; break; } } if(fl) { cout << ans << endl; } else { cout << "NA" << endl; } } return 0; }
a.cc:9:24: error: initializer-string for 'const char [30]' is too long [-fpermissive] 9 | const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s603360474
p00127
C++
#include<iostream> #include<string> #include<cstdio> #include<algorithm> #include<stack> #include<queue> #include<vector> #include<cmath> #include<utility> #include<set> #include<complex> #include<map> #define vi vector<int> #define vvi vector<vector<int> > #define ll long long int #define vl vector<ll> #define vvl vector<vector<ll>> #define vvc vector<vector<char>> #define vb vector<bool> #define vc vector<char> #define vs vector<string> #define ld long double #define INF 1e9 #define EPS 0.0000000001 #define rep(i,n) for(int i=0;i<n;i++) #define loop(i,s,n) for(int i=s;i<n;i++) #define CC puts("-------ok--------"); #define all(in) in.begin(), in.end() using namespace std; typedef pair<int, int> pii; #define MAX 99999999 int main(){ char u[6][5] = { 'a','b','c','d','e','f', 'g','h','i','j','k','l', 'm','n','o','p','q','r', 's','t','u','v','w','x', 'y','z','.','?','!',' ' }; string s; cin>>s bool flag=true; if(s.length()%2){cout<<"NA"<<endl; flag=false;} if(flag){ vector<pii>v(1000); rep(i,s.length()/2){ v[i]=pii(s[2*i]-48,s[2*i+1]-48); if(v[i].first>=7||v[i].second>=6){goto E;} } rep(i,s.length()/2) cout<<u[v[i].first-1][v[i].second-1]; cout<<endl; } E:; }
a.cc: In function 'int main()': a.cc:40:11: error: expected ';' before 'bool' 40 | cin>>s | ^ | ; 41 | bool flag=true; | ~~~~ a.cc:42:44: error: 'flag' was not declared in this scope 42 | if(s.length()%2){cout<<"NA"<<endl; flag=false;} | ^~~~ a.cc:43:8: error: 'flag' was not declared in this scope 43 | if(flag){ | ^~~~
s267930028
p00127
C++
#include<bits/stdc++.h> using namespace std; int main(){ string a="abcdefghijklmnopqrstuvwxyz.?! "; string b; while(cin>>b){ if(b.length()%2==1) { cout<<"NA"<<endl; goto stop; } string c; for(int i=0;i<b.length();i+=2){ int c,d; c=(int)b[i]-'1'; d=(int)b[i+1]-'0'; int e=c*5+d; if(e>25) { cout<<"NA"<<endl; goto stop; } c+=a[e-1]; } cout<<endl; stop:; } }
a.cc: In function 'int main()': a.cc:24:17: error: jump to label 'stop' 24 | stop:; | ^~~~ a.cc:9:30: note: from here 9 | goto stop; | ^~~~ a.cc:11:24: note: crosses initialization of 'std::string c' 11 | string c; | ^
s047718759
p00127
C++
#include <bits/stdc++.h> using namespace std; string s[]={"afkpuz","bglqv.","chmrw?","dinsx!","ejoty "}; int main(){string ss;while(cin>>ss){ if(ss.size()%2==1){cout<<"NA"<<endl;continue;} bool b=1;string ans="";for(int i=0;i<ss.size()-1;i+=2){ if(!('1'<=ss[i+1]&&ss[i+1]<='5')||!('1'<=ss[i]&&ss[i]<='6')){b=0; break;} ans+=s[in[i+1]-'0'-1][in[i]-'0'-1];} if(b)cout<<ans<<endl;else cout<<"NA"<<endl; }}
a.cc: In function 'int main()': a.cc:8:8: error: 'in' was not declared in this scope; did you mean 'i'? 8 | ans+=s[in[i+1]-'0'-1][in[i]-'0'-1];} | ^~ | i
s381207554
p00127
C++
#include<bits/stdc++.h> using namespace std; int main(){ string str[6]={"","aafkpuz","abglqv.","achmrw?" ,"adinsx!","aejoty "}; string str2; while(cin>>str2){ if(str2.size()%2==1) cout<<"NA"<<endl; else{ for(int i=0;i<str2.size();i+=2){ cout<<str[str2[i+1]-'0'][str2[i]-'0']; } cout<<endl;34 } } return 0; }
a.cc: In function 'int main()': a.cc:14:20: error: expected ';' before '}' token 14 | cout<<endl;34 | ^ | ; 15 | } | ~
s821159638
p00127
C++
#include<iostream> #include<math.h> #include<vector> #include<algorithm> #include<cstdio> using namespace std; int main(){ char l[6][6]={{0}}; for(int i=0;i<5;i++){ for(int j=0;j<5;j++) l[i][j]='a'+i*5+j; } strcpy(l[5],"z.?! "); char str[256]; while(scanf("%s",str)!=EOF){ if(strlen(str)&1){ puts("NA"); continue; } bool flag=true; char ans[128]={0}; for(int i=0;str[i];i+=2){ int v1=str[i]-'0'-1,v2=str[i+1]-'0'-1; if(v1<0||v1>=6||v2<0||v2>=5){ puts("NA"); flag=false; break; } ans[i/2]=l[v1][v2]; } if(flag)printf("%s\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:14:5: error: 'strcpy' was not declared in this scope 14 | strcpy(l[5],"z.?! "); | ^~~~~~ a.cc:6:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include<cstdio> +++ |+#include <cstring> 6 | using namespace std; a.cc:18:12: error: 'strlen' was not declared in this scope 18 | if(strlen(str)&1){ | ^~~~~~ a.cc:18:12: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s411746821
p00127
C++
if(a == '6' && b == '3') ans = '?'; if(a == '6' && b == '4') ans = '!'; if(a == '6' && b == '5') ans = ' '; return ans; } int main(void) { char c[200]; char ans[100]; int len = 0; while(scanf("%s", c) != EOF) { int cnt = 0; len = strlen(c); for(int i = 0 ; i < len ; i+=2) { ans[i] = change(c[i], c[i+1]); } if(len % 2 == 0) { for(int i = 0 ; i < len ; i+=2) { cout << ans[i]; } cout << endl; } else cout << "NA" << endl; } return 0; }
a.cc:1:3: error: expected unqualified-id before 'if' 1 | if(a == '6' && b == '3') ans = '?'; | ^~ a.cc:2:3: error: expected unqualified-id before 'if' 2 | if(a == '6' && b == '4') ans = '!'; | ^~ a.cc:3:3: error: expected unqualified-id before 'if' 3 | if(a == '6' && b == '5') ans = ' '; | ^~ a.cc:5:3: error: expected unqualified-id before 'return' 5 | return ans; | ^~~~~~ a.cc:6:1: error: expected declaration before '}' token 6 | } | ^ a.cc: In function 'int main()': a.cc:12:9: error: 'scanf' was not declared in this scope 12 | while(scanf("%s", c) != EOF) { | ^~~~~ a.cc:12:27: error: 'EOF' was not declared in this scope 12 | while(scanf("%s", c) != EOF) { | ^~~ a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | if(a == '6' && b == '3') ans = '?'; a.cc:14:11: error: 'strlen' was not declared in this scope 14 | len = strlen(c); | ^~~~~~ a.cc:1:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | if(a == '6' && b == '3') ans = '?'; a.cc:16:16: error: 'change' was not declared in this scope 16 | ans[i] = change(c[i], c[i+1]); | ^~~~~~ a.cc:20:9: error: 'cout' was not declared in this scope 20 | cout << ans[i]; | ^~~~ a.cc:22:7: error: 'cout' was not declared in this scope 22 | cout << endl; | ^~~~ a.cc:22:15: error: 'endl' was not declared in this scope 22 | cout << endl; | ^~~~ a.cc:24:10: error: 'cout' was not declared in this scope 24 | else cout << "NA" << endl; | ^~~~ a.cc:24:26: error: 'endl' was not declared in this scope 24 | else cout << "NA" << endl; | ^~~~
s603670360
p00127
C++
#include<cstdio> #include<cstring> using namespace std; int main(){ char a[7][7] = {"","*abcde","*fghij","*klmno","*pqrst","*uvwxy","*z.?! "}; while(~scanf("%s",s)){ char s[200]; if(strlen(s)%2==1)printf("NA\n"); else{ for(int i=0;i<strlen(s);i+=2){ printf("%c",a[s[i]-48][s[i+1]-48]); } printf("\n"); } } return 0; }
a.cc: In function 'int main()': a.cc:7:23: error: 's' was not declared in this scope 7 | while(~scanf("%s",s)){ | ^
s662704654
p00127
C++
/* 0127:Pocket Pager Input */ #include <iostream> #include <string> using namespace std; const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; int main(void) { char WORDSET[6][5]; int w = 0; for(int i = 0; i < 6; i++) { for(int j = 0; j < 5; j++) { WORDSET[i][j] = WORDS[w]; w++; } } while(1) { string str; cin >> str; if( cin.eof() ) { break; } else if( (int)str.size() % 2 != 0 ) { cout << "NA" << endl; continue; } string::iterator it = str.begin(); while( it != str.end() ) { int a, b; a = *it - '0' - 1; it++; b = *it - '0' - 1; it++; cout << WORDSET[a][b]; } cout << endl; } return 0; }
a.cc:9:24: error: initializer-string for 'const char [30]' is too long [-fpermissive] 9 | const char WORDS[30] = "abcdefghijklmnopqrstuvwxyz.?! "; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s274525471
p00128
Java
import java.util.Scanner; public class AOJ0128 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()){ abacus(sc.nextInt()); } } static void abacus(int n){ //System.out.println(n); char ch[][]=new char[5][8]; int m[]=new int[5]; if(n>=10000){ m[0]=n/10000; n%=10000; } if(n>=1000){ m[1]=n/1000; n%=1000; } if(n>=100){ m[2]=n/100; n%=100; } if(n>=10){ m[3]=n/10; n%=10; } m[4]=n; for(int i=0;i<5;i++){ //System.out.println(m[i]); switch(m[i]){ case 0:{ ch[i]="* = ****".toCharArray(); break; } case 1:{ ch[i]="* =* ***".toCharArray(); break; } case 2:{ ch[i]="* =** **".toCharArray(); break; } case 3:{ ch[i]="* =*** *".toCharArray(); break; } case 4:{ ch[i]="* =**** ".toCharArray(); break; } case 5:{ ch[i]=" *= ****".toCharArray(); break; } case 6:{ ch[i]=" *=* ***".toCharArray(); break; } case 7:{ ch[i]=" *=** **".toCharArray(); break; } case 8:{ ch[i]=" *=*** *".toCharArray(); break; } case 9:{ ch[i]=" *=**** ".toCharArray(); break; } } } for(int i=0;i<8;i++){ for(int j=0;j<5;j++){ System.out.print(ch[j][i]); } System.out.println(); } } }
Main.java:3: error: class AOJ0128 is public, should be declared in a file named AOJ0128.java public class AOJ0128 { ^ 1 error
s433466860
p00128
C
#include <stdio.h> main(){ char data[10], data1[10]; int i, j, p=0, temp, c=0, l; while(1){ for(i=0;i<5;i++){ data[i]='0'; } for(i=0;i<6;i++){ if(scanf("%c", &data1[i])==EOF){ p=-1; break; } if(data1[i]=='\n'){ temp=i; break; } } for(i=0;i<temp;i++){ data[i+5-temp]=data1[i]; } if(p==-1) break; if(c!=0) printf("\n"); c=1; for(i=0;i<5;i++){ if(data[i]=='0' || data[i]=='1' || data[i]=='2' || data[i]=='3' || data[i]=='4') printf("*"); else printf(" "); } printf("\n"); for(i=0;i<5;i++){ if(data[i]=='5' || data[i]=='6' || data[i]=='7' || data[i]=='8' || data[i]=='9') printf("*"); else printf(" "); } printf("\n"); printf("=====\n"); /*for(i=0;i<5;i++){ if(data[i]=='0' || data[i]=='5') printf(" "); else printf("*"); } printf("\n"); for(i=0;i<5;i++){ if(data[i]=='1' || data[i]=='6') printf(" "); else printf("*"); } printf("\n"); for(i=0;i<5;i++){ if(data[i]=='2' || data[i]=='7') printf(" "); else printf("*"); } printf("\n"); for(i=0;i<5;i++){ if(data[i]=='3' || data[i]=='8') printf(" "); else printf("*"); } printf("\n"); for(i=0;i<5;i++){ if(data[i]=='4' || data[i]=='9') printf(" "); else printf("*"); } printf("\n"); */ for(l = 0; l < 5; l++) { for(i = 0; i < 5; i++) { if((data[i]-'0') % 5 == l) printf(" "); else printf("*"); } printf("\n"); } return 0; }
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int] 3 | main(){ | ^~~~ main.c: In function 'main': main.c:75:1: error: expected declaration or statement at end of input 75 | } | ^
s537533606
p00128
C
putchar('\n');#include<stdio.h> #include<string.h> #include<stdlib.h> int main(void){ int num,keta[5]; int i,j; scanf("%d",&num); for(i=0;i<5;i++){ keta[4-i]=num%10; num/=10; } /*for(i=0;i<5;i++){ printf("%d",keta[i]); } putchar('\n');*/ for(i=0;i<8;i++){ for(j=0;j<5;j++){ switch(i){ case 0: putchar((keta[j]/5)?' ':'*'); break; case 1: putchar((keta[j]/5)?'*':' '); break; case 2: putchar('='); break; case 3: putchar((keta[j]%5)?'*':' '); break; case 4: putchar((keta[j]%5-1)?'*':' '); break; case 5: putchar((keta[j]%5-2)?'*':' '); break; case 6: putchar((keta[j]%5-3)?'*':' '); break; case 7: putchar((keta[j]%5-4)?'*':' '); break; case 8: putchar((keta[j]%5-5)?'*':' '); break; } } putchar('\n'); } putchar('\n'); return 0; }
main.c:1:9: error: expected declaration specifiers or '...' before '\xa' 1 | putchar('\n');#include<stdio.h> | ^~~~ main.c:1:15: error: stray '#' in program 1 | putchar('\n');#include<stdio.h> | ^ main.c:1:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | putchar('\n');#include<stdio.h> | ^ In file included from main.c:2: /usr/include/string.h:44:22: error: unknown type name 'size_t' 44 | size_t __n) __THROW __nonnull ((1, 2)); | ^~~~~~ /usr/include/string.h:34:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' 33 | #include <stddef.h> +++ |+#include <stddef.h> 34 | /usr/include/string.h:47:56: error: unknown type name 'size_t' 47 | extern void *memmove (void *__dest, const void *__src, size_t __n) | ^~~~~~ /usr/include/string.h:47:56: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:55:32: error: unknown type name 'size_t' 55 | int __c, size_t __n) | ^~~~~~ /usr/include/string.h:55:32: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:61:42: error: unknown type name 'size_t' 61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); | ^~~~~~ /usr/include/string.h:61:42: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:64:56: error: unknown type name 'size_t' 64 | extern int memcmp (const void *__s1, const void *__s2, size_t __n) | ^~~~~~ /usr/include/string.h:64:56: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:80:60: error: unknown type name 'size_t' 80 | extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n) | ^~~~~~ /usr/include/string.h:80:60: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:107:48: error: unknown type name 'size_t' 107 | extern void *memchr (const void *__s, int __c, size_t __n) | ^~~~~~ /usr/include/string.h:107:48: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:145:53: error: unknown type name 'size_t' 145 | const char *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:145:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:153:23: error: unknown type name 'size_t' 153 | size_t __n) __THROW __nonnull ((1, 2)); | ^~~~~~ /usr/include/string.h:153:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:159:57: error: unknown type name 'size_t' 159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n) | ^~~~~~ /usr/include/string.h:159:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:166:8: error: unknown type name 'size_t' 166 | extern size_t strxfrm (char *__restrict __dest, | ^~~~~~ /usr/include/string.h:166:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:167:54: error: unknown type name 'size_t' 167 | const char *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:167:54: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:179:8: error: unknown type name 'size_t' 179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, | ^~~~~~ /usr/include/string.h:179:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:179:59: error: unknown type name 'size_t' 179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, | ^~~~~~ /usr/include/string.h:179:59: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:195:45: error: unknown type name 'size_t' 195 | extern char *strndup (const char *__string, size_t __n) | ^~~~~~ /usr/include/string.h:195:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:293:8: error: unknown type name 'size_t' 293 | extern size_t strcspn (const char *__s, const char *__reject) | ^~~~~~ /usr/include/string.h:293:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:297:8: error: unknown type name 'size_t' 297 | extern size_t strspn (const char *__s, const char *__accept) | ^~~~~~ /usr/include/string.h:297:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:389:46: error: unknown type name 'size_t' 389 | extern void *memmem (const void *__haystack, size_t __haystacklen, | ^~~~~~ /usr/include/string.h:389:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:390:44: error: unknown type name 'size_t' 390 | const void *__needle, size_t __needlelen) | ^~~~~~ /usr/include/string.h:390:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:398:55: error: unknown type name 'size_t' 398 | const void *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:398:55: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:401:53: error: unknown type name 'size_t' 401 | const void *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:401:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:407:8: error: unknown type name 'size_t' 407 | extern size_t strlen (const char *__s) | ^~~~~~ /usr/include/string.h:407:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:413:8: error: unknown type name 'size_t' 413 | extern size_t strnlen (const char *__string, size_t __maxlen) | ^~~~~~ /usr/include/string.h:413:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:413:46: error: unknown type name 'size_t' 413 | extern size_t strnlen (const char *__string, size_t __maxlen) | ^~~~~~ /usr/include/string.h:413:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/string.h:26: /usr/include/string.h:432:12: error: unknown type name 'size_t' 432 | extern int __REDIRECT_NTH (strerror_r, | ^~~~~~~~~~~~~~ /usr/include/string.h:432:12: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' In file included from /usr/include/string.h:462: /usr/include/strings.h:34:54: error: unknown type name 'size_t' 34 | extern int bcmp (const void *__s1, const void *__s2, size_t __n) | ^~~~~~ /usr/include/strings.h:24:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' 23 | #include <stddef.h> +++ |+#include <stddef.h> 24 | /usr/include/strings.h:38:53: error: unknown type name 'size_t' 38 | extern void bcopy (const void *__src, void *__dest, size_t __n) | ^~~~~~ /usr/include/strings.h:38:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/strings.h:42:31: error: unknown type name 'size_t' 42 | extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1)); | ^~~~~~ /usr/include/strings.h:42:31: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/strings.h:120:61: error: unknown type name 'size_t' 120 | extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) | ^~~~~~ /usr/include/strings.h:120:61: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/strings.h:134:27: error: unknown type name 'size_t' 134 |
s437974140
p00128
C++
cnt = 0 while True: d = [[' ' for i in range(8)] for j in range(5)] try: if (cnt != 0): cnt += 1 print n = raw_input() while len(n) < 5: n = '0' + n for i in range(len(n)): if (int(n[i]) <= 4): d[i][0] = '*' if (int(n[i]) >= 5): d[i][1] = '*' d[i][2] = '=' if (int(n[i]) != 0 and int(n[i]) != 5): d[i][3] = '*' if (int(n[i]) != 1 and int(n[i]) != 6): d[i][4] = '*' if (int(n[i]) != 2 and int(n[i]) != 7): d[i][5] = '*' if (int(n[i]) != 3 and int(n[i]) != 8): d[i][6] = '*' if (int(n[i]) != 4 and int(n[i]) != 9): d[i][7] = '*' for i in range(8): s = "" for j in range(5): s += d[j][i] print s except: break
a.cc:1:1: error: 'cnt' does not name a type; did you mean 'int'? 1 | cnt = 0 | ^~~ | int
s152471854
p00128
C++
#include <string> #include <iostream> using namespace std; string s; int c; int main() { while(cin >> s) { if(c++) printf("\n"); while(s.size() != 5) s = "0" + s; for(int i = 0; i < 5; i++) printf("%c", s[i] < '5' ? '*' : ' '); printf("\n"); for(int i = 0; i < 5; i++) printf("%c", s[i] > '4' ? '*' : ' '); printf("\n"); printf("=====\n"); for(int i = 0; i < 5; i++) { for(int j = 0; j < 5; j++) printf("%c", (s[i] - 48) % 5 == i ? ' ' : '*'); pritf("\n"); } } }
a.cc: In function 'int main()': a.cc:13:100: error: 'pritf' was not declared in this scope; did you mean 'printf'? 13 | for(int j = 0; j < 5; j++) printf("%c", (s[i] - 48) % 5 == i ? ' ' : '*'); pritf("\n"); | ^~~~~ | printf
s049365758
p00128
C++
#include <iostream> using namespace std; int main() { char abacus[8][10] = { "***** ", " *****", "==========", " **** ****", "* **** ***", "** **** **", "*** **** *", "**** **** ", }; int n; while (cin >> n){ int num[5]; char a[8][5]; for (int i = 0; i < 5; i++){ num[4 - i] = n % 10; n /= 10; } for (int i = 0; i < 8; i++){ for (int j = 0; j < 5; j++){ a[i][j] = abacus[i][num[j]]; } } for (int i = 0; i < 8; i++){ for (int j = 0; j < 5; j++){ cout << a[i][j]; } cout << endl; } cout << endl; } return (0); }
a.cc: In function 'int main()': a.cc:7:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 7 | "***** ", | ^~~~~~~~~~~~ a.cc:8:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 8 | " *****", | ^~~~~~~~~~~~ a.cc:9:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 9 | "==========", | ^~~~~~~~~~~~ a.cc:10:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 10 | " **** ****", | ^~~~~~~~~~~~ a.cc:11:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 11 | "* **** ***", | ^~~~~~~~~~~~ a.cc:12:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 12 | "** **** **", | ^~~~~~~~~~~~ a.cc:13:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 13 | "*** **** *", | ^~~~~~~~~~~~ a.cc:14:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 14 | "**** **** ", | ^~~~~~~~~~~~
s682938241
p00128
C++
#include <iostream> #include <cstdio> using namespace std; int main() { char abacus[8][10] = { "***** ", " *****", "==========", " **** ****", "* **** ***", "** **** **", "*** **** *", "**** **** ", }; int n; while (scanf("%d", &n) != EOF){ int num[5]; char a[8][5]; for (int i = 0; i < 5; i++){ num[4 - i] = n % 10; n /= 10; } for (int i = 0; i < 8; i++){ for (int j = 0; j < 5; j++){ a[i][j] = abacus[i][num[j]]; } } for (int i = 0; i < 8; i++){ for (int j = 0; j < 5; j++){ cout << a[i][j]; } cout << endl; } cout << endl; } return (0); }
a.cc: In function 'int main()': a.cc:8:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 8 | "***** ", | ^~~~~~~~~~~~ a.cc:9:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 9 | " *****", | ^~~~~~~~~~~~ a.cc:10:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 10 | "==========", | ^~~~~~~~~~~~ a.cc:11:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 11 | " **** ****", | ^~~~~~~~~~~~ a.cc:12:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 12 | "* **** ***", | ^~~~~~~~~~~~ a.cc:13:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 13 | "** **** **", | ^~~~~~~~~~~~ a.cc:14:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 14 | "*** **** *", | ^~~~~~~~~~~~ a.cc:15:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 15 | "**** **** ", | ^~~~~~~~~~~~
s279323601
p00128
C++
#include <iostream> #include <cstdio> using namespace std; int main(void) { char abacus[8][10] = { "***** ", " *****", "==========", " **** ****", "* **** ***", "** **** **", "*** **** *", "**** **** ", }; int n; while (scanf("%d", &n) != EOF){ int num[5]; char a[8][5]; for (int i = 0; i < 5; i++){ num[4 - i] = n % 10; n /= 10; } for (int i = 0; i < 8; i++){ for (int j = 0; j < 5; j++){ a[i][j] = abacus[i][num[j]]; } } for (int i = 0; i < 8; i++){ for (int j = 0; j < 5; j++){ cout << a[i][j]; } cout << endl; } cout << endl; } return (0); }
a.cc: In function 'int main()': a.cc:8:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 8 | "***** ", | ^~~~~~~~~~~~ a.cc:9:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 9 | " *****", | ^~~~~~~~~~~~ a.cc:10:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 10 | "==========", | ^~~~~~~~~~~~ a.cc:11:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 11 | " **** ****", | ^~~~~~~~~~~~ a.cc:12:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 12 | "* **** ***", | ^~~~~~~~~~~~ a.cc:13:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 13 | "** **** **", | ^~~~~~~~~~~~ a.cc:14:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 14 | "*** **** *", | ^~~~~~~~~~~~ a.cc:15:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 15 | "**** **** ", | ^~~~~~~~~~~~
s177115176
p00128
C++
#include <iostream> #include <cstdio> using namespace std; int main(void) { char abacus[8][10] = { "***** ", " *****", "==========", " **** ****", "* **** ***", "** **** **", "*** **** *", "**** **** ", }; int n; bool flag = false; while (scanf("%d", &n) != EOF){ int num[5]; char a[8][5]; for (int i = 0; i < 5; i++){ num[4 - i] = n % 10; n /= 10; } for (int i = 0; i < 8; i++){ for (int j = 0; j < 5; j++){ a[i][j] = abacus[i][num[j]]; } } if (flag){ cout << endl; } for (int i = 0; i < 8; i++){ for (int j = 0; j < 5; j++){ cout << a[i][j]; } cout << endl; } flag = true; } return (0); }
a.cc: In function 'int main()': a.cc:8:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 8 | "***** ", | ^~~~~~~~~~~~ a.cc:9:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 9 | " *****", | ^~~~~~~~~~~~ a.cc:10:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 10 | "==========", | ^~~~~~~~~~~~ a.cc:11:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 11 | " **** ****", | ^~~~~~~~~~~~ a.cc:12:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 12 | "* **** ***", | ^~~~~~~~~~~~ a.cc:13:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 13 | "** **** **", | ^~~~~~~~~~~~ a.cc:14:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 14 | "*** **** *", | ^~~~~~~~~~~~ a.cc:15:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 15 | "**** **** ", | ^~~~~~~~~~~~
s810755823
p00128
C++
#include <iostream> #include <cstdio> using namespace std; int main(void) { char abacus[8][10] = { "***** ", " *****", "==========", " **** ****", "* **** ***", "** **** **", "*** **** *", "**** **** ", }; int n; bool flag = false; while (scanf("%d", &n) != EOF){ int num[5]; char a[8][5]; for (int i = 0; i < 5; i++){ num[4 - i] = n % 10; n /= 10; } for (int i = 0; i < 8; i++){ for (int j = 0; j < 5; j++){ a[i][j] = abacus[i][num[j]]; } } if (flag){ cout << endl; } for (int i = 0; i < 8; i++){ for (int j = 0; j < 5; j++){ cout << a[i][j]; } cout << endl; } flag = true; } return (0); }
a.cc: In function 'int main()': a.cc:8:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 8 | "***** ", | ^~~~~~~~~~~~ a.cc:9:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 9 | " *****", | ^~~~~~~~~~~~ a.cc:10:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 10 | "==========", | ^~~~~~~~~~~~ a.cc:11:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 11 | " **** ****", | ^~~~~~~~~~~~ a.cc:12:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 12 | "* **** ***", | ^~~~~~~~~~~~ a.cc:13:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 13 | "** **** **", | ^~~~~~~~~~~~ a.cc:14:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 14 | "*** **** *", | ^~~~~~~~~~~~ a.cc:15:17: error: initializer-string for 'char [10]' is too long [-fpermissive] 15 | "**** **** ", | ^~~~~~~~~~~~
s843110620
p00128
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ bool f=0; int n,i,j; int a[5]; char a0[11][10]={"* = ****","* =* ***","* =** **","* =*** *","* =**** "," *= ****"," *=* ***"," *=** **"," *=*** *"," *=**** "}; while((cin>>n)!="EOF"){ if(f==1) cout<<endl; a[0]=n/10000; a[1]=(n-a[0]*10000)/1000; a[2]=(n-a[0]*10000-a[1]*1000)/100; a[3]=(n-a[0]*10000-a[1]*1000-a[2]*100)/10; a[4]=(n-a[0]*10000-a[1]*1000-a[2]*100-a[3]*10); for(i=0;i<8;i++){ for(j=0;j<5;j++){ cout<<a0[a[j]][i]; } cout<<endl; } f=1; } return 0; }
a.cc: In function 'int main()': a.cc:10:23: error: no match for 'operator!=' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'const char [4]') 10 | while((cin>>n)!="EOF"){ | ~~~~~~~~^~~~~~~ | | | | | const char [4] | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::fpos<_StateT>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::allocator<_CharT>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 651 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 658 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed: a.cc:10:25: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'const char*' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3847 | operator!=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed: a.cc:10:25: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2613 | operator!=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator!=(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _T
s300817731
p00128
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ bool f=false; int n,i,j; int a[5]; char a0[11][10]={"* = ****","* =* ***","* =** **","* =*** *","* =**** "," *= ****"," *=* ***"," *=** **"," *=*** *"," *=**** "}; while((cin>>n)!="EOF"){ if(f==true) cout<<endl; a[0]=n/10000; a[1]=(n-a[0]*10000)/1000; a[2]=(n-a[0]*10000-a[1]*1000)/100; a[3]=(n-a[0]*10000-a[1]*1000-a[2]*100)/10; a[4]=(n-a[0]*10000-a[1]*1000-a[2]*100-a[3]*10); for(i=0;i<8;i++){ for(j=0;j<5;j++){ cout<<a0[a[j]][i]; } cout<<endl; } f=true; } return 0; }
a.cc: In function 'int main()': a.cc:10:23: error: no match for 'operator!=' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'const char [4]') 10 | while((cin>>n)!="EOF"){ | ~~~~~~~~^~~~~~~ | | | | | const char [4] | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::fpos<_StateT>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::allocator<_CharT>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 651 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 658 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed: a.cc:10:25: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'const char*' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3847 | operator!=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed: a.cc:10:25: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2613 | operator!=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed: a.cc:10:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 10 | while((cin>>n)!="EOF"){ | ^~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator!=(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _T
s510395892
p00128
C++
#include <bits/stdc++.h> using namespace std; int main() { string N; bool flag = false; while (cin >> N) { if (flag) cout << enld; flag = true; while (N.size() < 5) N = "0" + N; vector<string> s(8); s[2] = "====="; for (int i = 0; i < N.size(); i++) { int n = N[i] - '0'; if (n > 4) { s[1] += '*'; s[0] += ' '; } else { s[0] += '*'; s[1] += ' '; } int p; if (n >= 5) p = n - 5; else p = n; for (int j = 0; j < p; j++) { s[3+j] += "*"; } s[3+p] += ' '; for (int j = 4+p; j < 8; j++) { s[j] += '*'; } } for (auto i : s) cout << i << endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:27: error: 'enld' was not declared in this scope 8 | if (flag) cout << enld; | ^~~~
s009585111
p00128
C++
#include<iostream> #include<math.h> #include<vector> #include<algorithm> #include<cstdio> using namespace std; int main() { string s; string soro[10] = {"* = ****", "* =* ***", "* =** **", "* =*** *", "* =**** ", " *= ****", " *=* ***", " *=** **", " *=*** *", " *=**** "}; bool flag = true; while(cin >> s) { vector<char> c; rep(i,5-s.size()) { c.push_back('0'); } rep(i,s.size()) { c.push_back(s[i]); } if(flag) { flag = false; } else { cout << endl; } rep(i,8) { rep(j,5) { cout << soro[c[j]-'0'][i]; } cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:26:13: error: 'i' was not declared in this scope 26 | rep(i,5-s.size()) | ^ a.cc:26:9: error: 'rep' was not declared in this scope; did you mean 'frexp'? 26 | rep(i,5-s.size()) | ^~~ | frexp
s346153358
p00128
C++
#include <cstdio> #include <string> using namespace std; int main() { bool aster[10][7]={0}; for(int i=0; i<10; i++) { if(i<=4) aster[i][0]=1; else aster[i][1]=1; } for(int i=0; i<5; i++) for(int j=0; j<10; j++) if(i!=(j%5)) aster[j][i+2]=1; bool f=false; char buf[9]; while(scanf("%s", buf) != EOF) { if(f) puts(""); f=true; char str[9]; int cnt[7]={0}, len=strlen(buf); for(int i=0; i<5; i++) { if(5-len<=i) str[i]=buf[i-(5-len)]; else str[i]='0'; } str[5]='\0'; for(int i=0; i<7; i++) for(int j=0; j<5; j++) { if(aster[str[j]-'0'][i]) cnt[i]++; } for(int i=0; i<7; i++) { for(int j=0; j<5; j++) { if(cnt[i]==0) break; if(aster[str[j]-'0'][i]) printf("*"); else printf(" "); } puts(""); if(i==1) puts("====="); } } }
a.cc: In function 'int main()': a.cc:26:37: error: 'strlen' was not declared in this scope 26 | int cnt[7]={0}, len=strlen(buf); | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <string> +++ |+#include <cstring> 3 | using namespace std;
s820027570
p00128
C++
#include<iostream> int main() { char abacus[8][5]; bool first=true; while(1) { int num; std::cin>>num; if(std::cin.eof())break; for(int c=4;c>=0;i--) { int digit=num%10; num/=10; int q=digit/5; int s=digit%5; int i=0; if(q==1) { abacus[0][c]=' '; abacus[1][c]='*'; } else { abacus[0][c]='*'; abacus[1][c]=' '; } abacus[2][c]='='; for(i=3;i<3+s;i++) { abacus[i][c]='*'; } abacus[i++][c]=' '; for(;i<8;i++) { abacus[i][c]='*'; } } if(first){first=false;} else{std::cout<<std::endl;} for(int i=0;i<8;i++) { for(int j=0;j<5;j++) { std::cout<<abacus[i][j]; } std::cout<<std::endl; } } return 0; }
a.cc: In function 'int main()': a.cc:14:34: error: 'i' was not declared in this scope 14 | for(int c=4;c>=0;i--) | ^
s493590363
p00129
C
#include<stdio.h> #include<math.h> #include<algorithm> const double EPS=1e-10; typedef struct Vec{double x,y;}Vec; typedef struct Cer{double r;Vec cp;}Cer; double dot(Vec a,Vec b){return a.x*b.x+a.y*b.y;} double det(Vec a,Vec b){return a.x*b.y-a.y*b.x;} double D(Vec a){return hypot(a.x,a.y);} Vec F(Vec a,Vec b){Vec p={a.x-b.x,a.y-b.y};return p;} double ch(Vec a,Vec b,Vec c) { if(dot(F(b,a),F(c,a))<EPS)return D(F(b,a)); if(dot(F(a,b),F(c,b))<EPS)return D(F(c,b)); return fabs(det(F(b,a),F(c,a)))/D(F(b,a)); } int N,M,i,j,f; double m,d; Cer W[100]; int main() { for(;scanf("%d",&N),N;) { for(i=0;i<N;i++) scanf("%lf%lf%lf",&W[i].cp.x,&W[i].cp.y,&W[i].r); scanf("%d",&M); for(i=0;i<M;i++) { f=0; Vec t,s; scanf("%lf%lf%lf%lf",&t.x,&t.y,&s.x,&s.y); for(j=0;j<N;j++) { if(D(F(s,W[j].cp))<=W[j].r&&D(F(t,W[j].cp))<=W[j].r)continue; if(ch(t,s,W[j].cp)<=W[j].r)break; } puts(j==N?"Danger":"Safe"); } } return 0; }
main.c:3:9: fatal error: algorithm: No such file or directory 3 | #include<algorithm> | ^~~~~~~~~~~ compilation terminated.
s358772013
p00129
C
#include <stdio.h> #include <math.h> #include <stdlib.h> int i,j,n,m; int wall[200][3],tx,ty,sx,sy; int crosscheck(int tx,int ty,int sx,int sy,int wx,int wy,int rr){ int abx=sx-tx,aby=sy-ty; int awx=wx-tx,awy=wy-ty; int bwx=wx-sx,bwy=wy-sy; int rr2=rr*rr; int aw2=awx*awx+awy*awy; int bw2=bwx*bwx+bwy*bwy; int ab2=abx*abx+aby*aby; int tim=abx*awy-aby*awx; int abw=abx*awx+aby*awy; if((aw2-rr2)*(bw2-rr2)<0)return 1; if(aw2<rr2 && bw2<rr2)return 0; if(abw<0)return 0; if(abw>ab2)return 0; if((double)tim*tim/ab2 - (double)rr2 > -0.001 (double)tim*tim/ab2 - (double)rr2 < 0.001) fprintf(stderr,"!!\n"); if( (double)tim*tim/ab2 > (double)rr2)return 0; return 1; } int main(){ while(scanf("%d",&n)*n){ for(i=0;i<n;i++)scanf("%d %d %d",&wall[i][0],&wall[i][1],&wall[i][2]); for(scanf("%d",&m);m>0;m--){ scanf("%d %d %d %d",&tx,&ty,&sx,&sy); int sss=0; for(i=0;i<n;i++){ int wx=wall[i][0],wy=wall[i][1],rr=wall[i][2]; if(crosscheck(tx,ty,sx,sy,wx,wy,rr))break; } if(i<n)printf("Safe\n"); else printf("Danger\n"); } } return 0; }
main.c: In function 'crosscheck': main.c:26:56: error: expected expression before 'double' 26 | if((double)tim*tim/ab2 - (double)rr2 > -0.001 (double)tim*tim/ab2 - (double)rr2 < 0.001) fprintf(stderr,"!!\n"); | ^~~~~~ main.c:26:49: error: called object is not a function or function pointer 26 | if((double)tim*tim/ab2 - (double)rr2 > -0.001 (double)tim*tim/ab2 - (double)rr2 < 0.001) fprintf(stderr,"!!\n"); | ^~~~~ main.c:26:63: error: expected ')' before 'tim' 26 | if((double)tim*tim/ab2 - (double)rr2 > -0.001 (double)tim*tim/ab2 - (double)rr2 < 0.001) fprintf(stderr,"!!\n"); | ~ ^~~ | )
s462120856
p00129
C
#include <stdio.h> #include <math.h> #include <stdlib.h> int i,j,n,m; int wall[200][3],tx,ty,sx,sy; int crosscheck(int tx,int ty,int sx,int sy,int wx,int wy,int rr){ int abx=tx-sx,aby=ty-sy; int awx=wx-sx,awy=wy-sy; int rr2=rr*rr; int aw2=awx*awx+awy*awy; int bw2=bwx*bwx+bwy*bwy; int ab2=abx*abx+aby*aby; int tim=abx*awy-aby*awx; int abw=abx*awx+aby*awy; if((aw2-rr2)*(bw2-rr2)<0)return 1; if(aw2<rr2 && bw2<rr2)return 0; if(abw<0)return 0; if(abw>ab2)return 0; if( (double)tim*(double)tim/(double)ab2 <= (double)rr2)return 1; return 0; } int main(){ while(scanf("%d",&n)*n){ for(i=0;i<n;i++)scanf("%d %d %d",&wall[i][0],&wall[i][1],&wall[i][2]); for(scanf("%d",&m);m>0;m--){ scanf("%d %d %d %d",&tx,&ty,&sx,&sy); int sss=0; for(i=0;i<n;i++){ int wx=wall[i][0],wy=wall[i][1],rr=wall[i][2]; if(crosscheck(tx,ty,sx,sy,wx,wy,rr))break; } if(i<n)printf("Safe\n"); else printf("Danger\n"); } } return 0; }
main.c: In function 'crosscheck': main.c:15:17: error: 'bwx' undeclared (first use in this function); did you mean 'bw2'? 15 | int bw2=bwx*bwx+bwy*bwy; | ^~~ | bw2 main.c:15:17: note: each undeclared identifier is reported only once for each function it appears in main.c:15:25: error: 'bwy' undeclared (first use in this function); did you mean 'bw2'? 15 | int bw2=bwx*bwx+bwy*bwy; | ^~~ | bw2
s276215337
p00129
C++
#include <iostream> using namespace std; #define rep2(x,from,to) for(int x=(from);x<(to);++(x)) #define rep(x,to) rep2(x,0,to) double dot(double ax, double ay, double bx, double by) { return ax*bx+ay*by; } int main() { int n,m; while(cin >> n, n) { double x[100],y[100],r[100]; rep(i,n) { cin >> x[i] >> y[i] >> r[i]; } cin >> m; double tx,ty,sx,sy; rep(i,m) { cin >> tx >> ty >> sx >> sy; bool flag = 0; rep(j,n) { double vx1 = tx-sx, vy1 = ty-sy; double vx2 = x[j]-sx, vy2 = y[j]-sy; double slen = sqrt(vx2*vx2+vy2*vy2); double tlen = sqrt(pow(x[j]-tx,2)+pow(y[j]-ty,2)); if(slen<r[j] && tlen>r[j] || slen>r[j] && tlen<r[j]) { flag = 1; break; } else { double n1 = dot(vx1,vy1,vx2,vy2); double n2 = dot(vx1,vy1,vx1,vy1); double n3 = dot(vx2,vy2,vx2,vy2); if(n1>0 && n2>n1 && !(tlen<r[j]&&slen<r[j]) && n3-(n1/n2)*n1<=r[j]*r[j]) { flag = 1; break; } } } if(flag) cout << "Safe" << endl; else cout << "Danger" << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:23:47: error: 'sqrt' was not declared in this scope 23 | double slen = sqrt(vx2*vx2+vy2*vy2); | ^~~~ a.cc:24:52: error: 'pow' was not declared in this scope 24 | double tlen = sqrt(pow(x[j]-tx,2)+pow(y[j]-ty,2)); | ^~~
s835157191
p00129
C++
#include <iostream> #include <algorithm> #include <string> #include <math.h> using namespace std; #define EPS 1e-7 int n, m, wall[100][3], pp[4]; bool jud; int main(){ cin >> n; for(int i = 0; i < n; i++){ cin >> wall[i][0] >> wall[i][1] >> wall[i][2]; } cin >> m; for(int i = 0; i < m; i++){ for(int j = 0; j < 4; j++){ cin >> pp[j]; } double dx = pp[0] - pp[2], dy = pp[1] - pp[3], kmk, spn; if(dx) kmk = dy / dx; else{ for(int j = 0; j < n; j++){ double a = 1, b = -2 * wall[j][1], c = (pp[0] - wall[j][0]) * (pp[0] - wall[j][0]) + wall[j][1] * wall[j][1] - wall[j][2] * wall[j][2]; if(b * b - 4 * a * c < -EPS){ continue; } else if(b * b - 4 * a * c < 0){ aa = 0; } if(b * b - 4 * a * c >= 0){ double aa = (sqrt(b * b - 4 * a * c) - b) / (2 * a); if(aa >= pp[1] && aa <= pp[3]){ jud = 1; break; } if(aa >= pp[3] && aa <= pp[1]){ jud = 1; break; } aa = (-sqrt(b * b - 4 * a * c) - b) / (2 * a); // cout << aa << endl; if(aa >= pp[1] && aa <= pp[3]){ jud = 1; break; } if(aa >= pp[3] && aa <= pp[1]){ jud = 1; break; } } } if(jud) cout << "Safe" << endl; else cout << "Danger" << endl; continue; } spn = -kmk * pp[0] + pp[1]; jud = 0; for(int j = 0; j < n; j++){ double a = 1 + kmk * kmk, b = -2 * wall[j][0] + 2 * kmk * spn - 2 * kmk * wall[j][1], c = wall[j][0] * wall[j][0] + wall[j][1] * wall[j][1] + spn * spn - 2 * spn * wall[j][1] - wall[j][2] * wall[j][2]; if(b * b - 4 * a * c < -EPS){ continue; } else if(b * b - 4 * a * c < 0){ aa = 0; } if(b * b - 4 * a * c >= 0){ double aa = (sqrt(b * b - 4 * a * c) - b) / (2 * a); if(aa >= pp[0] && aa <= pp[2]){ jud = 1; break; } if(aa >= pp[2] && aa <= pp[0]){ jud = 1; break; } aa = (-sqrt(b * b - 4 * a * c) - b) / (2 * a); if(aa >= pp[0] && aa <= pp[2]){ jud = 1; break; } if(aa >= pp[2] && aa <= pp[0]){ jud = 1; break; } } } if(jud) cout << "Safe" << endl; else cout << "Danger" << endl; } }
a.cc: In function 'int main()': a.cc:29:41: error: 'aa' was not declared in this scope; did you mean 'a'? 29 | aa = 0; | ^~ | a a.cc:67:41: error: 'aa' was not declared in this scope; did you mean 'a'? 67 | aa = 0; | ^~ | a
s476410287
p00129
C++
#include <bits/stdc++.h> using namespace std; typedef complex<double> P; typedef pair<double, P> C; vector<C> circles; #define FST first #define SND second typedef pair<P, P> S; double dot(P a, P b) { return a.real()*b.real()+a.imag()*b.imag(); } double cross(P a, P b) { return a.real()*b.imag()-a.imag()*b.real(); } double distanceLP(S s, P a) { // d = |y||sin(th)| = |x||y|sin(th)/|x| = |cross(x, y)|/|x| return abs(cross(s.SND-s.FST, a-s.FST)) / abs(s.SND-s.FST); } double distanceSP(S s, P a) { // 2ベクトルのなす角が鈍角なら端点と1点との距離を返す if (dot(s.SND-s.FST, a-s.FST) < EPS) return abs(a-s.FST); if (dot(s.FST-s.SND, a-s.SND) < EPS) return abs(a-s.SND); return distanceLP(s, a); } int main() { int N; while(cin >> N && N) { circles.clear(); circles.resize(N); for(int i=0; i<N; i++) { int x, y, r; cin >> x >> y >> r; circles[i] = C(r, P(x, y)); } int Q; cin >> Q; while(Q--) { int x, y; cin >> x >> y; P taro(x, y); cin >> x >> y; P ogre(x, y); for(int i=0; i<N; i++) { if(distanceSP(S(taro, ogre), circles[i].SND) < circles[i].FST) { if( abs(circles[i].SND-taro) > circles[i].FST || abs(circles[i].SND-ogre) > circles[i].FST) { cout << "Safe" << endl; goto EXIT; } } } cout << "Danger" << endl; EXIT:; } } return 0; }
a.cc: In function 'double distanceSP(S, P)': a.cc:26:35: error: 'EPS' was not declared in this scope 26 | if (dot(s.SND-s.FST, a-s.FST) < EPS) return abs(a-s.FST); | ^~~ a.cc:27:35: error: 'EPS' was not declared in this scope 27 | if (dot(s.FST-s.SND, a-s.SND) < EPS) return abs(a-s.SND); | ^~~
s956423997
p00130
Java
gimport java.util.*; import java.io.*; import static java.lang.Math.*; class Main { public static void main( final String[] args ) { final Scanner stdin = new Scanner( System.in ); final int n = Integer.parseInt( stdin.nextLine() ); for ( int t = 0; t < n; t++ ) { final String input = stdin.nextLine(); final char[] train = new char[53]; int index = 26; train[index] = input.charAt( 0 ); for ( int i = 1; i < ( input.length() + 2 ) / 3; i++ ) { if ( input.substring( i * 3 - 2, i * 3 ).equals( "->" ) ){ index++; } else { index--; } train[index] = input.charAt( i * 3 ); } index = 0; while ( train[index] == 0 ) { index++; } while ( train[index] > 0 ) { System.out.print( train[index] ); index++; } System.out.println(); } } }
Main.java:1: error: class, interface, enum, or record expected gimport java.util.*; ^ Main.java:2: error: class, interface, enum, or record expected import java.io.*; ^ Main.java:3: error: class, interface, enum, or record expected import static java.lang.Math.*; ^ 3 errors
s975343940
p00130
C++
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cctype> #include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <cstring> #include <string> #include <sstream> #include <algorithm> #include <iomanip> using namespace std; typedef vector<int> VI; typedef vector<VI> VII; typedef pair<int, int> PII; typedef long long ll; #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back; #define MP make_pair #define SIZE(a) int((a).size()) #define SORT(c) sort((c).begin(), (c).end()) const double EPS = 1e-10; const double PI = acos(-1.0); const int INF = INT_MAX / 3; int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1}; #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; string solve(string &input){ string train(input, 0, 1); int f = 0, b = 0, n = 0; for(int i = 1; i < input.size(); i++){ if(input[i] == '<') n++; else if(input[i] == '>') n--; else if(input[i] != '-' && n > f) { train.insert(train.begin(), input[i]); f = n;} else if(input[i] != '-' && n < b) { train.insert(train.end(), input[i]); b = n;} } return train; } int main(void){ int n; cin >> n; for(int i = 0; i < n; i++){ string input; cin >> input; cout << solve(input) << endl; } return 0; }
a.cc:32:17: error: 'INT_MAX' was not declared in this scope 32 | const int INF = INT_MAX / 3; | ^~~~~~~ a.cc:16:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 15 | #include <iomanip> +++ |+#include <climits> 16 | using namespace std;
s414664747
p00130
C++
#include <stdio.h> #include <string.h> // int search(char[], char, int); // void swap(char[], int, int); void pre_connect(char[], char, int); int main (){ int n, i, j, count, idx; char str[1024], line[60], train; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%s",str); line[0] = str[0]; count = 1; idx=0; for(j=2; j<strlen(str); j+=3){ if(str[j] == '>'){ if(line[idx+1] == str[j+1]){ idx++; } else { line[count++] = str[j+1]; idx++; } } else { if(line[idx-1] == str[j+1]){ idx--; } else { pre_connect(line, str[j+1], count); count++; } } } line[count] = '\0'; printf("%s\n", line); } return 0; } /* int search(char line[], char t, int count){ int i; for(i=0; i<count; i++){ if(line[i] == t){ return i; } } return -1; } void swap(char line[], int i, int j){ char tmp; tmp = line[i]; line[i] = line[j]; line[j] = tmp; } */ void pre_connect(char line[], char t, int count){ int i; char new[60]; new[0] = t; for(i=1; i<=count; i++){ new[i] = line[i-1]; } new[i] = '\0'; strcpy(line, new); }
a.cc: In function 'void pre_connect(char*, char, int)': a.cc:65:10: error: expected unqualified-id before 'new' 65 | char new[60]; | ^~~ a.cc:67:8: error: expected type-specifier before '[' token 67 | new[0] = t; | ^ a.cc:70:12: error: expected type-specifier before '[' token 70 | new[i] = line[i-1]; | ^ a.cc:72:8: error: expected type-specifier before '[' token 72 | new[i] = '\0'; | ^ a.cc:74:21: error: expected type-specifier before ')' token 74 | strcpy(line, new); | ^
s801494977
p00130
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >>n; string s; cin >>s; for(int i=0;i<n;i++){ int array[60]; array[30]=s[0]; int t=30; for(int i=0;i<s.length();i++){ if(){ t += 1; array[t]=s[3*i]; }else{ t -= 1; array[t]=s[3*i]; } } for(int i=0;i<60;i++){ if(array[i]!=0){ cout <<array[i]; } } cout <<endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:7: error: expected primary-expression before ')' token 14 | if(){ | ^
s217335692
p00130
C++
#include<iostream> #include<string> void main(){ int n; std::cin >> n; for (int i = 0; i < n; i++){ char train[30]; for (int j = 0; j < 30; j++)train[j] = '?'; int it = 14; std::string str; std::cin >> str; train[it] = str[0]; for (int j = 1; j < str.size(); j++){ if (str[j] == '>'){ it++; if (train[it] != str[j + 1])train[it] = str[j + 1]; } else if (str[j] == '<'){ it--; if (train[it] != str[j + 2])train[it] = str[j + 2]; } } for (int j = 0; j < 30; j++){ if (train[j] != '?')std::cout << train[j]; } std::cout << std::endl; } }
a.cc:4:1: error: '::main' must return 'int' 4 | void main(){ | ^~~~
s887464891
p00131
Java
package nofill_nosubmit; import java.util.Scanner; public class AOJ_0131 { static int a[][]; static int light[][]; static int first[]; static boolean judge; public static void main(String[] args) { Scanner in=new Scanner(System.in); int N=in.nextInt(); while(N-->0) { a=new int[10][10]; first=new int[10]; judge=false; for(int i=0;i<10;i++) for(int j=0;j<10;j++) a[i][j]=in.nextInt(); make(0,first); for(int i=0;i<10;i++) { for(int j=0;j<10;j++) { if(j!=9) System.out.print(light[i][j]+" "); else System.out.println(light[i][j]); } } } } static void make(int n, int first[]) { if(judge) return; if(n==10) { light=new int[10][10]; solve(first,light,a); if(judge) return; } else { first[n]=0; make(n+1,first); if(judge) return; first[n]=1; make(n+1,first); if(judge) return; } } static boolean solve(int first[],int light[][],int a[][]) { for(int i=0;i<10;i++) { if(first[i]==1) { light[0][i]=1; if(a[0][i]==1) a[0][i]=0; else a[0][i]=1; if(i+1<10&&a[0][i+1]==1) a[0][i+1]=0; else if(i+1<10) a[0][i+1]=1; if(i-1>=0&&a[0][i-1]==1) a[0][i-1]=0; else if(i-1>=10) a[0][i-1]=1; if(a[1][i]==1) a[0][i]=0; else a[0][i]=1; } } for(int i=0;i<9;i++) for(int j=0;j<10;j++) { if(a[i][j]==1) { light[i+1][j]=1; lightOn(i+1,j); } } for(int i=0;i<10;i++) { for(int j=0;j<10;j++) { if(light[i][j]==0) judge=true; if(!judge) break; } if(!judge) break; } return judge; } static void lightOn(int i,int j) { if(a[i][j]==1) a[i][j]=0; else a[i][j]=1; if(j+1<10&&a[i][j+1]==1) a[i][j+1]=0; else if(j+1<10) a[i][j+1]=1; if(a[i-1][j]==1) a[i-1][j]=0; else a[i-1][j]=1; if(i+1<10&&a[i+1][j]==1) a[i+1][j]=0; else if(i+1<10) a[i+1][j]=1; if(j-1>=0&&a[i][j-1]==1) a[i][j-1]=0; else if(j-1>=0) a[i][j-1]=1; } }
Main.java:3: error: class AOJ_0131 is public, should be declared in a file named AOJ_0131.java public class AOJ_0131 ^ 1 error
s072585275
p00131
C++
#include <stdio.h> #include <iostream> #include <algorithm> #include <iomanip> #include <map> #include <fstream> #include <sstream> #include <math.h> #include <queue> #include <stack> #include <math.h> using namespace std; void f(bool box[12][12]){ for(int i=1; i<=10; i++){ for(int j=1; j<=10; j++){ cout<<box[i][j]; } cout<<endl; } cout<<endl; } int main(){ int n; while(cin>>n){ bool box[12][12]={0}; for(int i=1; i<=10; i++){ for(int j=1; j<=10; j++){ cin>>box[i][j]; } } //cout<<"----------------------"<<endl; bool box2[12][12]={0}; for(int i=0; i<(1<<10 - 1); i++){ memcpy(box2, box, sizeof(box)); int l[12][12]={0}; for(int j=1; j<=10; j++){ l[0][j]= (i>>j)%2; } for(int j=1; j<=10; j++){ for(int k=1; k<=10; k++){ if(l[j-1][k]==1){ box2[j][k]=(box2[j][k]+1)%2; box2[j][k+1]=(box2[j][k+1]+1)%2; box2[j][k-1]=(box2[j][k-1]+1)%2; box2[j-1][k]=(box2[j-1][k]+1)%2; box2[j+1][k]=(box2[j+1][k]+1)%2; } } for(int k=1; k<=10; k++){ l[j][k]=box2[j][k]; } } bool end_flag=true; for(int i=1; i<=10; i++){ if(l[10][i]==1){ end_flag=false; break; } } if(end_flag){ for(int i=1; i<=10; i++){ for(int j=1; j<=10; j++){ cout<<l[i][j]; if(j==10)break; cout<<" "; } cout<<endl; } break; } } //cout<<"============================"<<endl; } }
a.cc: In function 'int main()': a.cc:43:13: error: 'memcpy' was not declared in this scope 43 | memcpy(box2, box, sizeof(box)); | ^~~~~~ a.cc:12:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 11 | #include <math.h> +++ |+#include <cstring> 12 |
s186951301
p00131
C++
#include <iostream> using namespace std; int main() { int n; cin >> n; int state[10][10]; int ans[10][10]; while (n --) { memset(state, 0, sizeof(state)); memset(ans, 0, sizeof(ans)); for (int i=0; i<10; ++i) { for (int j=0; j<10; ++j) { cin >> state[i][j]; } } for (int i=0; i<10; ++i) { for (int j=0; j<10; ++j) { if (state[i][j] == 1) { state[i][j] = 1 - state[i][j]; state[i+1][j-1] = 1 - state[i+1][j-1]; state[i+1][j] = 1 - state[i+1][j]; state[i+1][j+1] = 1 - state[i+1][j+1]; state[i+2][j] = 1 - state[i+2][j]; ans[i+1][j] = 1; } } } for (int i=0; i<10; ++i) { for (int j=0; j<10; ++j) { cout << (j == 0 ? "" : " ") << ans[i][j]; } cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:11:9: error: 'memset' was not declared in this scope 11 | memset(state, 0, sizeof(state)); | ^~~~~~ 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 |
s716639563
p00131
C++
#include <iostream> #include <cstring> #include <algorithm> using namespace std; const int dx[] = {0, -1, 0, 1, 0}; const int dy[] = {-1, 0, 0, 0, 1}; int n; int input[10][10], state[10][10], ans[10][10]; void pass(int y, int x) { for (int i=0; i<5; ++i) { if (0 <= y + dy[i] && y + dy[i] < 10 && 0 <= x + dx[i] && x + dx[i] < 10) { state[y + dy[i]][x + dx[i]] = !state[y + dy[i]][x + dx[i]]; } } ans[y][x] = !ans[y][x]; } int main() { cin >> n; while (n --) { for (int i=0; i<10; ++i) { for (int j=0; j<10; ++j) { cin >> input[i][j]; } } for (int bt=0; bt<(1<<10); ++bt) { memcpy(state, input, sizeof(input)); memset(ans, 0, sizeof(ans)); for (int j=0; j<10; ++j) { if ((bt>>j) & 1) { pass(0, j); } } for (int i=1; i<10; ++i) { for (int j=0; j<10; ++j) { if (state[i-1][j] == 1) { pass(i, j); } } } if (accumulate(state[9], state[9] + 10, 0) == 0) break; } for (int i=0; i<10; ++i) { for (int j=0; j<10; ++j) { cout << (j == 0 ? "" : " ") << ans[i][j]; } cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:45:17: error: 'accumulate' was not declared in this scope 45 | if (accumulate(state[9], state[9] + 10, 0) == 0) break; | ^~~~~~~~~~
s422746431
p00131
C++
#include <iostream> #include <cstring> #include <algorithm> #include <functional> using namespace std; const int dx[] = {0, -1, 0, 1, 0}; const int dy[] = {-1, 0, 0, 0, 1}; int n; int input[10][10], state[10][10], ans[10][10]; void pass(int y, int x) { for (int i=0; i<5; ++i) { if (0 <= y + dy[i] && y + dy[i] < 10 && 0 <= x + dx[i] && x + dx[i] < 10) { state[y + dy[i]][x + dx[i]] = !state[y + dy[i]][x + dx[i]]; } } ans[y][x] = !ans[y][x]; } int main() { cin >> n; while (n --) { for (int i=0; i<10; ++i) { for (int j=0; j<10; ++j) { cin >> input[i][j]; } } for (int bt=0; bt<(1<<10); ++bt) { memcpy(state, input, sizeof(input)); memset(ans, 0, sizeof(ans)); for (int j=0; j<10; ++j) { if ((bt>>j) & 1) { pass(0, j); } } for (int i=1; i<10; ++i) { for (int j=0; j<10; ++j) { if (state[i-1][j] == 1) { pass(i, j); } } } if (accumulate(state[9], state[9] + 10, 0) == 0) break; } for (int i=0; i<10; ++i) { for (int j=0; j<10; ++j) { cout << (j == 0 ? "" : " ") << ans[i][j]; } cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:46:17: error: 'accumulate' was not declared in this scope 46 | if (accumulate(state[9], state[9] + 10, 0) == 0) break; | ^~~~~~~~~~
s444658860
p00131
C++
#include <iostream> #include <cstring> #include <algorithm> using namespace std; const int dx[] = {0, -1, 0, 1, 0}; const int dy[] = {-1, 0, 0, 0, 1}; int n; int input[10][10], state[10][10], ans[10][10]; void pass(int y, int x) { for (int i=0; i<5; ++i) { if (0 <= y + dy[i] && y + dy[i] < 10 && 0 <= x + dx[i] && x + dx[i] < 10) { state[y + dy[i]][x + dx[i]] = !state[y + dy[i]][x + dx[i]]; } } ans[y][x] = !ans[y][x]; } int main() { ios::sync_with_stdio(false); cin >> n; while (n --) { for (int i=0; i<10; ++i) { for (int j=0; j<10; ++j) { cin >> input[i][j]; } } for (int bt=0; bt<(1<<10); ++bt) { memcpy(state, input, sizeof(input)); memset(ans, 0, sizeof(ans)); for (int j=0; j<10; ++j) { if ((bt>>j) & 1) { pass(0, j); } } for (int i=1; i<10; ++i) { for (int j=0; j<10; ++j) { if (state[i-1][j] == 1) { pass(i, j); } } } if (accumulate(state[9], state[9] + 10, 0) == 0) break; } for (int i=0; i<10; ++i) { for (int j=0; j<10; ++j) { cout << (j == 0 ? "" : " ") << ans[i][j]; } cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:46:17: error: 'accumulate' was not declared in this scope 46 | if (accumulate(state[9], state[9] + 10, 0) == 0) break; | ^~~~~~~~~~
s594519458
p00131
C++
#include <vector> #include <iostream> #include <list> std::list<int> dfs(std::vector<std::vector<bool>> &state, const int &idx = 1) { if (idx < 10) { int res = 0; for (auto i = 0; i < 10; ++i) { res <<= 1; if (state.at(idx - 1).at(i)) { res += 1; for (const auto &index : { i - 1, i, i + 1 }) { if (index >= 0 && index < 10) { state.at(idx).at(index) = !state.at(idx).at(index); } } if (idx != 9) { state.at(idx + 1).at(i) = !state.at(idx + 1).at(i); } } } auto list = dfs(state, idx + 1); if (list.size() + idx == 9) { list.push_front(res); return list; } else { return list; } } else { bool is_on = false; for (const auto &cell : state.at(9)) { is_on = is_on || cell; } if (is_on) { return std::list<int>{0}; } else { return std::list<int>{}; } } } std::list<int> solve(std::vector<std::vector<bool>> &state) { for (auto i = 0; i < 1023; ++i) { auto copy = state; for (auto j = 0; j < 10; ++j) { if ((i & (1 << j)) != 0) { for (const auto &idx : { j - 1, j, j + 1 }) { if (idx >= 0 && idx < 10) { copy.at(0).at(idx) = !copy.at(0).at(idx); } } copy.at(1).at(j) = !copy.at(1).at(j); } } auto list = dfs(copy); if (list.size() == 9) { list.push_front(i); return list; } } return std::list<int>{}; } int main() { int n; for (std::cin >> n; n > 0; --n) { std::vector<std::vector<bool>> state(10, std::vector<bool>(10, false)); bool input; for (auto &line : state) { for (auto &cell : line) { std::cin >> input; cell = input; } } auto res = solve(state); for (const auto &line : res) { for (auto i = 512; i > 0; i >>= 1) { std::cout << static_cast<int>((i & (line)) != 0) << ((i != 1) ? ' ' : '\n'); } } } return 0; }
a.cc: In function 'int main()': a.cc:71:43: error: cannot bind non-const lvalue reference of type 'std::_Bit_reference&' to an rvalue of type 'std::_Bit_iterator::reference' 71 | for (auto &cell : line) { | ^~~~
s509332806
p00131
C++
#include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<vector> #include<queue> #include<set> #include<stack> #include<functional> #include<list> using namespace std; int c[10][10]; int f[10][10]; bool s[10][10]; int hanten[2] = { 1,0 }; int dx[5] = { -1,0,0,1,0 }, dy[5] = { 0,-1,1,0,0 }; int main() { int a; cin >> a; for (int b = 0; b < a; b++) { memset(s, false, sizeof(s)); for (int d = 0; d < 10; d++) { for (int e = 0; e < 10; e++) { scanf("%d",&c[d][e]); } } for (int g = 0; g < 1024; g++) { for (int h = 0; h < 10; h++) { for (int i = 0; i < 10; i++) { f[h][i] = c[h][i]; } } for (int h = 0; h < 10; h++) { if (g & (1 << h)) { s[0][h] = true; for (int i = 0; i < 5; i++) { int x = dx[i], y = h + dy[i]; if (x >= 0 && x < 10 && y >= 0 && y < 10) { f[x][y] = hanten[f[x][y]]; } } } } for (int h = 1; h < 10; h++) { for (int i = 0; i < 10; i++) { if (f[h - 1][i]) { s[h][i] = true; for (int j = 0; j < 5; j++) { int x = h+dx[j], y = i + dy[j]; if (x >= 0 && x < 10 && y >= 0 && y < 10) { f[x][y] = hanten[f[x][y]]; } } } } } bool K = true; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (f[i][j])K = false; } } if (K) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (j)cout << " "; cout << s[i][j]; } cout << endl; } } } } }
a.cc: In function 'int main()': a.cc:21:17: error: 'memset' was not declared in this scope 21 | memset(s, false, sizeof(s)); | ^~~~~~ a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 10 | #include<list> +++ |+#include <cstring> 11 | using namespace std;
s934350407
p00131
C++
#include<bits/stdc++>h> using namespace std; int c[10][10]; int f[10][10]; bool s[10][10]; int hanten[2] = { 1,0 }; int dx[5] = { -1,0,0,1,0 }, dy[5] = { 0,-1,1,0,0 }; int main() { int a; cin >> a; for (int b = 0; b < a; b++) { memset(s, false, sizeof(s)); for (int d = 0; d < 10; d++) { for (int e = 0; e < 10; e++) { scanf("%d",&c[d][e]); } } for (int g = 0; g < 1024; g++) { for (int h = 0; h < 10; h++) { for (int i = 0; i < 10; i++) { f[h][i] = c[h][i]; } } for (int h = 0; h < 10; h++) { if (g & (1 << h)) { s[0][h] = true; for (int i = 0; i < 5; i++) { int x = dx[i], y = h + dy[i]; if (x >= 0 && x < 10 && y >= 0 && y < 10) { f[x][y] = hanten[f[x][y]]; } } } } for (int h = 1; h < 10; h++) { for (int i = 0; i < 10; i++) { if (f[h - 1][i]) { s[h][i] = true; for (int j = 0; j < 5; j++) { int x = h+dx[j], y = i + dy[j]; if (x >= 0 && x < 10 && y >= 0 && y < 10) { f[x][y] = hanten[f[x][y]]; } } } } } bool K = true; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (f[i][j])K = false; } } if (K) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (j)cout << " "; cout << s[i][j]; } cout << endl; } } } } }
a.cc:1:23: warning: extra tokens at end of #include directive 1 | #include<bits/stdc++>h> | ^ a.cc:1:9: fatal error: bits/stdc++>: No such file or directory 1 | #include<bits/stdc++>h> | ^~~~~~~~~~~~~~ compilation terminated.
s630821873
p00131
C++
#include<iostream> #include<vector> #include<queue> #include<cstring> #define MAX 12 #define INFTY 1 << 28 using namespace std; class CMap{ public: int m[MAX][MAX]; vector< pair<int, int> > vHist; CMap(){ memset( m, 0, sizeof(*m) * sizeof(**m) ); } void PassParticle(int i, int j){ const int di[] = {0,-1,0,1,0}; const int dj[] = {0,0,1,0,-1}; for(int k = 0; k < sizeof(di)/sizeof(*di); ++k) m[i+di[k]][j+dj[k]] = (m[i+di[k]][j+dj[k]] + 1) % 2; vHist.push_back( make_pair( i, j ) ); } bool NoLight() const { for(int i = 1; i < MAX - 1; ++i) for(int j = 1; j < MAX - 1; ++j) if( m[i][j] ) return false; return true; } void Print() const { for(int i = 1; i < MAX - 1; ++i){ cout << m[i][1]; for(int j = 2; j < MAX - 1; ++j) cout << ' ' << m[i][j]; cout << '\n'; } } void PrintAns() const { int a[MAX][MAX] = {{0,},}; for( unsigned int i = 0; i < vHist.size(); ++i) a[vHist[i].first][vHist[i].second] = 1; for(int i = 1; i < MAX - 1; ++i){ cout << a[i][1]; for(int j = 2; j < MAX - 1; ++j) cout << ' ' << a[i][j]; cout << '\n'; } } bool operator==(const CMap &t) const { for(int i = 1; i < MAX - 1; ++i) for(int j = 1; j < MAX - 1; ++j) if( t.m[i][j] != m[i][j] ) return false; return true; } }; void BFS(CMap &stm, CMap &ret){ vector< CMap > q; q.push_back( stm ); while( !q.empty() ){ CMap M = q[0]; q.erase( q.begin() ); if( M.NoLight() ){ ret = M; break; } for(int i = 1; i < MAX - 1; ++i){ for(int j = 1; j < MAX - 1 ; ++j){ CMap add; int cnt1 = 0; const int di[] = {-1,0,1,0}; const int dj[] = {0,1,0,-1}; for(int k = 0; k < sizeof(di)/sizeof(*di); ++k) if( M.m[i+di[k]][j+dj[k]] ) ++cnt1; if( cnt1 >= 3 ) { add = M; add.PassParticle( i, j ); if( q.end() == find( q.begin(), q.end(), add ) ) q.push_back( add ); } } } } } int main(void){ int n; cin >> n; for( int D = 0; D < n; ++D ){ CMap M; CMap Answer; for(int i = 1; i < MAX - 1; ++i) for(int j = 1; j < MAX - 1 ; ++j) cin >> M.m[i][j]; BFS( M, Answer ); Answer.PrintAns(); } return 0; }
a.cc: In function 'void BFS(CMap&, CMap&)': a.cc:86:60: error: no matching function for call to 'find(std::vector<CMap>::iterator, std::vector<CMap>::iterator, CMap&)' 86 | if( q.end() == find( q.begin(), q.end(), add ) ) | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:86:60: note: '__gnu_cxx::__normal_iterator<CMap*, std::vector<CMap> >' is not derived from 'std::istreambuf_iterator<_CharT>' 86 | if( q.end() == find( q.begin(), q.end(), add ) ) | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
s997137248
p00131
C++
#include<iostream> #include<vector> #include<queue> #include<cmath> #include<algorithm> #define MAX 12 #define NIL (-1) using namespace std; inline bool inRange(int t, int min, int max){ return (min <= t && t < max); } class CMap{ public: int m[MAX][MAX]; vector< pair<int, int > > vHist; CMap() { for(int i = 0; i < MAX; ++i) for(int j = 0; j < MAX; ++j) m[i][j] = 0; } void Reset() { for(int i = 0; i < MAX; ++i) for(int j = 0; j < MAX; ++j) m[i][j] = 0; } int TryPassParticle(int i, int j) { int cnt1 = 0; const int di[] = {0,-1,0,1,0}; const int dj[] = {0,0,1,0,-1}; for(int k = 0; k < sizeof(di)/sizeof(*di); ++k) if( inRange( i+di[k],1,MAX-1 ) && inRange( j+dj[k],1,MAX-1 ) ) if( m[i+di[k]][j+dj[k]] == 1 ) cnt1++; return cnt1; } bool PassParticle(int i, int j) { int cnt0 = 0; int cnt1 = 0; const int di[] = {0,-1,0,1,0}; const int dj[] = {0,0,1,0,-1}; if( !(inRange(i,1,MAX-1) && inRange(j,1,MAX-1)) ) return false; if( find( vHist.begin(), vHist.end(), make_pair(i,j) ) != vHist.end() ) return false; for(int k = 0; k < sizeof(di)/sizeof(*di); ++k) if( inRange( i+di[k],1,MAX-1 ) && inRange( j+dj[k],1,MAX-1 ) ) if( m[i+di[k]][j+dj[k]] == 1 ) cnt1++; else cnt0++; if( cnt1 < cnt0 ) return false; for(int k = 0; k < sizeof(di)/sizeof(*di); ++k) if( inRange( i+di[k],1,MAX-1 ) && inRange( j+dj[k],1,MAX-1 ) ) m[i+di[k]][j+dj[k]] ^= 1; vHist.push_back( make_pair( i, j ) ); return true; } bool NoLight(int range = MAX - 1) const { for(int i = 1; i < range; ++i) for(int j = 1; j < range; ++j) if( m[i][j] == 1 ) return false; return true; } void Print() const { for(int i = 1; i < MAX - 1; ++i){ cout << m[i][1]; for(int j = 2; j < MAX - 1; ++j) cout << ' ' << m[i][j]; cout << '\n'; } } void PrintPassHist(){ Reset(); for(unsigned int i = 0; i < vHist.size(); ++i) m[ vHist[i].first ][ vHist[i].second ] = 1; for(int i = 1; i < MAX - 1; ++i){ cout << m[i][1]; for(int j = 2; j < MAX - 1; ++j) cout << ' ' << m[i][j]; cout << '\n'; } } }; void EraseBlocks(CMap &M){ bool bCont; do{ bCont = false; for(unsigned int i = 1; i < MAX-1; ++i){ for(unsigned int j = 1; j < MAX-1; ++j){ if( M.m[i][j] == 1 ){ int ci = NIL, cj = NIL, max1 = 0; const int di[] = {-1,-1,0,1,1, 1, 0,-1}; const int dj[] = { 0, 1,1,1,0,-1,-1,-1}; const int sz = sizeof(di)/sizeof(*di); for(int k = 0; k < sz; k+=2){ if( M.m[i+di[k]][j+dj[k]] == 0 && inRange(i+di[k],1,MAX-1) && inRange(j+dj[k],1,MAX-1) && M.m[i+di[(k+1)%sz]][j+dj[(k+1)%sz]] == 0 && inRange(i+di[(k+1)%sz],1,MAX-1) && inRange(j+dj[(k+1)%sz],1,MAX-1) && M.m[i+di[(k+2)%sz]][j+dj[(k+2)%sz]] == 0 && inRange(i+di[(k+2)%sz],1,MAX-1) && inRange(j+dj[(k+2)%sz],1,MAX-1) && M.m[i+di[(k+3)%sz]][j+dj[(k+3)%sz]] == 0 && inRange(i+di[(k+3)%sz],1,MAX-1) && inRange(j+dj[(k+3)%sz],1,MAX-1) && M.m[i+di[(k+4)%sz]][j+dj[(k+4)%sz]] == 0 && inRange(i+di[(k+4)%sz],1,MAX-1) && inRange(j+dj[(k+4)%sz],1,MAX-1)){ int d = M.TryPassParticle( i+di[(k+6)%sz],j+dj[(k+6)%sz] ); if( d > max1 ) { max1 = d; ci = i+di[(k+6)%sz]; cj = j+dj[(k+6)%sz]; } } } if( M.PassParticle( ci, cj ) ){ bCont = true; break; } } } } }while( bCont ); } void BFS(CMap &stm, CMap &ret){ int n = 0; bool bFailed = true; queue< CMap > q; q.push( stm ); while( !q.empty() ){ bool bCont = true; CMap Tmp, M = q.front(); q.pop(); EraseBlocks( V, M ); /*cout << endl; M.Print();*/ if( M.NoLight() ) { ret = M; bFailed = false; break; } Tmp = M; for(unsigned int i = 1; i < MAX-1 && bCont; ++i){ for(unsigned int j = 1; j < MAX-1 && bCont; ++j){ if( M.m[i][j] == 1 ){ int max1 = 0; int ci = NIL, cj = NIL; const int di[] = {-1,0,1,0}; const int dj[] = {0,1,0,-1}; const int sz = sizeof(di)/sizeof(*di); for(int k = 0; k < sz; ++k){ if( M.m[i+di[k]][j+dj[k]] == 0 && inRange(i+di[k],1,MAX-1) && inRange(j+dj[k],1,MAX-1) && M.m[i+di[(k+1)%sz]][j+dj[(k+1)%sz]] == 0 && inRange(i+di[(k+1)%sz],1,MAX-1) && inRange(j+dj[(k+1)%sz],1,MAX-1)){ if( M.PassParticle(i+di[(k+2)%sz], j+dj[(k+2)%sz]) ){ q.push( M ); M = Tmp; bCont = false; } if( M.PassParticle(i+di[(k+3)%sz], j+dj[(k+3)%sz]) ){ q.push( M ); M = Tmp; bCont = false; } } } } } } } } int main(void){ int n; cin >> n; for( int D = 0; D < n; ++D ) { CMap M; CMap Answer; for(int i = 1; i < MAX - 1; ++i) for(int j = 1; j < MAX - 1 ; ++j) cin >> M.m[i][j]; BFS( M, Answer ); Answer.PrintPassHist(); } return 0; }
a.cc: In function 'void BFS(CMap&, CMap&)': a.cc:157:30: error: 'V' was not declared in this scope 157 | EraseBlocks( V, M ); | ^
s909638496
p00131
C++
#include <iostream> #include <cstring> using namespace std; int n,s,y,x,i; int d[12][12],b[12][12],a[12][12]; int dx[] = { 0,0,0,1,-1}; int dy[] = {-1,1,0,0, 0}; void flip(x, y) { a[y][x] = 1; for(i=0; i<5; i++) { b[y+dy[i]][x+dx[i]] = 1-b[y+dy[i]][x+dx[i]]; } } int main() { cin >> n; while(n--) { for(y=1; y<=10; y++) for(x=1; x<=10; x++) { cin >> d[y][x]; } for(i=0; i<1024; i++) { memset(a,0,sizeof(a)); memcpy(b,d,sizeof(d)); for(y=1,x=1; x<=10; x++) { if((i>>(x-1))&1) flip(x,y); } for(y=2; y<=10; y++) for(x=1; x<=10; x++) { if(b[y-1][x]) flip(x,y); } for(y=10,x=1,s=0; x<=10; x++) { s+=b[y][x]; } if(s==0) break; } for(y=1; y<=10; y++) { for(x=1; x<=10; x++) { cout << a[y][x] << (x==10?"":" "); } cout << endl; } } }
a.cc:10:6: error: variable or field 'flip' declared void 10 | void flip(x, y) | ^~~~ a.cc: In function 'int main()': a.cc:37:50: error: 'flip' was not declared in this scope 37 | if((i>>(x-1))&1) flip(x,y); | ^~~~ a.cc:43:47: error: 'flip' was not declared in this scope 43 | if(b[y-1][x]) flip(x,y); | ^~~~
s431990938
p00132
Java
import java.awt.*; import java.awt.geom.*; import java.io.*; import java.util.*; class Main { static int h; static int w; static int[] map; static int n; static int[][][] piece; static int[][] hp; static int[][] wp; static HashMap MAP; public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true) { MAP = new HashMap(); h = sc.nextInt(); w = sc.nextInt(); if(h == 0 && w == 0) break; MAP.clear(); map = new int[h]; for(int i = 0; i < h; i++) { String in = sc.next(); int ix = 0; for(int j = 0; j < w; j++) { if(in.charAt(j) == '#') { ix |= 1 << (w - j - 1); } } map[i] = ix; } n = sc.nextInt(); piece = new int[n][4][]; hp = new int[n][4]; wp = new int[n][4]; for(int i = 0; i < n; i++) { int hpx = sc.nextInt(); int wpx = sc.nextInt(); hp[i][0] = hp[i][2] = wp[i][1] = wp[i][3] = hpx; wp[i][0] = wp[i][2] = hp[i][1] = hp[i][3] = wpx; char[][] ps = new char[hpx][wpx]; for(int j = 0; j < hpx; j++) { ps[j] = sc.next().toCharArray(); } for(int j = 0; j < 4; j++) { piece[i][j] = new int[hp[i][j]]; for(int k = 0; k < hp[i][j]; k++) { int tmp = 0; for(int l = 0; l < wp[i][j]; l++) { if(ps[k][l] == '#') { tmp |= 1 << (wp[i][j] - l - 1); } } piece[i][j][k] = tmp; } char[][] pstmp = new char[hp[i][(j+1)%4]][wp[i][(j+1)%4]]; for(int k = 0; k < hp[i][(j+1)%4]; k++) { for(int l = 0; l < wp[i][(j+1)%4]; l++) { pstmp[k][l] = ps[l][hp[i][(j+1)%4] - k - 1]; } } ps = pstmp; } } BFS(); //dfs(0,0,0,map); int np = sc.nextInt(); for(int i = 0; i < np; i++) { int k1 = sc.nextInt(); int tmp = 0; for(int j = 0; j < k1; j++) { int ckk = sc.nextInt(); tmp |= (1 << ckk-1); } if(MAP.containsKey(tmp)) { System.out.println("YES"); } else { System.out.println("NO"); } } } } static Queue queue = new ArrayDeque(); static void BFS() { queue.clear(); queue.add(new Data(0,0,0,map)); while(!queue.isEmpty()) { Data tmp = queue.poll(); dfs(tmp.y,tmp.x,tmp.use,tmp.c); } } static void dfs(int y, int x,int use, int[] c) { while((c[y] & (1 << (w - x - 1))) != 0) { x++; if(x == w) { x = 0; y++; } if(y == h) { MAP.put(use, true); return; } } for(int i = 0; i < n; i++) { if((use & (1 << i)) == 0) { for(int j = 0; j < 4; j++) { CON:for(int k = wp[i][j]; k < w; k++) { for(int l = 0; l < hp[i][j]; l++) { if((c[y + l] & piece[i][j][l] << (k - wp[i][j])) != 0) continue CON; } int[] nex = new int[c.length]; nex = Arrays.copyOf(c, c.length); for(int l = 0; l < hp[i][j]; l++) { nex[y + l] |= piece[i][j][l] << (k - wp[i][j]); } if((nex[y] & (1 << w - x - 1)) != 0) queue.add(new Data(y,x,use | (1 << i),nex)); } } } } } static class Data { int y; int x; int use; int[] c; Data(int a, int b, int d, int[] e) { y = a; x = b; use = d; c = e; } } }
Main.java:1: error: reached end of file while parsing import java.awt.*; import java.awt.geom.*; import java.io.*; import java.util.*; class Main { static int h; static int w; static int[] map; static int n; static int[][][] piece; static int[][] hp; static int[][] wp; static HashMap MAP; public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true) { MAP = new HashMap(); h = sc.nextInt(); w = sc.nextInt(); if(h == 0 && w == 0) break; MAP.clear(); map = new int[h]; for(int i = 0; i < h; i++) { String in = sc.next(); int ix = 0; for(int j = 0; j < w; j++) { if(in.charAt(j) == '#') { ix |= 1 << (w - j - 1); } } map[i] = ix; } n = sc.nextInt(); piece = new int[n][4][]; hp = new int[n][4]; wp = new int[n][4]; for(int i = 0; i < n; i++) { int hpx = sc.nextInt(); int wpx = sc.nextInt(); hp[i][0] = hp[i][2] = wp[i][1] = wp[i][3] = hpx; wp[i][0] = wp[i][2] = hp[i][1] = hp[i][3] = wpx; char[][] ps = new char[hpx][wpx]; for(int j = 0; j < hpx; j++) { ps[j] = sc.next().toCharArray(); } for(int j = 0; j < 4; j++) { piece[i][j] = new int[hp[i][j]]; for(int k = 0; k < hp[i][j]; k++) { int tmp = 0; for(int l = 0; l < wp[i][j]; l++) { if(ps[k][l] == '#') { tmp |= 1 << (wp[i][j] - l - 1); } } piece[i][j][k] = tmp; } char[][] pstmp = new char[hp[i][(j+1)%4]][wp[i][(j+1)%4]]; for(int k = 0; k < hp[i][(j+1)%4]; k++) { for(int l = 0; l < wp[i][(j+1)%4]; l++) { pstmp[k][l] = ps[l][hp[i][(j+1)%4] - k - 1]; } } ps = pstmp; } } BFS(); //dfs(0,0,0,map); int np = sc.nextInt(); for(int i = 0; i < np; i++) { int k1 = sc.nextInt(); int tmp = 0; for(int j = 0; j < k1; j++) { int ckk = sc.nextInt(); tmp |= (1 << ckk-1); } if(MAP.containsKey(tmp)) { System.out.println("YES"); } else { System.out.println("NO"); } } } } static Queue queue = new ArrayDeque(); static void BFS() { queue.clear(); queue.add(new Data(0,0,0,map)); while(!queue.isEmpty()) { Data tmp = queue.poll(); dfs(tmp.y,tmp.x,tmp.use,tmp.c); } } static void dfs(int y, int x,int use, int[] c) { while((c[y] & (1 << (w - x - 1))) != 0) { x++; if(x == w) { x = 0; y++; } if(y == h) { MAP.put(use, true); return; } } for(int i = 0; i < n; i++) { if((use & (1 << i)) == 0) { for(int j = 0; j < 4; j++) { CON:for(int k = wp[i][j]; k < w; k++) { for(int l = 0; l < hp[i][j]; l++) { if((c[y + l] & piece[i][j][l] << (k - wp[i][j])) != 0) continue CON; } int[] nex = new int[c.length]; nex = Arrays.copyOf(c, c.length); for(int l = 0; l < hp[i][j]; l++) { nex[y + l] |= piece[i][j][l] << (k - wp[i][j]); } if((nex[y] & (1 << w - x - 1)) != 0) queue.add(new Data(y,x,use | (1 << i),nex)); } } } } } static class Data { int y; int x; int use; int[] c; Data(int a, int b, int d, int[] e) { y = a; x = b; use = d; c = e; } } } ^ 1 error
s725558407
p00132
Java
import java.awt.*; import java.awt.geom.*; import java.io.*; import java.util.*; class Main { static int h; static int w; static int[] map; static int n; static int[][][] piece; static int[][] hp; static int[][] wp; static HashMap<Integer,Boolean> MAP; public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true) { MAP = new HashMap<Integer,Boolean>(); h = sc.nextInt(); w = sc.nextInt(); if(h == 0 && w == 0) break; map = new int[h]; int countA = 0; for(int i = 0; i < h; i++) { String in = sc.next(); int ix = 0; for(int j = 0; j < w; j++) { if(in.charAt(j) == '#') { countA++; ix |= (1 << (w - j - 1)); } } map[i] = ix; } n = sc.nextInt(); piece = new int[n][4][]; hp = new int[n][4]; wp = new int[n][4]; int countB = 0; for(int i = 0; i < n; i++) { int hpx = sc.nextInt(); int wpx = sc.nextInt(); hp[i][0] = hp[i][2] = wp[i][1] = wp[i][3] = hpx; wp[i][0] = wp[i][2] = hp[i][1] = hp[i][3] = wpx; char[][] ps = new char[hpx][wpx]; for(int j = 0; j < hpx; j++) { ps[j] = sc.next().toCharArray(); } for(int j = 0; j < 4; j++) { piece[i][j] = new int[hp[i][j]]; for(int k = 0; k < hp[i][j]; k++) { int tmp = 0; for(int l = 0; l < wp[i][j]; l++) { if(ps[k][l] == '#') { if(j == 0) countB++; tmp |= (1 << (wp[i][j] - l - 1)); } } piece[i][j][k] = tmp; } char[][] pstmp = new char[hp[i][(j+1)%4]][wp[i][(j+1)%4]]; for(int k = 0; k < hp[i][(j+1)%4]; k++) { for(int l = 0; l < wp[i][(j+1)%4]; l++) { pstmp[k][l] = ps[l][hp[i][(j+1)%4] - k - 1]; } } ps = pstmp; } } if(countA <= countB) dfs(0,0,0,map); //System.out.println(MAP.size()); int np = sc.nextInt(); for(int i = 0; i < np; i++) { int k1 = sc.nextInt(); int tmp = 0; for(int j = 0; j < k1; j++) { int ckk = sc.nextInt(); tmp |= (1 << (ckk-1)); } if(MAP.containsKey(tmp)) { System.out.println("YES"); } else { System.out.println("NO"); } } } } static void dfs(int y, int x,int use, int[] c) { while((c[y] & (1 << (w - x - 1))) != 0) { x++; if(x == w) { x = 0; y++; } if(y == h) { if(!MAP.containsKey(use)) MAP.put(use, true); return; } } CONX:for(int i = 0; i < n; i++) { if((use & (1 << i)) == 0) { for(int j = 0; j < 4; j++) { CON:for(int k = w - x; k <= w; k++) { if(y + hp[i][j] - 1 >= h) continue CONX; int t = k - wp[i][j]; if(((c[y] | piece[i][j][0] << (t)) & (1 << (w - x - 1))) == 0) continue CON; for(int l = 1; l < hp[i][j]; l++) { if((c[y + l] & (piece[i][j][l] << (t))) != 0) continue CON; } int[] nex = Arrays.copyOf(c, c.length); for(int l = 0; l < hp[i][j]; l++) { nex[y + l] |= (piece[i][j][l] << (t)); cu[y+l] |= (piece[i][j][l] << t); } dfs(y,x,(use | (1 << i)),nex); } } } } } }
Main.java:119: error: cannot find symbol cu[y+l] |= (piece[i][j][l] << t); ^ symbol: variable cu location: class Main 1 error
s744975776
p00132
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; enum {Blank, Fill}; class Piece{ vector<vector<int>> tile_value[4]; int h_value[4], w_value[4]; int dx_value[4]; int direction; public: Piece(vector<vector<int>> tile) { direction = 0; for(int d = 0; d < 4; ++d) { h_value[d] = d & 1 ? tile[0].size() : tile.size(); w_value[d] = d & 1 ? tile.size() : tile[0].size(); } for(int d = 0; d < 4; ++d) tile_value[d].resize(h_value[d]); for(int d = 0; d < 4; ++d) for(int i = 0; i < h_value[d]; ++i) tile_value[d][i].resize(w_value[d]); tile_value[0] = tile; for(int d = 1; d < 4; ++d) for(int i = 0; i < h_value[d]; ++i) for(int j = 0; j < w_value[d]; ++j) tile_value[d][i][j] = tile_value[d - 1][j][h_value[d] - 1 - i]; for(int d = 0; d < 4; ++d) for(int j = 0; j < w_value[d]; ++j) { if(tile_value[d][0][j] == Blank) continue; dx_value[d] = j; break; } } int h() {return h_value[direction];} int w() {return w_value[direction];} int tile(int i, int j) {return tile_value[direction][i][j];} int dx() {return dx_value[direction];} void rotate() {direction = (direction + 1) % 4;} }; int h, w; vector<Piece> piece; bool dfs(vector<vector<int>> puzzle, vector<int> candidate) { bool ok = true; int y, x; for(int i = 0; ok && i < h; ++i) for(int j = 0; ok && j < w; ++j) { if(puzzle[i][j] == Fill) continue; y = i; x = j; ok = false; } if(ok) return candidate.size() == 0; for(int c = 0; c < candidate.size(); ++c) { Piece p = piece[candidate[c]]; for(int d = 0; d < 4; ++d) { p.rotate(); if(h < y + p.h()) continue; if(w < x - p.dx() + p.w()) continue; if(x - p.dx() < 0) continue; vector<vector<int>> _puzzle = puzzle; ok = true; for(int i = 0; ok && i < p.h(); ++i) for(int j = 0; ok && j < p.w(); ++j) { _puzzle[y + i][x - p.dx() + j] += p.tile(i, j); if(_puzzle[y + i][x - p.dx() + j] == 2) ok = false; } if(!ok) continue; vector<int> _candidate = candidate; _candidate.erase(_candidate.begin() + c); if(dfs(_puzzle, _candidate)) return true; } } return false; } int main() { while(cin >> h >> w, h | w) { vector<vector<int>> puzzle(h, vector<int>(w)); for(int i = 0; i < h; ++i) { string input; cin >> input; for(int j = 0; j < w; ++j) puzzle[i][j] = (input[j] == '#' ? Fill : Blank); } int n;     piece.clear(); for(cin >> n; 0 < n; --n) { int h1, w1; cin >> h1 >> w1; vector<vector<int>> tile(h1, vector<int>(w1)); for(int i = 0; i < h1; ++i) { string input; cin >> input; for(int j = 0; j < w1; ++j) tile[i][j] = (input[j] == '#' ? Fill : Blank); } piece.push_back(Piece(tile)); } int p; for(cin >> p; 0 < p; --p) { int k; vector<int> candidate; for(cin >> k; 0 < k; --k) { int x; cin >> x; candidate.push_back(x - 1); } sort(candidate.begin(), candidate.end()); cout << (dfs(puzzle, candidate) ? "YES" : "NO") << endl; } } }
a.cc:85:1: error: extended character   is not valid in an identifier 85 |     piece.clear(); | ^ a.cc:85:1: error: extended character   is not valid in an identifier a.cc:85:1: error: extended character   is not valid in an identifier a.cc:85:1: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:85:1: error: '\U00003000\U00003000\U00003000\U00003000piece' was not declared in this scope 85 |     piece.clear(); | ^~~~~~~~~~~~~
s496525052
p00132
C++
#include <iostream> #include <string> #include <vector> using namespace std; class Puzzle { public: int H, W, ulx, uly; vector<int> v; Puzzle() {}; Puzzle(int h, int w) { reset(h, w); }; void reset(int h, int w) { H = h; W = w; v.clear(); v.resize(H); } int get(int i, int j) { return (v[i] >> (H-1-j)) & 1; } void set(int i, int j, int val) { if (val == 0) { v[i] &= ~(1 << (H-1-j)); } else { v[i] |= 1 << (H-1-j); } } void updateUpperLeft(int val) { for (int i=0; i<H; ++i) { for (int j=0; j<W; ++j) { if (get(i,j) == val) { ulx = j, uly = i; return ; } } } ulx = -1, uly = -1; } }; Puzzle pz, piece[10][4]; bool used[10]; string solve() { pz.updateUpperLeft(0); int x = pz.ulx, y = pz.uly; if (x < 0) { for (int i=0; i<10; ++i) { if ( ! used[i]) return "NO"; } return "YES"; } for (int i=0; i<10; ++i) { if (used[i]) continue; for (int j=0; j<4; ++j) { int ph = piece[i][j].H; int pw = piece[i][j].W; int sx = x - piece[i][j].ulx; int sy = y - piece[i][j].uly; bool ok = true; for (int k=0; k<ph && ok; ++k) { for (int l=0; l<pw && ok; ++l) { if (piece[i][j].get(k,l) && (sy+k<0 || pz.H<=sy+k || sx+l<0 || pz.W<=sx+l || pz.get(sy+k,sx+l))) { ok = false; } } } } if (ok) { used[i] = true; for (int k=0; k<ph; ++k) { for (int l=0; l<pw; ++l) { if (piece[i][j].get(k,l)) { pz.set(sy+k,sx+l,1); } } } string ret = solve(); used[i] = false; for (int k=0; k<ph; ++k) { for (int l=0; l<pw; ++l) { if (piece[i][j].get(k,l)) { pz.set(sy+k,sx+l,0); } } } if (ret == "YES") return ret; } } } return "NO"; } int main() { int H, W; while (cin >> H >> W, H) { pz.reset(H, W); for (int i=0; i<H; ++i) { char c; for (int j=0; j<W; ++j) { cin >> c; pz.set(i,j,c=='#'?1:0); } } int n, h, w; cin >> n; for (int l=0; l<n; ++l) { cin >> h >> w; piece[l][0].reset(h, w); for (int i=0; i<h; ++i) { char c; for (int j=0; j<w; ++j) { cin >> c; piece[l][0].set(i,j,c=='#'?1:0); } } for (int i=1; i<4; ++i) { int ph = piece[l][i-1].W; int pw = piece[l][i-1].H; piece[l][i].reset(ph, pw); for (int j=0; j<ph; ++j) { for (int k=0; k<pw; ++k) { piece[l][i].set(j,k,piece[l][i-1].get(pw-1-k,j)); } } } for (int i=0; i<4; ++i) piece[l][i].updateUpperLeft(1); } int p, k, t; cin >> p; for (int i=0; i<p; ++i) { for (int j=0; j<10; ++j) used[j] = true; cin >> k; for (int j=0; j<k; ++j) { cin >> t; used[t-1] = false; } cout << solve() << endl; } } return 0; }
a.cc: In function 'std::string solve()': a.cc:70:29: error: 'ok' was not declared in this scope 70 | if (ok) { | ^~ a.cc:72:49: error: 'ph' was not declared in this scope; did you mean 'pz'? 72 | for (int k=0; k<ph; ++k) { | ^~ | pz a.cc:73:57: error: 'pw' was not declared in this scope; did you mean 'pz'? 73 | for (int l=0; l<pw; ++l) { | ^~ | pz a.cc:74:62: error: 'j' was not declared in this scope 74 | if (piece[i][j].get(k,l)) { | ^ a.cc:75:64: error: 'sy' was not declared in this scope; did you mean 'y'? 75 | pz.set(sy+k,sx+l,1); | ^~ | y a.cc:75:69: error: 'sx' was not declared in this scope; did you mean 'x'? 75 | pz.set(sy+k,sx+l,1); | ^~ | x a.cc:81:49: error: 'ph' was not declared in this scope; did you mean 'pz'? 81 | for (int k=0; k<ph; ++k) { | ^~ | pz a.cc:82:57: error: 'pw' was not declared in this scope; did you mean 'pz'? 82 | for (int l=0; l<pw; ++l) { | ^~ | pz a.cc:83:62: error: 'j' was not declared in this scope 83 | if (piece[i][j].get(k,l)) { | ^ a.cc:84:64: error: 'sy' was not declared in this scope; did you mean 'y'? 84 | pz.set(sy+k,sx+l,0); | ^~ | y a.cc:84:69: error: 'sx' was not declared in this scope; did you mean 'x'? 84 | pz.set(sy+k,sx+l,0); | ^~ | x a.cc: At global scope: a.cc:92:9: error: expected unqualified-id before 'return' 92 | return "NO"; | ^~~~~~ a.cc:93:1: error: expected declaration before '}' token 93 | } | ^ a.cc: In function 'std::string solve()': a.cc:91:9: warning: control reaches end of non-void function [-Wreturn-type] 91 | } | ^
s709840270
p00132
C++
#include <iostream> #include <string> #include <vector> using namespace std; class Puzzle { public: int H, W, ulx, uly; vector<int> v; Puzzle() {}; Puzzle(int h, int w) { reset(h, w); }; void reset(int h, int w) { H = h; W = w; v.clear(); v.resize(H); } int get(int i, int j) { return (v[i] >> (H-1-j)) & 1; } void set(int i, int j, int val) { if (val == 0) { v[i] &= ~(1 << (H-1-j)); } else { v[i] |= 1 << (H-1-j); } } void updateUpperLeft(int val) { for (int i=0; i<H; ++i) { for (int j=0; j<W; ++j) { if (get(i,j) == val) { ulx = j, uly = i; return ; } } } ulx = -1, uly = -1; } }; Puzzle pz, piece[10][4]; bool used[10]; string solve() { pz.updateUpperLeft(0); int x = pz.ulx, y = pz.uly; if (x < 0) { for (int i=0; i<10; ++i) { if ( ! used[i]) return "NO"; } return "YES"; } for (int i=0; i<10; ++i) { if (used[i]) continue; for (int j=0; j<4; ++j) { int ph = piece[i][j].H; int pw = piece[i][j].W; int sx = x - piece[i][j].ulx; int sy = y - piece[i][j].uly; bool ok = true; for (int k=0; k<ph && ok; ++k) { for (int l=0; l<pw && ok; ++l) { if (piece[i][j].get(k,l) && (sy+k<0 || pz.H<=sy+k || sx+l<0 || pz.W<=sx+l || pz.get(sy+k,sx+l))) { ok = false; } } } } if (ok) { used[i] = true; for (int k=0; k<ph; ++k) { for (int l=0; l<pw; ++l) { if (piece[i][j].get(k,l)) { pz.set(sy+k,sx+l,1); } } } string ret = solve(); used[i] = false; for (int k=0; k<ph; ++k) { for (int l=0; l<pw; ++l) { if (piece[i][j].get(k,l)) { pz.set(sy+k,sx+l,0); } } } if (ret == "YES") return ret; } } } return "NO"; } int main() { int H, W; while (cin >> H >> W, H) { pz.reset(H, W); for (int i=0; i<H; ++i) { char c; for (int j=0; j<W; ++j) { cin >> c; pz.set(i,j,c=='#'?1:0); } } int n, h, w; cin >> n; for (int l=0; l<n; ++l) { cin >> h >> w; piece[l][0].reset(h, w); for (int i=0; i<h; ++i) { char c; for (int j=0; j<w; ++j) { cin >> c; piece[l][0].set(i,j,c=='#'?1:0); } } for (int i=1; i<4; ++i) { int ph = piece[l][i-1].W; int pw = piece[l][i-1].H; piece[l][i].reset(ph, pw); for (int j=0; j<ph; ++j) { for (int k=0; k<pw; ++k) { piece[l][i].set(j,k,piece[l][i-1].get(pw-1-k,j)); } } } for (int i=0; i<4; ++i) piece[l][i].updateUpperLeft(1); } int p, k, t; cin >> p; for (int i=0; i<p; ++i) { for (int j=0; j<10; ++j) used[j] = true; cin >> k; for (int j=0; j<k; ++j) { cin >> t; used[t-1] = false; } cout << solve() << endl; } } return 0; }
a.cc: In function 'std::string solve()': a.cc:70:29: error: 'ok' was not declared in this scope 70 | if (ok) { | ^~ a.cc:72:49: error: 'ph' was not declared in this scope; did you mean 'pz'? 72 | for (int k=0; k<ph; ++k) { | ^~ | pz a.cc:73:57: error: 'pw' was not declared in this scope; did you mean 'pz'? 73 | for (int l=0; l<pw; ++l) { | ^~ | pz a.cc:74:62: error: 'j' was not declared in this scope 74 | if (piece[i][j].get(k,l)) { | ^ a.cc:75:64: error: 'sy' was not declared in this scope; did you mean 'y'? 75 | pz.set(sy+k,sx+l,1); | ^~ | y a.cc:75:69: error: 'sx' was not declared in this scope; did you mean 'x'? 75 | pz.set(sy+k,sx+l,1); | ^~ | x a.cc:81:49: error: 'ph' was not declared in this scope; did you mean 'pz'? 81 | for (int k=0; k<ph; ++k) { | ^~ | pz a.cc:82:57: error: 'pw' was not declared in this scope; did you mean 'pz'? 82 | for (int l=0; l<pw; ++l) { | ^~ | pz a.cc:83:62: error: 'j' was not declared in this scope 83 | if (piece[i][j].get(k,l)) { | ^ a.cc:84:64: error: 'sy' was not declared in this scope; did you mean 'y'? 84 | pz.set(sy+k,sx+l,0); | ^~ | y a.cc:84:69: error: 'sx' was not declared in this scope; did you mean 'x'? 84 | pz.set(sy+k,sx+l,0); | ^~ | x a.cc: At global scope: a.cc:92:9: error: expected unqualified-id before 'return' 92 | return "NO"; | ^~~~~~ a.cc:93:1: error: expected declaration before '}' token 93 | } | ^ a.cc: In function 'std::string solve()': a.cc:91:9: warning: control reaches end of non-void function [-Wreturn-type] 91 | } | ^
s637523490
p00132
C++
#include <iostream> #include <vector> #include <string> #include <bitset> #include <algorithm> #include <cstdlib> using namespace std; vector<string> puzzle_flame; int puzzle_size; int puzzle_w; int puzzle_h; int piece_num; struct piece { vector<vector<string> > p; int size; vector<int> sharp_x; vector<int> sharp_y; piece() {} piece(vector<string> v) { // make rotate piece {{{ vector<string> tmp; p.push_back(v); for(int i = 0; i < v[0].size(); i++) { string s = ""; for(int j = 0; j < v.size(); j++) { s += v[j][v[0].size() - 1 - i]; } tmp.push_back(s); } p.push_back(tmp); tmp.clear(); for(int i = 0; i < v.size(); i++) { string s = ""; for(int j = 0; j < v[i].size(); j++) { s += v[v.size() - 1 - i][v[0].size() - 1 - j]; } tmp.push_back(s); } p.push_back(tmp); tmp.clear(); for(int i = 0; i < v[0].size(); i++) { string s = ""; for(int j = 0; j < v.size(); j++) { s += v[v.size() - 1 - j][i]; } tmp.push_back(s); } p.push_back(tmp); // }}} // init size {{{ size = 0; for(int i = 0; i < v.size(); i++) { for(int j = 0; j < v[i].size(); j++) { size += v[i][j] == '#'; } } // }}} // make sharp_x,y {{{ for(int i = 0; i < p.size(); i++) { for(int j = 0; j < p[i].size(); j++) { for(int k = 0; k < p[i][j].size(); k++) { if(p[i][j][k] == '#') { sharp_y.push_back(j); sharp_x.push_back(k); goto exit_mk_sharp; } } } exit_mk_sharp:; } // }}} } }; vector<piece> usable_pieces; bitset<64> interference[40][40][64]; const int margin = 32; // piece a, b, bias Y b - a, bias X b - a void set_interference() { // {{{ for(int i = 0; i < usable_pieces.size()*4; i++) { const vector<string> a = usable_pieces[i >> 2].p[i & 0x3]; for(int j = 0; j < usable_pieces.size()*4; j++) { const vector<string> b = usable_pieces[j >> 2].p[j & 0x3]; // cout << i << "," << j << endl; // cout << (i >> 2) << "," << (i & 0x3) << " " << (j >> 2) << "," << (j & 0x3) << endl; if((i >> 2) == (j >> 2)) { for(int bias_i = 0; bias_i < 64; bias_i++) { for(int bias_j = 0; bias_j < 64; bias_j++) { interference[i][j][bias_i][bias_j] = false; } } continue; } for(int bias_i = -25; bias_i <= 25; bias_i++) { for(int bias_j = -25; bias_j <= 25; bias_j++) { bool f = true; for(int i_ = max(0, bias_i); i_ < min((int)a.size(), (int)b.size() + bias_i); i_++) { for(int j_ = max(0, bias_j); j_ < min((int)a[0].size(), (int)b[0].size() + bias_j); j_++) { if((a[i_][j_] == '#') && (b[i_ - bias_i][j_ - bias_j] == '#')) f = false; } } if(f) interference[i][j][margin + bias_i].set(margin + bias_j); else { interference[i][j][margin + bias_i].reset(margin + bias_j); } } } } } // }}} } bitset<20> put[40][20]; void set_put() { // {{{ for(int i = 0; i < usable_pieces.size()*4; i++) { const vector<string> a = usable_pieces[i >> 2].p[i & 0x3]; for(int j = 0; j < puzzle_h; j++) { for(int k = 0; k < puzzle_w; k++) { if(j + a.size() > puzzle_h || k + a[0].size() > puzzle_w) { break; } bool f = true; for(int j_ = 0; j_ < a.size(); j_++) { for(int k_ = 0; k_ < a[j_].size(); k_++) { if(puzzle_flame[j+j_][k+k_] == '#' && a[j_][k_] == '#') f = false; } } if(f) put[i][j].set(k); else put[i][j].reset(k); } } } //cout << endl; // }}} } int piece_list; struct position { int x, y; int n; position(int x_, int y_, int n_) { x = x_; y = y_; n = n_; } }; vector<position> use; int use_flgs; bool solve(int y, int x) { /* cout << endl; for(int i = 0; i < puzzle_h; i++) { cout << puzzle_flame[i] << endl; } cout << endl; for(int i = 0; i < 10; i++) cout << (((piece_list^use_flgs) & (1 << i)) ? '1' : '0'); cout << endl; for(int i = 0; i < puzzle_h; i++) { for(int j = 0; j < puzzle_w; j++) { if(puzzle_flame[i][j] == '*') puzzle_flame[i][j] = '#'; } } // */ if(!(piece_list ^ use_flgs)) return true; for(int i = 0; i < puzzle_h; i++) { for(int j = 0; j < puzzle_w; j++) { if(puzzle_flame[i][j] == '.') { // cout << "i,j:" << i << "," << j << endl; for(int k = 0; k < piece_num; k++) { if((piece_list ^ use_flgs) & (1 << k)) { for(int l = 0; l < 4; l++) { int X, Y; Y = i - usable_pieces[k].sharp_y[l]; X = j - usable_pieces[k].sharp_x[l]; // cout << X << "," << Y << "," << k << endl; if(Y >= 0 && X >= 0 && put[(k << 2) + l][Y][X]) { bool call_flg = true; for(int m = 0; m < use.size(); m++) { call_flg &= interference[(k<<2)+l][use[m].n][margin + use[m].y - Y][margin + use[m].x - X]; // cout << use[m].y << "," << use[m].x << "," << use[m].n << endl; } if(call_flg) { int next_x, next_y; next_x = (j + 1) % puzzle_w; next_y = i + (j + 1) / puzzle_w; for(int i_ = 0; i_ < usable_pieces[k].p[l].size(); i_++) { for(int j_ = 0; j_ < usable_pieces[k].p[l][i_].size(); j_++) { if(usable_pieces[k].p[l][i_][j_] == '#') { /* if(puzzle_flame[Y + i_][X + j_] == '#') cout << "fail" << endl; // */ puzzle_flame[Y + i_][X + j_] = '#'; } } } use.push_back(position(X,Y,(k << 2)+l)); use_flgs |= 1 << k; bool solve_res; solve_res = solve(next_y, next_x); for(int i_ = 0; i_ < usable_pieces[k].p[l].size(); i_++) { for(int j_ = 0; j_ < usable_pieces[k].p[l][i_].size(); j_++) { if(usable_pieces[k].p[l][i_][j_] == '#') { puzzle_flame[Y + i_][X + j_] = '.'; } } } use.pop_back(); use_flgs &= ~(1 << k); if(solve_res) return true; } } } } } return false; } } } return false; } void init_global_val() { puzzle_flame.clear(); puzzle_size = 0; puzzle_w = 0; puzzle_h = 0; piece_num = 0; usable_pieces.clear(); for(int i = 0; i < 40; i++) { for(int j = 0; j < 40; j++) { for(int k = 0; k < 64; k++) { for(int l = 0; l < 64; l++) { interference[i][j][k].set(l); } } } } piece_list = 0; use.clear(); use_flgs = 0; for(int i = 0; i < 40; i++) { for(int j = 0; j < 20; j++) { for(int k = 0; k < 20; k++) { put[i][j].reset(k); } } } } void solve_init() { piece_list = 0; use_flgs = 0; use.clear(); } int test_case = 0; int main() { init_global_val(); while(cin >> puzzle_h >> puzzle_w, puzzle_h || puzzle_w) { // input puzzle {{{ it(test_case > 10) abort(); test_case++; for(int i = 0; i < puzzle_h; i++) { string s; cin >> s; puzzle_flame.push_back(s); } cin >> piece_num; for(int i = 0; i < piece_num; i++) { int h, w; cin >> h >> w; vector<string> v; for(int j = 0; j < h; j++) { string s; cin >> s; v.push_back(s); } usable_pieces.push_back(piece(v)); } // }}} // prepaire {{{ puzzle_size = 0; for(int i = 0; i < puzzle_flame.size(); i++) { for(int j = 0; j < puzzle_flame[i].size(); j++) { puzzle_size += (puzzle_flame[i][j] == '.'); } } //cout << puzzle_size << endl; set_interference(); set_put(); /* for(int i = 0; i < 4*usable_pieces.size(); i++) { cout << (i >> 2) << ":" << (i & 0x3) << endl; for(int j = 0; j < puzzle_h; j++) { for(int k = 0; k < puzzle_w; k++) { cout << (put[i][j][k] ? '.' : '@'); } cout << endl; } cout << endl; } // */ // }}} // query {{{ int query_num; cin >> query_num; for(int q = 0; q < query_num; q++) { int n; cin >> n; solve_init(); int sz = 0; for(int i = 0; i < n; i++) { int k; cin >> k; piece_list ^= (1 << (k - 1)); sz += usable_pieces[k-1].size; } /* if(puzzle_size != sz) cout << "size error:"; // */ if(puzzle_size == sz && solve(0,0)) cout << "YES" << endl; else cout << "NO" << endl; } // }}} init_global_val(); } }
a.cc: In function 'int main()': a.cc:290:1: error: 'it' was not declared in this scope; did you mean 'int'? 290 | it(test_case > 10) abort(); | ^~ | int
s975247024
p00132
C++
#include "bits/stdc++.h" #include<unordered_map> #include<unordered_set> #pragma warning(disable:4996) using namespace std; using ld = long double; template<class t> using table = vector<vector<t>>; const ld eps=1e-9; //// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" vector<vector<int>>rotate(const vector<vector<int>>&field) { vector<vector<int>>newfield(field[0].size(), vector<int>(field.size())); for (int y = 0; y < field.size(); ++y) { for (int x = 0; x < field[0].size(); ++x) { newfield[y][x] = field[field[0].size() - x - 1][y]; } } return newfield; } struct piece_ob { vector<vector<int>>pob; int ulx, uly; piece_ob(const vector<vector<int>>&pob_):pob(pob_) { for (int y = 0; y < pob.size(); ++y) { for (int x = 0; x < pob[0].size(); ++x) { if (pob[y][x]) { uly = y; ulx = x; return; } } } } }; struct piece { vector<piece_ob>pis; }; vector<piece>pieces; bool check(const vector<vector<int>>&field,set<int>&rest) { for (int y = 0; y < field.size(); ++y) { for (int x = 0; x < field[0].size(); ++x) { if (!field[y][x]) { bool aok = true; for (auto r : rest) { for (int i = 0; i < 4; ++i) { piece_ob p(pieces[r].pis[i]); for (int dy = 0; dy < p.pob.size(); ++dy) { const int ay = y + dy - p.uly; for (int dx = 0; dx < p.pob[0].size(); ++dx) { const int ax = x + dx - p.ulx; if (p.pob[dy][dx]) { if(ay>=0&&a) } } } } } } } } } int main() { int H, W; cin >> H >> W; vector<vector<int>>base(H, vector<int>(W)); for (int y = 0; y < H; ++y) { string st; cin >> st; for (int x = 0; x < W; ++x) { if (st[x] == '#')base[y][x] = true; } } int N; cin >> N; for (int i = 0; i < N; ++i) { int H,W; cin >> H >> W; vector<vector<int>>apiece(H, vector<int>(W)); for (int y = 0; y < H; ++y) { string st; cin >> st; for (int x = 0; x < W; ++x) { if (st[x] == '#')apiece[y][x] = true; } } piece p; for (int j = 0; j < 4; ++j) { piece_ob ob(apiece); p.pis.push_back(ob); apiece = rotate(apiece); } pieces.push_back(p); } int P; cin >> P; for (int i = 0; i < P; ++i) { int K; cin >> K; for (int j = 0; j < K; ++j) { int a; cin >> a; } } return 0; }
a.cc: In function 'bool check(const std::vector<std::vector<int> >&, std::set<int>&)': a.cc:56:83: error: 'a' was not declared in this scope; did you mean 'ax'? 56 | if(ay>=0&&a) | ^ | ax a.cc:57:65: error: expected primary-expression before '}' token 57 | } | ^ a.cc:67:1: warning: no return statement in function returning non-void [-Wreturn-type] 67 | } | ^
s634491874
p00132
C++
int H, W, n, h[40], w[40], sz[40]; int m, no[10]; char in[20][21], pc[40][20][21]; bool v[20][20], u[20][20]; bool cmp(int a, int b){ return sz[a] > sz[b]; } bool rec(int c){ if(c == m) return 1; memset(u, 0, sizeof(u)); rep(i, H) rep(j, W) if(in[i][j] == '.' && !u[i][j]){ for(int k = c; k < m; k++) rep(t, 4){ int p = no[k] + t * n; for(int y = max(0, i - h[p] + 1); y <= i && y + h[p] <= H; y++) for(int x = max(0, j - w[p] + 1); x <= j && x + w[p] <= W; x++){ rep(a, h[p]) rep(b, w[p]){ if(pc[p][a][b] == '#' && in[y + a][x + b] == '#') goto FAIL; } rep(a, h[p]) rep(b, w[p]){ if(pc[p][a][b] == '#') u[y + a][x + b] = 1; } FAIL:; } } if(!u[i][j]) return 0; } rep(t, 4){ int p = no[c] + t * n; for(int y = 0; y + h[p] <= H; y++) for(int x = 0; x + w[p] <= W; x++){ bool ok = 1; rep(a, h[p]) rep(b, w[p]) if(in[y + a][x + b] == '#' && pc[p][a][b] == '#') ok = 0; if(ok){ rep(a, h[p]) rep(b, w[p]) if(pc[p][a][b] == '#') in[y + a][x + b] = '#'; bool res = rec(c + 1); rep(a, h[p]) rep(b, w[p]) if(pc[p][a][b] == '#') in[y + a][x + b] = '.'; if(res) return 1; } } } return 0; } int main() { while(cin >> H >> W, H){ int sp = 0; rep(i, H){ cin >> in[i]; rep(j, W) if(in[i][j] == '.') sp++; } cin >> n; rep(i, n){ cin >> h[i] >> w[i]; sz[i] = 0; rep(j, h[i]){ cin >> pc[i][j]; rep(k, w[i]) if(pc[i][j][k] == '#') sz[i]++; } int s = i; rep(j, 3){ int t = s + n; h[t] = w[s]; w[t] = h[s]; sz[t] = sz[s]; rep(y, h[s]) rep(x, w[s]) pc[t][x][h[s] - y - 1] = pc[s][y][x]; s = t; } } int q; cin >> q; while(q--){ cin >> m; int sum = 0; rep(i, m) cin >> no[i], sum += sz[--no[i]]; sort(no, no + m, cmp); memset(v, 0, sizeof(v)); cout << (sum == sp && rec(0) ? "YES" : "NO") << endl; } } return 0; }
a.cc: In function 'bool rec(int)': a.cc:11:9: error: 'memset' was not declared in this scope 11 | memset(u, 0, sizeof(u)); | ^~~~~~ a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | int H, W, n, h[40], w[40], sz[40]; a.cc:12:13: error: 'i' was not declared in this scope 12 | rep(i, H) rep(j, W) if(in[i][j] == '.' && !u[i][j]){ | ^ a.cc:12:9: error: 'rep' was not declared in this scope; did you mean 'rec'? 12 | rep(i, H) rep(j, W) if(in[i][j] == '.' && !u[i][j]){ | ^~~ | rec a.cc:28:13: error: 't' was not declared in this scope 28 | rep(t, 4){ | ^ a.cc: In function 'int main()': a.cc:47:15: error: 'cin' was not declared in this scope; did you mean 'in'? 47 | while(cin >> H >> W, H){ | ^~~ | in a.cc:49:21: error: 'i' was not declared in this scope 49 | rep(i, H){ | ^ a.cc:49:17: error: 'rep' was not declared in this scope; did you mean 'rec'? 49 | rep(i, H){ | ^~~ | rec a.cc:84:25: error: 'sort' was not declared in this scope; did you mean 'short'? 84 | sort(no, no + m, cmp); | ^~~~ | short a.cc:86:25: error: 'memset' was not declared in this scope 86 | memset(v, 0, sizeof(v)); | ^~~~~~ a.cc:86:25: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:87:25: error: 'cout' was not declared in this scope 87 | cout << (sum == sp && rec(0) ? "YES" : "NO") << endl; | ^~~~ a.cc:87:73: error: 'endl' was not declared in this scope 87 | cout << (sum == sp && rec(0) ? "YES" : "NO") << endl; | ^~~~
s426152158
p00132
C++
#include<iostream> int H, W, n, h[40], w[40], sz[40]; int m, no[10]; char in[20][21], pc[40][20][21]; bool v[20][20], u[20][20]; bool cmp(int a, int b){ return sz[a] > sz[b]; } bool rec(int c){ if(c == m) return 1; memset(u, 0, sizeof(u)); rep(i, H) rep(j, W) if(in[i][j] == '.' && !u[i][j]){ for(int k = c; k < m; k++) rep(t, 4){ int p = no[k] + t * n; for(int y = max(0, i - h[p] + 1); y <= i && y + h[p] <= H; y++) for(int x = max(0, j - w[p] + 1); x <= j && x + w[p] <= W; x++){ rep(a, h[p]) rep(b, w[p]){ if(pc[p][a][b] == '#' && in[y + a][x + b] == '#') goto FAIL; } rep(a, h[p]) rep(b, w[p]){ if(pc[p][a][b] == '#') u[y + a][x + b] = 1; } FAIL:; } } if(!u[i][j]) return 0; } rep(t, 4){ int p = no[c] + t * n; for(int y = 0; y + h[p] <= H; y++) for(int x = 0; x + w[p] <= W; x++){ bool ok = 1; rep(a, h[p]) rep(b, w[p]) if(in[y + a][x + b] == '#' && pc[p][a][b] == '#') ok = 0; if(ok){ rep(a, h[p]) rep(b, w[p]) if(pc[p][a][b] == '#') in[y + a][x + b] = '#'; bool res = rec(c + 1); rep(a, h[p]) rep(b, w[p]) if(pc[p][a][b] == '#') in[y + a][x + b] = '.'; if(res) return 1; } } } return 0; } int main() { while(cin >> H >> W, H){ int sp = 0; rep(i, H){ cin >> in[i]; rep(j, W) if(in[i][j] == '.') sp++; } cin >> n; rep(i, n){ cin >> h[i] >> w[i]; sz[i] = 0; rep(j, h[i]){ cin >> pc[i][j]; rep(k, w[i]) if(pc[i][j][k] == '#') sz[i]++; } int s = i; rep(j, 3){ int t = s + n; h[t] = w[s]; w[t] = h[s]; sz[t] = sz[s]; rep(y, h[s]) rep(x, w[s]) pc[t][x][h[s] - y - 1] = pc[s][y][x]; s = t; } } int q; cin >> q; while(q--){ cin >> m; int sum = 0; rep(i, m) cin >> no[i], sum += sz[--no[i]]; sort(no, no + m, cmp); memset(v, 0, sizeof(v)); cout << (sum == sp && rec(0) ? "YES" : "NO") << endl; } } return 0; }
a.cc: In function 'bool rec(int)': a.cc:12:9: error: 'memset' was not declared in this scope 12 | memset(u, 0, sizeof(u)); | ^~~~~~ 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 | int H, W, n, h[40], w[40], sz[40]; a.cc:13:13: error: 'i' was not declared in this scope 13 | rep(i, H) rep(j, W) if(in[i][j] == '.' && !u[i][j]){ | ^ a.cc:13:9: error: 'rep' was not declared in this scope; did you mean 'rec'? 13 | rep(i, H) rep(j, W) if(in[i][j] == '.' && !u[i][j]){ | ^~~ | rec a.cc:29:13: error: 't' was not declared in this scope 29 | rep(t, 4){ | ^ a.cc: In function 'int main()': a.cc:48:15: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 48 | while(cin >> H >> W, H){ | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:50:21: error: 'i' was not declared in this scope 50 | rep(i, H){ | ^ a.cc:50:17: error: 'rep' was not declared in this scope; did you mean 'rec'? 50 | rep(i, H){ | ^~~ | rec a.cc:85:25: error: 'sort' was not declared in this scope; did you mean 'short'? 85 | sort(no, no + m, cmp); | ^~~~ | short a.cc:87:25: error: 'memset' was not declared in this scope 87 | memset(v, 0, sizeof(v)); | ^~~~~~ a.cc:87:25: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:88:25: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 88 | cout << (sum == sp && rec(0) ? "YES" : "NO") << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:88:73: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 88 | cout << (sum == sp && rec(0) ? "YES" : "NO") << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s195259013
p00132
C++
#include<bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; int H, W, h[10], w[10], n; char f[21][21], c[10][21][21], a[21][21]; bool ok[10]; void rotate(int t) { rep(i, h[t])rep(j, w[t])a[i][j] = c[t][i][j]; fill(c[t][0], c[t][21], 0); rep(i, w[t])rep(j, h[t])c[t][i][j] = a[h[t] - j - 1][i]; swap(h[t], w[t]); } bool dfs(int p) { if (p == n) { rep(i, H)rep(j, W) { if (f[i][j] == '.')return false; } return true; } if (!ok[p])return dfs(p + 1); rep(l, 4) { rotate(p); rep(i, H - h[p] + 1)rep(j, W - w[p] + 1) { rep(k, h[p])rep(t, w[p]) { if (c[p][k][t] == '#'&&f[i + k][j + t] == '#')goto g; } rep(k, h[p])rep(t, w[p]) { if (c[p][k][t] == '#')f[i + k][j + t] = '#'; } int ret = dfs(p + 1); rep(k, h[p])rep(t, w[p]) { if (c[p][k][t] == '#')f[i + k][j + t] = '.'; } if (ret)return true; g:; } } return false; } int main() { while (scanf("%d%d", &H, &W), H) { rep(i, H)scanf("%s", f[i]); scanf("%d", &n); rep(i, n) { scanf("%d%d", &h[i], &w[i]); rep(j, h[i])scanf("%s", c[i][j]); } int p; scanf("%d", &p); rep(i, p) { int k; scanf("%d", &k); memset(ok, 0, sizeof(ok)); rep(j, k) { int t; scanf("%d", &t); t--; ok[t] = 1; } puts(dfs(0) ? "YES" : "NO"); } } }
a.cc: In function 'bool dfs(int)': a.cc:36:17: error: jump to label 'g' 36 | g:; | ^ a.cc:26:84: note: from here 26 | if (c[p][k][t] == '#'&&f[i + k][j + t] == '#')goto g; | ^ a.cc:31:29: note: crosses initialization of 'int ret' 31 | int ret = dfs(p + 1); | ^~~
s896463992
p00132
C++
#include<iostream> #include<vector> using namespace std; #define REP(i,b,n ) for(int i=b;i<n;i++) #define rep(i,n) REP(i,0,n) #define UNFILLED 0 #define FILLED 1 #define ORI true #define DUP false; char inp[20][20]; bool m[20][20]; bool visited[20][20]; typedef struct Info{ int x,y,r,c,rot; }; class Piece{ public: int r[4],c[4]; bool m[4][20][20]; vector<Info> Put; int black; bool dup[4]; bool operator<(const Piece & a)const{ return Put.size() > a.Put.size(); } }; void rotate(Piece & a,int k){ static bool tmp[20][20]; rep(i,a.r[k-1]){ rep(j,a.c[k-1]){ tmp[i][j]=a.m[k-1][i][j]; } } rep(i,a.r[k-1]){ rep(j,a.c[k-1]){ a.m[k][j][i]=tmp[i][a.c[k-1]-j-1]; } } a.r[k]=a.c[k-1]; a.c[k]=a.r[k-1]; } void duplicate_check(Piece & a){ rep(i,4)a.dup[i]=ORI; REP(i,1,4){ rotate(a,i); } rep(k,4){ REP(l,k+1,4){ bool flag = false; if ( a.r[k] !=a.r[l] ||a.c[k] != a.c[l])continue; rep(i,a.r[k] && !flag) rep(j,a.c[k] && !flag) if(a.m[k][i][j]!=a.m[l][i][j] )flag=true; if (flag == false)a.dup[l]=DUP; } } } bool can_put(int x,int y,Piece & a,int r,int c,int k){ if ( x + a.c[k]-1 >=c ||y+a.r[k]-1>= r)return false; rep(i,a.r[k]){ rep(j,a.c[k]){ if ( a.m[k][i][j]==UNFILLED ){ }else if (a.m[k][i][j]==FILLED ){ if ( m[y+i][x+j] == FILLED)return false; } } } return true; } void construct(int n,Piece * in,int r,int c){ Info ins; rep(l,n){ rep(i,r){ rep(j,c){ rep(k,4){ if (in[l].dup[k] == ORI && can_put(j,i,in[l],r,c,k) == true){ ins.x=j,ins.y=i,ins.r=in[l].r[k],ins.c=in[l].c[k]; ins.rot=k; //cout<<"rotate " << k << " -th " << endl; //cout << j <<" " << j+ins.c-1 <<" " << i << " " << i+ins.r-1 << endl; in[l].Put.push_back(ins); } } } } } } bool Operation(Piece &in,int me,int flag){ //flag=0 check,flag=1 put ,flag=2 remove int x=in.Put[me].x,y=in.Put[me].y,r=in.Put[me].r,c=in.Put[me].c,k=in.Put[me].rot; rep(i,r){ rep(j,c){ if( flag == 0){ if ( m[y+i][x+j]==FILLED){ if (in.m[k][i][j]==FILLED)return false; } }else if ( flag == 1){ if( in.m[k][i][j]==FILLED)m[i][j]=FILLED; }else if ( flag == 2){ if (in.m[k][i][j]==FILLED)m[i][j]=UNFILLED; } } } return true; } bool solve(int n,int now,Piece *in){ if ( n == now){ return true; } rep(i,in[now].Put.size()){ if ( Operation(in[now],i,0) ){ Operation(in[now],i,1); if (solve(n,now+1,in) )return true; Operation(in[now],i,2); } } return false; } main(){ int r,c; char tmp[20]; Piece sol[10]; Piece in[10]; while(cin>>r >>c && r){ int white = 0; rep(i,r){ cin>>inp[i]; rep(j,c){ if ( inp[i][j]=='#')m[i][j]=FILLED; else m[i][j]=UNFILLED,white++; visited[i][j]=false; } } int n; cin>>n; rep(k,n){ cin>>in[k].r[0]>>in[k].c[0]; in[k].black=0; rep(i,in[k].r[0]){ cin>>tmp; rep(j,in[k].c[0]){ if ( tmp[j] == '#')in[k].m[0][i][j]=FILLED,in[k].black++; else in[k].m[0][i][j]=UNFILLED; } } duplicate_check(in[k]); } construct(n,in,r,c); int q; cin>>q; rep(i,q){ int m; cin>>m; int ind[m],total=0; rep(j,m)cin>>ind[j],total+=in[ind[j]-1].black,sol[j]=in[ind[j]-1]; if ( white !=total){puts("NO");continue;} sort(sol,sol+m); if ( solve(m,0,sol))puts("YES"); else puts("NO"); } } }
a.cc:16:1: warning: 'typedef' was ignored in this declaration 16 | typedef struct Info{ | ^~~~~~~ a.cc:141:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 141 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:185:7: error: 'sort' was not declared in this scope; did you mean 'short'? 185 | sort(sol,sol+m); | ^~~~ | short
s396431700
p00132
C++
#include<iostream> #include<vector> using namespace std; #define REP(i,b,n ) for(int i=b;i<n;i++) #define rep(i,n) REP(i,0,n) #define UNFILLED 0 #define FILLED 1 #define ORI true #define DUP false; char inp[20][20]; bool m[20][20]; bool visited[20][20]; typedef struct Info{ int x,y,r,c,rot; }; class Piece{ public: int r[4],c[4]; bool m[4][20][20]; vector<Info> Put; int black; bool dup[4]; bool operator<(const Piece & a)const{ return Put.size() > a.Put.size(); } }; void rotate(Piece & a,int k){ static bool tmp[20][20]; rep(i,a.r[k-1]){ rep(j,a.c[k-1]){ tmp[i][j]=a.m[k-1][i][j]; } } rep(i,a.r[k-1]){ rep(j,a.c[k-1]){ a.m[k][j][i]=tmp[i][a.c[k-1]-j-1]; } } a.r[k]=a.c[k-1]; a.c[k]=a.r[k-1]; } void duplicate_check(Piece & a){ rep(i,4)a.dup[i]=ORI; REP(i,1,4){ rotate(a,i); } rep(k,4){ REP(l,k+1,4){ bool flag = false; if ( a.r[k] !=a.r[l] ||a.c[k] != a.c[l])continue; rep(i,a.r[k] && !flag) rep(j,a.c[k] && !flag) if(a.m[k][i][j]!=a.m[l][i][j] )flag=true; if (flag == false)a.dup[l]=DUP; } } } bool can_put(int x,int y,Piece & a,int r,int c,int k){ if ( x + a.c[k]-1 >=c ||y+a.r[k]-1>= r)return false; rep(i,a.r[k]){ rep(j,a.c[k]){ if ( a.m[k][i][j]==UNFILLED ){ }else if (a.m[k][i][j]==FILLED ){ if ( m[y+i][x+j] == FILLED)return false; } } } return true; } void construct(int n,Piece * in,int r,int c){ Info ins; rep(l,n){ rep(i,r){ rep(j,c){ rep(k,4){ if (in[l].dup[k] == ORI && can_put(j,i,in[l],r,c,k) == true){ ins.x=j,ins.y=i,ins.r=in[l].r[k],ins.c=in[l].c[k]; ins.rot=k; in[l].Put.push_back(ins); } } } } } } bool Operation(Piece &in,int me,int flag){ //flag=0 check,flag=1 put ,flag=2 remove int x=in.Put[me].x,y=in.Put[me].y,r=in.Put[me].r,c=in.Put[me].c,k=in.Put[me].rot; rep(i,r){ rep(j,c){ if( flag == 0){ if ( m[y+i][x+j]==FILLED){ if (in.m[k][i][j]==FILLED)return false; } }else if ( flag == 1){ if( in.m[k][i][j]==FILLED)m[y+i][x+j]=FILLED; }else if ( flag == 2){ if (in.m[k][i][j]==FILLED)m[y+i][x+j]=UNFILLED; } } } return true; } bool solve(int n,int now,Piece *in){ if ( n == now){ return true; } rep(i,in[now].Put.size()){ if ( Operation(in[now],i,0) ){ Operation(in[now],i,1); if (solve(n,now+1,in) &&Operation(in[now],i,2))return true; Operation(in[now],i,2); } } return false; } main(){ int r,c; char tmp[20]; Piece sol[10]; Piece in[10]; while(cin>>r >>c && r){ int white = 0; rep(i,r){ cin>>inp[i]; rep(j,c){ if ( inp[i][j]=='#')m[i][j]=FILLED; else m[i][j]=UNFILLED,white++; visited[i][j]=false; } } int n; cin>>n; rep(k,n){ cin>>in[k].r[0]>>in[k].c[0]; in[k].black=0; rep(i,in[k].r[0]){ cin>>tmp; rep(j,in[k].c[0]){ if ( tmp[j] == '#')in[k].m[0][i][j]=FILLED,in[k].black++; else in[k].m[0][i][j]=UNFILLED; } } duplicate_check(in[k]); } construct(n,in,r,c); int q; cin>>q; rep(i,q){ int m; cin>>m; int ind[m],total=0; rep(j,m)cin>>ind[j],total+=in[ind[j]-1].black,sol[j]=in[ind[j]-1]; if ( white !=total){puts("NO");continue;} sort(sol,sol+m); if ( solve(m,0,sol))puts("YES"); else puts("NO"); } } return false; }
a.cc:16:1: warning: 'typedef' was ignored in this declaration 16 | typedef struct Info{ | ^~~~~~~ a.cc:139:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 139 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:183:7: error: 'sort' was not declared in this scope; did you mean 'short'? 183 | sort(sol,sol+m); | ^~~~ | short
s417678038
p00132
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; #define REP(i,b,n ) for(int i=b;i<n;i++) #define rep(i,n) REP(i,0,n) #define UNFILLED 0 #define FILLED 1 #define ORI true #define DUP false; char inp[20][20]; bool m[20][20]; bool visited[20][20]; typedef struct Info{ int x,y,r,c,rot; }; class Piece{ public: int r[4],c[4]; bool m[4][20][20]; vector<Info> Put; int black; bool dup[4]; bool operator<(const Piece & a)const{ return Put.size() > a.Put.size(); } }; void rotate(Piece & a,int k){ static bool tmp[20][20]; rep(i,a.r[k-1]){ rep(j,a.c[k-1]){ tmp[i][j]=a.m[k-1][i][j]; } } rep(i,a.r[k-1]){ rep(j,a.c[k-1]){ a.m[k][j][i]=tmp[i][a.c[k-1]-j-1]; } } a.r[k]=a.c[k-1]; a.c[k]=a.r[k-1]; } void duplicate_check(Piece & a){ rep(i,4)a.dup[i]=ORI; REP(i,1,4){ rotate(a,i); } rep(k,4){ REP(l,k+1,4){ bool flag = false; if ( a.r[k] !=a.r[l] ||a.c[k] != a.c[l])continue; rep(i,a.r[k] && !flag) rep(j,a.c[k] && !flag) if(a.m[k][i][j]!=a.m[l][i][j] )flag=true; if (flag == false)a.dup[l]=DUP; } } } bool can_put(int x,int y,Piece & a,int r,int c,int k){ if ( x + a.c[k]-1 >=c ||y+a.r[k]-1>= r)return false; rep(i,a.r[k]){ rep(j,a.c[k]){ if ( a.m[k][i][j]==UNFILLED ){ }else if (a.m[k][i][j]==FILLED ){ if ( m[y+i][x+j] == FILLED)return false; } } } return true; } void construct(int n,Piece * in,int r,int c){ Info ins; rep(l,n){ rep(i,r){ rep(j,c){ rep(k,4){ if (in[l].dup[k] == ORI && can_put(j,i,in[l],r,c,k) == true){ ins.x=j,ins.y=i,ins.r=in[l].r[k],ins.c=in[l].c[k]; ins.rot=k; in[l].Put.push_back(ins); } } } } } } bool Operation(Piece &in,int me,int flag){ //flag=0 check,flag=1 put ,flag=2 remove int x=in.Put[me].x,y=in.Put[me].y,r=in.Put[me].r,c=in.Put[me].c,k=in.Put[me].rot; rep(i,r){ rep(j,c){ if( flag == 0){ if ( m[y+i][x+j]==FILLED){ if (in.m[k][i][j]==FILLED)return false; } }else if ( flag == 1){ if( in.m[k][i][j]==FILLED)m[y+i][x+j]=FILLED; }else if ( flag == 2){ if (in.m[k][i][j]==FILLED)m[y+i][x+j]=UNFILLED; } } } return true; } bool solve(int n,int now,Piece *in){ if ( n == now){ return true; } rep(i,in[now].Put.size()){ if ( Operation(in[now],i,0) ){ Operation(in[now],i,1); if (solve(n,now+1,in)){ Operation(in[now],i,2); return true; } Operation(in[now],i,2); } } return false; } main(){ int r,c; char tmp[20]; Piece sol[400]; Piece in[10]; while(cin>>r >>c && r){ int white = 0; rep(i,r){ cin>>inp[i]; rep(j,c){ if ( inp[i][j]=='#')m[i][j]=FILLED; else m[i][j]=UNFILLED,white++; visited[i][j]=false; } } int n; cin>>n; rep(k,n){ cin>>in[k].r[0]>>in[k].c[0]; in[k].black=0; rep(i,in[k].r[0]){ cin>>tmp; rep(j,in[k].c[0]){ if ( tmp[j] == '#')in[k].m[0][i][j]=FILLED,in[k].black++; else in[k].m[0][i][j]=UNFILLED; } } duplicate_check(in[k]); } construct(n,in,r,c); int q; cin>>q; int ind[500]; rep(i,q){ int m; cin>>m; int ,total=0; rep(j,m){ cin>>ind[j]; total+=in[ind[j]-1].black; sol[j]=in[ind[j]-1]; } if ( white !=total){puts("NO");continue;} sort(sol,sol+m); if ( solve(m,0,sol))puts("YES"); else puts("NO"); } } return false; }
a.cc:17:1: warning: 'typedef' was ignored in this declaration 17 | typedef struct Info{ | ^~~~~~~ a.cc:143:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 143 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:184:11: error: expected unqualified-id before ',' token 184 | int ,total=0; | ^
s113104326
p00132
C++
#include <cstdio> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> #include <queue> #include <cstring> #include <deque> using namespace std; #define reep(i,f,t) for(int i=f ; i<int(t) ; ++i) #define rep(i,n) reep(i, 0, n) typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pii; struct Board { int h, w, sy, sx; int map[20]; }; struct Part { Board boards[4]; int area; int id; bool operator> (const Part& p)const { return area > p.area; } }; int n; Board puzzle; int puzzleArea; Part parts[10]; int choice[10]; int m; int rec; int makeable[1024]; int makeNum; void makeCombination(int p, int n, int sum) { if(n == 0){ makeable[makeNum++] = sum; } else if(n <= m-p){ makeCombination(p+1, n, sum); makeCombination(p+1, n-1, sum+parts[choice[p]].area); } } // puz‚Ì(y, x)‚ðpts‚Ì(sy, sx)‚ɍ‡‚킹‚Ä‚¨‚¯‚é‚©‚ð”»’è‚·‚é bool fit(int puz[20], const Board pts, int y, int x) { int fy = y - pts.sy; int fx = x - pts.sx; if(fy<0 || puzzle.h<fy+pts.h || fx<0 || puzzle.w<fx+pts.w) return false; rep(i, pts.h){ if((puz[fy+i]>>fx) & pts.map[i]) return false; } return true; } void putremove(int puz[20], const Board& pts, int y, int x, bool put) { int fy = y - pts.sy; int fx = x - pts.sx; rep(i, pts.h){ if(put) puz[fy+i] |= pts.map[i] << fx; else puz[fy+i] ^= pts.map[i] << fx; } } // frm‚ð90“x‰ñ“]‚³‚¹‚½‚à‚Ì‚ðto‚ɏ‘‚«‚±‚Þ void rotate(const Board& frm, Board& to) { rep(i, frm.w) to.map[i] = 0; rep(i, frm.h) rep(j, frm.w){ to.map[j] |= ((frm.map[i]>>j)&1) << (frm.h-i-1); } to.h = frm.w; to.w = frm.h; } void dump(const int tmp[20], int h, int w) { rep(i, h){ rep(j, w) putchar((tmp[i]>>j)&1 ? '#' : '.'); puts(""); } } void dump(const Board& board) { dump(board.map, board.h, board.w); } int countUp(char tmp[20][20], int y, int x) { const int dy[] = {-1, 0, 0, 1}; const int dx[] = {0, -1, 1, 0}; int ret = 0; tmp[y][x] = '#'; rep(i, 4){ int py = y + dy[i]; int px = x + dx[i]; if(py<0 || puzzle.h<=py || px<0 || puzzle.w<=px || tmp[py][px] == '#') continue; ret += countUp(tmp, py, px); } return ret + 1; } // Ž}Š ‚è—p bool isok() { char tmp[20][20]; rep(i, puzzle.h) rep(j, puzzle.w) tmp[i][j] = (puzzle.map[i]>>j) & 1 ? '#' : '.'; rep(i, puzzle.h) rep(j, puzzle.w){ if(tmp[i][j] == '.'){ int ret = countUp(tmp, i, j); if(!binary_search(makeable, makeable + makeNum, ret)) return false; } } return true; } // (y, z)‚ɐâ‘Î’u‚­‚Æ‚µ‚čċA‚·‚é bool search(int n, int y, int x) { printf("n = %d\n", n); dump(puzzle); puts(""); getchar(); ++rec; // Ž}Š ‚è //if(!isok()){ // return false; //} while(y<puzzle.h && (puzzle.map[y]>>x)&1){ ++x; if(x == puzzle.w){ ++y; x = 0; } } // ‹ó‚¢‚Ä‚éêŠ‚ª–³‚¢ if(y == puzzle.h) return true; reep(i, n, m){ rep(j, 4){ Board& board = parts[choice[i]].boards[j]; if(fit(puzzle.map, board, y, x)){ putremove(puzzle.map, board, y, x, true); swap(choice[i], choice[n]); bool ret = search(n+1, y, x); swap(choice[i], choice[n]); putremove(puzzle.map, board, y, x, false); if(ret) return true; } } } return false; } // ƒp[ƒcn‚ðâ‘΂Ɏg‚¤‚à‚̂Ƃµ‚čċA‚·‚é bool search2(int n) { if(n==m) return true; rep(i, puzzle.h) rep(j, puzzle.w){ rep(k, 4){ Board& board = parts[choice[n]].boards[k]; if(fit(puzzle.map, board, i, j)){ putremove(puzzle.map, board, i, j, true); bool ret = search(n+1, 0, 0); putremove(puzzle.map, board, i, j, false); if(ret) return true; } } } return false; } // mask‚Ì‘g‚ݍ‡‚킹‚̃p[ƒc‚ł‚­‚ê‚é‚©‚Ç‚¤‚© bool collect() { int sum = 0; rep(i, m){ sum += parts[choice[i]].area; } if(sum != puzzleArea) return false; return search2(0); } int main() { int hoge=0; while(scanf("%d%d", &puzzle.h, &puzzle.w), puzzle.h){ ++hoge; if(hoge==1000){ puts(reinterpret_cast<char*>(i)); } puzzleArea = 0; rep(i, puzzle.h){ char str[32]; scanf("%s", str); puzzle.map[i] = 0; rep(j, puzzle.w){ puzzle.map[i] |= (str[j]=='#')<<j; puzzleArea += str[j] == '.'; } } scanf("%d", &n); rep(i, n){ scanf("%d%d", &parts[i].boards[0].h, &parts[i].boards[0].w); parts[i].area = 0; parts[i].id = i; rep(j, parts[i].boards[0].h){ char str[32]; parts[i].boards[0].map[j] = 0; scanf("%s", str); rep(k, parts[i].boards[0].w){ parts[i].boards[0].map[j] |= (str[k]=='#')<<k; parts[i].area += str[k] == '#'; } } rep(j, 3){ rotate(parts[i].boards[j], parts[i].boards[j+1]); } rep(j, 4){ rep(k, parts[i].boards[j].h) rep(l, parts[i].boards[j].w){ if((parts[i].boards[j].map[k]>>l)&1){ parts[i].boards[j].sy = k; parts[i].boards[j].sx = l; k = parts[i].boards[j].h; break; } } } } sort(parts, parts+n, greater<Part>()); map<int, int> table; rep(i, n) table[parts[i].id] = i; int p; scanf("%d", &p); rep(i, p){ scanf("%d", &m); rep(j, m){ int a; scanf("%d", &a); choice[j] = table[a-1]; } sort(choice, choice+m); makeNum = 0; reep(j, 1, m+1) makeCombination(0, j, 0); sort(makeable, makeable + makeNum); makeNum = unique(makeable, makeable + makeNum) - makeable; rec = 0; puts(collect() ? "YES" : "NO"); //printf("makeNum = %d, rec = %d\n", makeNum, rec); } } return 0; }
a.cc: In function 'int main()': a.cc:228:54: error: 'i' was not declared in this scope; did you mean 'vi'? 228 | puts(reinterpret_cast<char*>(i)); | ^ | vi
s692260802
p00132
C++
#include<iostream> #include<string> #include<vector> using namespace std; int H,W; typedef vector<string> P; P V; vector<P> K; vector<int> Ans; int n; bool same[20][20]; P fill(P All,int ny,int nx,int k,int r){ int h=K[k].size(),w=K[k][0].size(); P temp; if(r==0) temp=K[k]; if(r==1){ for(int x=w-1;x>=0;x--){ string s=""; for(int y=0;y<h;y++) s+=K[k][y][x]; temp.push_back(s); } } if(r==2){ for(int y=h-1;y>=0;y--){ string s=""; for(int x=w-1;x>=0;x--) s+=K[k][y][x]; temp.push_back(s); } } if(r==3){ for(int x=0;x<w;x++){ string s=""; for(int y=h-1;y>=0;y--) s+=K[k][y][x]; temp.push_back(s); } } int sy=0,sx=0,count=0; while(temp[sy][sx]!='#'){count++;sx++;} nx-=count; for(int y=0;y<temp.size();y++) for(int x=0;x<temp[y].size();x++){ if(ny+y<0 || nx+x<0 || ny+y>=H || nx+x>=W){return P(1,"");} if(temp[y][x]!='#') continue; if(All[ny+y][nx+x]=='#') return P(1,""); All[ny+y][nx+x]='#'; } return All; } void check(P All,int y,int x,int bit){ if(All[y][x]=='#'){ if(y==H-1 && x==W-1){Ans.push_back(bit); return;} if(x==W-1)check(All,y+1,0,bit); else check(All,y,x+1,bit); } else{ for(int i=0;i<n;i++){ int nb=1<<i; if(bit&nb) continue; bool ok=true; for(int j=0;j<i;j++) if(same[j][i] && !(bit&1<<j)){ ok=false; break; } if(!ok) break; for(int r=0;r<4;r++){ P next=fill(All,y,x,i,r); if(next[0].size()==0) continue; check(next,y,x,nb|bit); } } } } void solve() { V.clear(); V.resize(H); Ans.clear(); memset(same,false,sizeof(same)); for(int i=0;i<H;i++){ string s; cin>>s; V[i]=s; } cin>>n; K.clear(); K.resize(n); for(int i=0;i<n;i++){ int h,w; cin>>h>>w; string s; K[i].resize(h); for(int y=0;y<h;y++){cin>>s;K[i][y]=s;} } for(int i=0;i<n;i++) for(int j=i+1;j<n;j++){ if(K[i]==K[j]){ same[i][j]=true; same[j][i]=true; } } check(V,0,0,0); int T;cin>>T; for(int i=0;i<T;i++){ int num;cin>>num; vector<int> test; int bit=0; for(int j=0;j<num;j++){int temp;cin>>temp;bit=bit|1<<(temp-1);} bool ok=false; for(int j=0;j<Ans.size();j++){ if(Ans[j]==bit) ok=true; } if(ok) cout<<"YES\n"; else cout<<"NO\n"; } } int main() { while(cin>>H>>W){ if(H==0) break; solve(); } return 0; }
a.cc: In function 'void solve()': a.cc:95:9: error: 'memset' was not declared in this scope 95 | memset(same,false,sizeof(same)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<vector> +++ |+#include <cstring> 4 | using namespace std;
s528026698
p00132
C++
#include <algorithm> #include <set> #include <bitset> #include <cstdio> #include <map> using namespace std; #define reps(i,f,n) for(int i=f; i<int(n); ++i) #define rep(i,n) reps(i,0,n) struct Piece { int h, w, area, topleft; int map[20]; void input(bool inv) { scanf("%d%d", &h, &w); rep(i, h){ char str[32]; scanf("%s", str); map[i] = 0; rep(j, w){ if((str[j]=='#') ^ inv) map[i] |= (1 << j); } } } void trim() { int top=h,bottom=0,left=w,right=0; rep(i, h) rep(j, w){ if((map[i]>>j)&1){ top = min(top, i); bottom = max(bottom, i); left = min(left, j); right = max(right, j); } } ++bottom; ++right; int tmp[20]; copy(map, map+h, tmp); fill(map, map+h, 0); reps(i, top, bottom) reps(j, left, right){ map[i-top] |= ((tmp[i]>>j)&1) << (j-left); } h = bottom - top; w = right - left; } void dump() { rep(i, h){ rep(j, w) putchar((map[i]>>j)&1 ? '#' : '.'); puts(""); } } Piece rotate() { Piece p; p.h = w; p.w = h; fill(p.map, p.map+p.h, 0); rep(i, h) rep(j, w) p.map[j] |= ((map[i]>>j)&1) << (h-i-1); return p; } void calculate() { area = 0; rep(i, h) area += __builtin_popcount(map[i]); rep(j, w){ if((map[0]>>j)&1){ topleft = j; break; } } } // (y, x)にpを重ねて置けるかどうかを返す。 bool check(int y, int x, const Piece& p) { if(x<0 || w<x+p.w || h<y+p.h) return false; rep(i, p.h){ if(((map[i+y]>>x) & p.map[i]) != p.map[i]) return false; } return true; } // (y, x)にpを重ねて置く。 inline void put(int y, int x, const Piece& p) { rep(i, p.h) map[i+y] |= p.map[i] << x; } // (y, x)に置かえれているpを除去する。 inline void remove(int y, int x, const Piece& p) { rep(i, p.h) map[i+y] ^= p.map[i] << x; } }; int n, k; Piece puzzle; Piece piece[10][4]; int selected[10]; bool search(int d) { ++cnt; if(d == k) return true; Piece tmp; fill(tmp.map, tmp.map+puzzle.h, 0); reps(l, d, k) rep(m, 4){ Piece& p = piece[selected[l]][m]; rep(i, puzzle.h-p.h+1) rep(j, puzzle.w-p.w+1){ if(puzzle.check(i, j, p)) tmp.put(i, j, p); } } if(!equal(puzzle.map, puzzle.map+puzzle.h, tmp.map)) return false; rep(l, 4){ Piece& p = piece[selected[d]][l]; rep(i, puzzle.h-p.h+1) rep(j, puzzle.w-p.w+1){ if(puzzle.check(i, j, p)){ puzzle.remove(i, j, p); bool ret = search(d+1); puzzle.put(i, j, p); if(ret) return true; } } } return false; } int main() { for(;;){ puzzle.input(true); if(puzzle.h == 0) break; puzzle.trim(); puzzle.calculate(); scanf("%d", &n); rep(i, n){ piece[i][0].input(false); piece[i][0].trim(); piece[i][0].calculate(); rep(j, 3){ piece[i][j+1] = piece[i][j].rotate(); piece[i][j+1].calculate(); } } int m; scanf("%d", &m); map<int, bool> memo; rep(i, m){ scanf("%d", &k); int mask = 0; rep(j, k){ scanf("%d", &selected[j]); --selected[j]; mask |= 1 << selected[j]; } bool ans; if(memo.count(mask)) ans = memo[mask]; else{ int area = 0; rep(j, k) area += piece[selected[j]][0].area; if(area != puzzle.area) ans = memo[mask] = false; else ans = memo[mask] = search(0); } puts(ans ? "YES" : "NO"); } } return 0; }
a.cc: In function 'bool search(int)': a.cc:125:11: error: 'cnt' was not declared in this scope; did you mean 'int'? 125 | ++cnt; | ^~~ | int
s031294547
p00132
C++
#include <iostream> #include <vector> #include <cstring> using namespace std; class P{ public: int h, w; char t[22][22]; P(){} P(int _h, int _w, char _t[22][22]){ h = _h; w = _w; memcpy(t, _t, sizeof(char) * 22 * 22); } P rotate(){ char tmp[22][22]; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ tmp[j][h - i - 1] = t[i][j]; } } return P(w, h, tmp); } void toCompact(){ int subH = 0; for(int i = 0; i < h; i++){ bool flg = true; for(int j = 0; j < w; j++){ if(t[i][j] != '#') continue; flg = false; break; } if(flg) subH++; else break; } h -= subH; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ t[i][j] = t[i + subH][j]; } } int subW = 0; for(int j = 0; j < w; j++){ bool flg = true; for(int i = 0; i < h; i++){ if(t[i][j] != '#') continue; flg = false; break; } if(flg) subW++; else break; } w -= subW; for(int j = 0; j < w; j++){ for(int i = 0; i < h; i++){ t[i][j] = t[i][j + subW]; } } subH = 0; for(int i = h - 1; i >= 0; i--){ bool flg = true; for(int j = 0; j < w; j++){ if(t[i][j] != '#') continue; flg = false; break; } if(flg) subH++; else break; } h -= subH; subW = 0; for(int j = w - 1; j >= 0; j--){ bool flg = true; for(int i = 0; i < h; i++){ if(t[i][j] != '#') continue; flg = false; break; } if(flg) subW++; else break; } w -= subW; } void show(){ cout << "--\n"; cout << h << " " << w << endl; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ cout << t[i][j]; } cout << endl; } } }; int H, W, n; int tcnt, pcnt[12]; char t[22][22]; P p[12][4]; vector<int> sx[12][4], sy[12][4]; int m; int v[12]; bool cmp(const int &x, const int &y){ return pcnt[x] > pcnt[y]; } bool match(const P &pc, int si, int sj){ for(int i = 0; i < pc.h; i++){ for(int j = 0; j < pc.w; j++){ if(pc.t[i][j] == '#' && t[si + i][sj + j] != '.'){ return false; } } } return true; } void calcPos(){ for(int kind = 0; kind < n; kind++){ for(int d = 0; d < 4; d++){ sx[kind][d].clear(); sy[kind][d].clear(); for(int si = 0; si + p[kind][d].h <= H; si++){ for(int sj = 0; sj + p[kind][d].w <= W; sj++){ if(!match(p[kind][d], si, sj)) continue; sx[kind][d].push_back(sj); sy[kind][d].push_back(si); } } } } } void draw(const P &pc, int si, int sj, char ch){ for(int i = 0; i < pc.h; i++){ for(int j = 0; j < pc.w; j++){ if(pc.t[i][j] == '.') continue; t[si + i][sj + j] = ch; } } } bool check(int idx){ for(int i = idx; i < m; i++){ int kind = v[i]; bool flg = false; for(int d = 0; !flg && d < 4; d++){ for(int j = 0; j < sx[kind][d].size(); j++){ if(match(p[kind][d], sy[kind][d][j], sx[kind][d][j])){ flg = true; break; } } } if(!flg) return false; } return true; } bool dfs(int idx){ if(idx == m){ return true; } if(0 < idx && !check(idx)){ return false; } int kind = v[idx]; for(int d = 0; d < 4; d++){ for(int i = 0; i < sx[kind][d].size(); i++){ if(!match(p[kind][d], sy[kind][d][i], sx[kind][d][i])) continue; draw(p[kind][d], sy[kind][d][i], sx[kind][d][i], '#'); bool tmp = dfs(idx + 1); draw(p[kind][d], sy[kind][d][i], sx[kind][d][i], '.'); if(tmp) return true; } } return false; } bool solve(){ int sumCnt = 0; for(int i = 0; i < m; i++){ sumCnt += pcnt[v[i]]; } if(sumCnt != tcnt) return false; sort(v, v + m, cmp); /* for(int kind = 0; kind < n; kind++){ for(int d = 0; d < 4; d++){ cout<<kind<<", "<<d<<" : "; for(int i = 0; i < sx[kind][d].size(); i++){ cout << "(" << sx[kind][d][i]<<", "<<sy[kind][d][i] << ") "; } cout <<endl; } } */ return dfs(0); } int main(){ while(cin >> H >> W, H || W){ tcnt = 0; for(int i = 0; i < H; i++){ cin >> t[i]; for(int j = 0; j < W; j++){ if(t[i][j] == '.'){ tcnt++; } } } cin >> n; for(int i = 0; i < n; i++){ int h, w; char tmp[22][22]; cin >> h >> w; pcnt[i] = 0; for(int j = 0; j < h; j++){ cin >> tmp[j]; for(int k = 0; k < w; k++){ if(tmp[j][k] == '#'){ pcnt[i]++; } } } p[i][0] = P(h, w, tmp); p[i][0].toCompact(); for(int j = 1; j < 4; j++){ p[i][j] = p[i][j - 1].rotate(); } } calcPos(); int Q; cin >> Q; for(int i = 0; i < Q; i++){ cin >> m; for(int j = 0; j < m; j++){ cin >> v[j]; v[j]--; } cout << (solve() ? "YES" : "NO") << endl; } } }
a.cc: In function 'bool solve()': a.cc:215:3: error: 'sort' was not declared in this scope; did you mean 'short'? 215 | sort(v, v + m, cmp); | ^~~~ | short
s810674517
p00132
C++
#include <iostream> #include <vector> #include <cstring> #include <cstdio> #include <cstdlib> using namespace std; class P{ public: int h, w; char t[22][22]; P(){} P(int _h, int _w, char _t[22][22]){ h = _h; w = _w; memcpy(t, _t, sizeof(char) * 22 * 22); } P rotate(){ char tmp[22][22]; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ tmp[j][h - i - 1] = t[i][j]; } } return P(w, h, tmp); } void toCompact(){ int subH = 0; for(int i = 0; i < h; i++){ bool flg = true; for(int j = 0; j < w; j++){ if(t[i][j] != '#') continue; flg = false; break; } if(flg) subH++; else break; } h -= subH; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ t[i][j] = t[i + subH][j]; } } int subW = 0; for(int j = 0; j < w; j++){ bool flg = true; for(int i = 0; i < h; i++){ if(t[i][j] != '#') continue; flg = false; break; } if(flg) subW++; else break; } w -= subW; for(int j = 0; j < w; j++){ for(int i = 0; i < h; i++){ t[i][j] = t[i][j + subW]; } } subH = 0; for(int i = h - 1; i >= 0; i--){ bool flg = true; for(int j = 0; j < w; j++){ if(t[i][j] != '#') continue; flg = false; break; } if(flg) subH++; else break; } h -= subH; subW = 0; for(int j = w - 1; j >= 0; j--){ bool flg = true; for(int i = 0; i < h; i++){ if(t[i][j] != '#') continue; flg = false; break; } if(flg) subW++; else break; } w -= subW; } void show(){ cout << "--\n"; cout << h << " " << w << endl; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ cout << t[i][j]; } cout << endl; } } }; int H, W, n; int tcnt, pcnt[12]; char t[22][22]; P p[12][4]; vector<int> sx[12][4], sy[12][4]; int m; int v[12]; bool cmp(const int &x, const int &y){ return pcnt[x] > pcnt[y]; } bool match(const P &pc, int si, int sj){ for(int i = 0; i < pc.h; i++){ for(int j = 0; j < pc.w; j++){ if(pc.t[i][j] == '#' && t[si + i][sj + j] != '.'){ return false; } } } return true; } void calcPos(){ for(int kind = 0; kind < n; kind++){ for(int d = 0; d < 4; d++){ sx[kind][d].clear(); sy[kind][d].clear(); for(int si = 0; si + p[kind][d].h <= H; si++){ for(int sj = 0; sj + p[kind][d].w <= W; sj++){ if(!match(p[kind][d], si, sj)) continue; sx[kind][d].push_back(sj); sy[kind][d].push_back(si); } } } } } void draw(const P &pc, int si, int sj, char ch){ for(int i = 0; i < pc.h; i++){ for(int j = 0; j < pc.w; j++){ if(pc.t[i][j] == '.') continue; t[si + i][sj + j] = ch; } } } bool check(int idx){ for(int i = idx; i < m; i++){ int kind = v[i]; bool flg = false; for(int d = 0; !flg && d < 4; d++){ for(int j = 0; j < sx[kind][d].size(); j++){ if(match(p[kind][d], sy[kind][d][j], sx[kind][d][j])){ flg = true; break; } } } if(!flg) return false; } return true; } bool dfs(int idx){ if(idx == m){ return true; } if(0 < idx && !check(idx)){ return false; } int kind = v[idx]; for(int d = 0; d < 4; d++){ for(int i = 0; i < sx[kind][d].size(); i++){ if(!match(p[kind][d], sy[kind][d][i], sx[kind][d][i])) continue; draw(p[kind][d], sy[kind][d][i], sx[kind][d][i], '#'); bool tmp = dfs(idx + 1); draw(p[kind][d], sy[kind][d][i], sx[kind][d][i], '.'); if(tmp) return true; } } return false; } bool solve(){ int sumCnt = 0; for(int i = 0; i < m; i++){ sumCnt += pcnt[v[i]]; } if(sumCnt != tcnt) return false; sort(v, v + m, cmp); /* for(int kind = 0; kind < n; kind++){ for(int d = 0; d < 4; d++){ cout<<kind<<", "<<d<<" : "; for(int i = 0; i < sx[kind][d].size(); i++){ cout << "(" << sx[kind][d][i]<<", "<<sy[kind][d][i] << ") "; } cout <<endl; } } */ return dfs(0); } int main(){ while(cin >> H >> W, H || W){ tcnt = 0; for(int i = 0; i < H; i++){ cin >> t[i]; for(int j = 0; j < W; j++){ if(t[i][j] == '.'){ tcnt++; } } } cin >> n; for(int i = 0; i < n; i++){ int h, w; char tmp[22][22]; cin >> h >> w; pcnt[i] = 0; for(int j = 0; j < h; j++){ cin >> tmp[j]; for(int k = 0; k < w; k++){ if(tmp[j][k] == '#'){ pcnt[i]++; } } } p[i][0] = P(h, w, tmp); p[i][0].toCompact(); for(int j = 1; j < 4; j++){ p[i][j] = p[i][j - 1].rotate(); } } calcPos(); int Q; cin >> Q; for(int i = 0; i < Q; i++){ cin >> m; for(int j = 0; j < m; j++){ cin >> v[j]; v[j]--; } cout << (solve() ? "YES" : "NO") << endl; } } }
a.cc: In function 'bool solve()': a.cc:217:3: error: 'sort' was not declared in this scope; did you mean 'short'? 217 | sort(v, v + m, cmp); | ^~~~ | short
s629643837
p00133
C
#include<stdio.h> char MAP[8][9];//??????????????± void rotate(){//????????????90????????¢ char bM[8][9]; memcpy(bM,MAP,72); for(int i=0;i<8;i++){ for(int j=0;j<8;j++){ MAP[i][j]=bM[7-j][i]; } } } void showmap(){//?????????????????? for(int i=0;i<8;i++){ printf("%s\n",MAP[i]); } } int main(){ for(int i=0;i<8;i++){ scanf("%s",MAP[i]); } printf("90\n"); rotate(); showmap(); printf("180\n"); rotate(); showmap(); printf("270\n"); rotate(); showmap(); return 0; }
main.c: In function 'rotate': main.c:6:9: error: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration] 6 | memcpy(bM,MAP,72); | ^~~~~~ main.c:2:1: note: include '<string.h>' or provide a declaration of 'memcpy' 1 | #include<stdio.h> +++ |+#include <string.h> 2 | main.c:6:9: warning: incompatible implicit declaration of built-in function 'memcpy' [-Wbuiltin-declaration-mismatch] 6 | memcpy(bM,MAP,72); | ^~~~~~ main.c:6:9: note: include '<string.h>' or provide a declaration of 'memcpy'
s858810242
p00133
C
#include"env.h" char s[72],r[72]; R(){ int x,y; memcpy(s,r,71); for(y=0;y<8;y++) for(x=0;x<8;x++) r[x+y*9]=s[y+(7-x)*9]; puts(r); } main(i){ read(0,r,71); for(i=1;i<=3;i++){ printf("%d\n",90*i); R(); } exit(0); }
main.c:1:9: fatal error: env.h: No such file or directory 1 | #include"env.h" | ^~~~~~~ compilation terminated.
s568941423
p00133
C
#include <stdio.h> #incldue <string.h> int rotate(char pat[8][9]) { char buf[8][9]; int x,y; for(y=0;y<8;y++) { for(x=0;x<8;x++) { buf[x][8-y]=pat[y][x]; } } memcpy(pat,buf,sizeof(pat)); } int main(void) { char buf[8][9]; int i; for(i=0;i<8;i++)scanf("%s",buf[i]); rotate(buf); puts("90"); for(i=0;i<8;i++)printf("%s\n",buf[i]); rotate(buf); puts("180"); for(i=0;i<8;i++)printf("%s\n",buf[i]); rotate(buf); puts("270"); for(i=0;i<8;i++)printf("%s\n",buf[i]); return 0; }
main.c:2:2: error: invalid preprocessing directive #incldue; did you mean #include? 2 | #incldue <string.h> | ^~~~~~~ | include main.c: In function 'rotate': main.c:12:9: error: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration] 12 | memcpy(pat,buf,sizeof(pat)); | ^~~~~~ main.c:2:1: note: include '<string.h>' or provide a declaration of 'memcpy' 1 | #include <stdio.h> +++ |+#include <string.h> 2 | #incldue <string.h> main.c:12:9: warning: incompatible implicit declaration of built-in function 'memcpy' [-Wbuiltin-declaration-mismatch] 12 | memcpy(pat,buf,sizeof(pat)); | ^~~~~~ main.c:12:9: note: include '<string.h>' or provide a declaration of 'memcpy' main.c:12:30: warning: 'sizeof' on array function parameter 'pat' will return size of 'char (*)[9]' [-Wsizeof-array-argument] 12 | memcpy(pat,buf,sizeof(pat)); | ^ main.c:4:17: note: declared here 4 | int rotate(char pat[8][9]) { | ~~~~~^~~~~~~~~
s119920888
p00133
C
#include <stdio.h> #include <conio.h> #define N 8 int main(void) { int i,j,k; char sq[N][N]; char change[N][N]; for(i=0; i<N; i++) for(j=0; j<N; j++) sq[i][j]=getche(); for(k=1; k<=3; k++){ printf("%d\n",90*k); for(i=0; i<N; i++) for(j=0; j<N; j++) change[i][j]=sq[i][j]; for(i=0; i<N; i++){ for(j=0; j<N; j++){ sq[i][j]=change[N-1-j][i]; printf("%c",sq[i][j]); } puts(""); } } return 0; }
main.c:2:10: fatal error: conio.h: No such file or directory 2 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s317113959
p00133
C++
テ」ツ??include <vector> #include <iostream> #include <utility> #include <algorithm> #include <string> #include <deque> #include <queue> #include <tuple> #include <queue> #include <functional> #include <cmath> #include <iomanip> #include <map> #include <set> #include <numeric> #include <unordered_map> #include <unordered_set> #include <complex> #include <iterator> #include <array> #include <memory> #include <stack> #define vi vector<int> #define vvi vector<vector<int> > #define ll long long int #define vl vector<ll> #define vvl vector<vector<ll>> #define vb vector<bool> #define vc vector<char> #define vs vector<string> #define ld long double #define INF 1e9 #define EPS 0.0000000001 #define rep(i,n) for(int i=0;i<n;i++) #define loop(i,s,n) for(int i=s;i<n;i++) #define all(in) in.begin(), in.end() template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; } template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; } #define MAX 9999999 using namespace std; typedef pair<int, int> pii; typedef pair<double,double>pdd; typedef pair<ll,ll>pll; int main(){ vector<string>v(8); rep(i,8)cin>>v[i]; cout<<90<<endl; rep(j,8){rep(i,8)cout<<v[7-i][j]; cout<<endl;} cout<<180<<endl; rep(i,8){rep(j,8)cout<<v[7-i][7-j]; cout<<endl;} cout<<270<<endl; rep(j,8){rep(i,8)cout<<v[i][7-j]; cout<<endl;} }
a.cc:1:1: error: extended character 」 is not valid in an identifier 1 | テ」ツ??include <vector> | ^ a.cc:1:1: error: '\U000030c6\U0000300d\U000030c4' does not name a type 1 | テ」ツ??include <vector> | ^~~~~~ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared 140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared 142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:145:52: error: expected primary-expression before 'const' 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:147:54: error: expected primary-expression before 'const' 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive] 155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:156:70: error: expected primary-expression before 'const' 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive] 163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:164:72: error: expected primary-expression before 'const' 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared 171 | void operator delete(void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared 173 | void operator delete[](void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function 179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT |
s420213830
p00133
C++
#include <iostream> #include <map> #include <cstdio> using namespace std; char MAP[8][9];//ƒ}ƒbƒvî•ñ void rotate(){//ƒ}ƒbƒv‚ð90“x‰ñ“] char bM[8][9]; memcpy(bM,MAP,72); for(int i = 0 ; i < 8 ; i++){ for(int j = 0 ; j < 8 ; j++){ MAP[i][j] = bM[7-j][i]; } } } void showmap() {//ƒ}ƒbƒv‚ðo—Í for(int i = 0 ; i < 8 ; i++){ printf("%s\n",MAP[i]); } } int main(){ for(int i = 0 ; i < 8 ; i++){ scanf("%s",MAP[i]); } for(int i = 1 ; i <= 3 ; i++) { printf("%d\n", 90*i); rotate(); showmap(); } return 0; }
a.cc: In function 'void rotate()': a.cc:10:3: error: 'memcpy' was not declared in this scope 10 | memcpy(bM,MAP,72); | ^~~~~~ a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <cstdio> +++ |+#include <cstring> 4 | using namespace std;
s690772448
p00133
C++
#include <iostream> using namespace std; int main(){ string mat[8][8]; for(int i = 0 ; i < 8 ; i++) for(int j = 0 ; j < 8 ; j++) cin >> mat[i][j]; cout << "90" << endl; for(int i = 0 ; i < 8 ; i++) for(int j = 0 ; j < 8 ; j++) cout << mat[8-i-1][j]; cout << "180" << endl; for(int i = 0 ; i < 8 ; i++) for(int j = 0 ; j < 8 ; j++) cout << mat[8-i-1][8-j-1]; cout << "270" << endl; for(int i = 0 ; i < 8 ; i++) for(int j = 0 ; j < 8 ; j++) cout << mat[i][8-j-1]; retunrn 0; }
a.cc: In function 'int main()': a.cc:28:3: error: 'retunrn' was not declared in this scope 28 | retunrn 0; | ^~~~~~~
s623969937
p00134
Java
import java.io.*; import java.util.*; // 2011/10/23 // 0134 oŒû’²¸ public class Main { // ƒƒCƒ“ return false‚Å‚¨‚µ‚Ü‚¢ boolean main() throws IOException { int size = 0; try { size = readIntArray()[0]; } catch(Exception e) { return false; } long sum = 0; for(int i = 0; i < size; i++) { sum += readIntArray()[0]; } System.out.printf("%d\n", sum / size); return false; return true; // ³íI—¹ ŽŸ‚Ö } // private final static boolean DEBUG = true; // debug private final static boolean DEBUG = false; // release public static void main(String[] args) throws IOException { if (DEBUG) { log = System.out; String inputStr = "1:15:"; inputStr = inputStr.replace(":", "\n"); reader = new BufferedReader(new StringReader(inputStr)); } else { log = new PrintStream(new OutputStream() { public void write(int b) {} } ); // ‘‚«ŽÌ‚Ä reader = new BufferedReader(new InputStreamReader(System.in)); // ƒRƒ“ƒ\[ƒ‹‚©‚ç } int N = Integer.MAX_VALUE; //int N = readIntArray()[0]; for(int i = 0; i < N; i++) { boolean b = new Main().main(); if (!b) break; } reader.close(); } static PrintStream log; static BufferedReader reader; // •W€“ü—Í‚æ‚è1s•ª‚Ì‹æØ‚è•¶Žš‹æØ‚è‚ł̐®”’l‚ð“Ç‚Þ // EOF‚̏ꍇ‚Ínull‚ð•Ô‚· private static int[] readIntArray() throws IOException { String s = null; for(;;) { s = reader.readLine(); // log.printf("%s\n", s); if (s == null) return null; s = s.trim(); if (s.length() != 0) // ¦¦¦@‚Ç‚¤‚à“Ë‘R‹ós‚ð“ǂނ±‚Æ‚ª‚ ‚éB“ǂݔò‚΂·‚Æ‚¤‚Ü‚­‚¢‚­‚炵‚¢BBBB break; } String[] sp = s.split("[ ,]"); // ‹æØ‚è•¶Žš‚̓Xƒy[ƒX‚©ƒJƒ“ƒ} int[] a = new int[sp.length]; for(int i = 0; i < sp.length; i++) { a[i] = Integer.parseInt(sp[i]); } return a; } }
Main.java:28: error: unreachable statement return true; // ?????I?? ???? ^ 1 error
s884956599
p00134
Java
public class Main{ public static void main(String a[]) throws java.io.IOException{ Scanner scan = new Scanner(System.in); int n =scan.nextInt(); long sum=0; while(scan.hasNext()){ sum+=scan.nextInt(); } System.out.println(sum/n); } }
Main.java:5: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:5: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s736333878
p00134
Java
import java.util.Scanner; public class AOJ0134 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nexint(); long a = 0; for(int i=0;i<n;i++)a+=sc.nextint(); System.out.println(a/n); } }
Main.java:2: error: class AOJ0134 is public, should be declared in a file named AOJ0134.java public class AOJ0134 { ^ Main.java:6: error: cannot find symbol long n = sc.nexint(); ^ symbol: method nexint() location: variable sc of type Scanner Main.java:8: error: cannot find symbol for(int i=0;i<n;i++)a+=sc.nextint(); ^ symbol: method nextint() location: variable sc of type Scanner 3 errors
s372121861
p00134
Java
import java.util.Scanner; public class AOJ0134 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextint(); long a = 0; for(int i=0;i<n;i++)a+=sc.nextint(); System.out.println(a/n); } }
Main.java:2: error: class AOJ0134 is public, should be declared in a file named AOJ0134.java public class AOJ0134 { ^ Main.java:6: error: cannot find symbol long n = sc.nex?int(); ^ symbol: method nex?int() location: variable sc of type Scanner Main.java:8: error: cannot find symbol for(int i=0;i<n;i++)a+=sc.nextint(); ^ symbol: method nextint() location: variable sc of type Scanner 3 errors
s900386648
p00134
Java
import java.util.Scanner; public class AOJ0134 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextdouble(); long a = 0; for(int i=0;i<n;i++)a+=sc.nextdouble(); System.out.println(a/n); } }
Main.java:2: error: class AOJ0134 is public, should be declared in a file named AOJ0134.java public class AOJ0134 { ^ Main.java:6: error: cannot find symbol long n = sc.nex?double(); ^ symbol: method nex?double() location: variable sc of type Scanner Main.java:8: error: cannot find symbol for(int i=0;i<n;i++)a+=sc.nextdouble(); ^ symbol: method nextdouble() location: variable sc of type Scanner 3 errors
s258454045
p00134
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextlong(); long a = 0; for(int i=0) { for(i<n;i++) { a+=sc.nextlong(); System.out.println(a/n); } } } }
Main.java:8: error: ';' expected for(int i=0) { ^ Main.java:9: error: > or ',' expected for(i<n;i++) { ^ Main.java:9: error: not a statement for(i<n;i++) { ^ Main.java:9: error: ';' expected for(i<n;i++) { ^ 4 errors
s870957520
p00134
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextlong(); long a = 0; for(int i=0;i<n;i++) { a+=sc.nextlong(); System.out.println(a/n); } } } }
Main.java:14: error: class, interface, enum, or record expected } ^ 1 error
s183025204
p00134
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextlong(); long a = 0; for(int i=0;i<n;i++) { a+=sc.nextlong(); System.out.println(a/n); } } }
Main.java:6: error: cannot find symbol long n = sc.nextlong(); ^ symbol: method nextlong() location: variable sc of type Scanner Main.java:9: error: cannot find symbol a+=sc.nextlong(); ^ symbol: method nextlong() location: variable sc of type Scanner 2 errors
s802889022
p00134
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextlong(); long a = 0; for(int i=0;i<n;i++)a+=sc.nextlong(); System.out.println(a/n); } }
Main.java:6: error: cannot find symbol long n = sc.nextlong(); ^ symbol: method nextlong() location: variable sc of type Scanner Main.java:8: error: cannot find symbol for(int i=0;i<n;i++)a+=sc.nextlong(); ^ symbol: method nextlong() location: variable sc of type Scanner 2 errors
s571434225
p00134
C
double s;d;main(n){for(;~scanf("%d",&d);n--)s-=d;exit(!printf("%d\n",d=s/n-1));
main.c:1:10: warning: data definition has no type or storage class 1 | double s;d;main(n){for(;~scanf("%d",&d);n--)s-=d;exit(!printf("%d\n",d=s/n-1)); | ^ main.c:1:10: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] main.c:1:12: error: return type defaults to 'int' [-Wimplicit-int] 1 | double s;d;main(n){for(;~scanf("%d",&d);n--)s-=d;exit(!printf("%d\n",d=s/n-1)); | ^~~~ main.c: In function 'main': main.c:1:12: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:26: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | double s;d;main(n){for(;~scanf("%d",&d);n--)s-=d;exit(!printf("%d\n",d=s/n-1)); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | double s;d;main(n){for(;~scanf("%d",&d);n--)s-=d;exit(!printf("%d\n",d=s/n-1)); main.c:1:26: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | double s;d;main(n){for(;~scanf("%d",&d);n--)s-=d;exit(!printf("%d\n",d=s/n-1)); | ^~~~~ main.c:1:26: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:50: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 1 | double s;d;main(n){for(;~scanf("%d",&d);n--)s-=d;exit(!printf("%d\n",d=s/n-1)); | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | double s;d;main(n){for(;~scanf("%d",&d);n--)s-=d;exit(!printf("%d\n",d=s/n-1)); main.c:1:50: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 1 | double s;d;main(n){for(;~scanf("%d",&d);n--)s-=d;exit(!printf("%d\n",d=s/n-1)); | ^~~~ main.c:1:50: note: include '<stdlib.h>' or provide a declaration of 'exit' main.c:1:56: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | double s;d;main(n){for(;~scanf("%d",&d);n--)s-=d;exit(!printf("%d\n",d=s/n-1)); | ^~~~~~ main.c:1:56: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:56: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:56: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:1: error: expected declaration or statement at end of input 1 | double s;d;main(n){for(;~scanf("%d",&d);n--)s-=d;exit(!printf("%d\n",d=s/n-1)); | ^~~~~~
s124952506
p00134
C
sadsa
main.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input 1 | sadsa | ^~~~~
s159960852
p00134
C
#include <stdio.h> int main(void) { int num; int nownum; int i; int sum; scanf("%d",&num); sum=0; for(i=0;i<num;i++) { scanf("%d",&nownum); sum+=nownum: } printf("%d\n",sum/num); return 0; }
main.c: In function 'main': main.c:12:28: error: expected ';' before ':' token 12 | sum+=nownum: | ^ | ;
s243623356
p00134
C
int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);}
main.c: In function 'main': main.c:1:36: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);} main.c:1:36: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);} | ^~~~~ main.c:1:36: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:87: error: 'std' undeclared (first use in this function) 1 | int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);} | ^~~ main.c:1:87: note: each undeclared identifier is reported only once for each function it appears in main.c:1:90: error: expected ';' before '::' token 1 | int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);} | ^~ | ;
s471516218
p00134
C
int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);}
main.c: In function 'main': main.c:1:36: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);} main.c:1:36: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);} | ^~~~~ main.c:1:36: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:87: error: 'std' undeclared (first use in this function) 1 | int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);} | ^~~ main.c:1:87: note: each undeclared identifier is reported only once for each function it appears in main.c:1:90: error: expected ';' before '::' token 1 | int main(){long long int i,a,n,s=0;scanf("%lld",&n);for(i=n;i--;s+=a)scanf("%lld",&a);std::printf("%d\n",s/n);} | ^~ | ;
s042915755
p00134
C
#include <cstdio> int main() { long long cus; long long spe[1000000]; long long cnt; scanf("%lld",&cus); int sum=0; for(cnt=0;cnt<cus;cnt++) { scanf("%lld",&spe[cnt]); sum=sum+spe[cnt]; } long long ans; ans=sum/cus; printf("%lld\n",ans); return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s793990601
p00134
C++
/* 0134:Exit Survery */ #include <iostream> using namespace std; int main(void) { int w; __int64 ave, sum = 0; cin >> w; for(int i = 0; i < w; i++) { int bu; cin >> bu; sum += bu; } ave = sum / w; cout << ave << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 10 | __int64 ave, sum = 0; | ^~~~~~~ | __int64_t a.cc:17:17: error: 'sum' was not declared in this scope 17 | sum += bu; | ^~~ a.cc:19:9: error: 'ave' was not declared in this scope 19 | ave = sum / w; | ^~~ a.cc:19:15: error: 'sum' was not declared in this scope 19 | ave = sum / w; | ^~~
s877599944
p00134
C++
#include<iostream> #include<algorithm> #include<vector> using namespace std; int main(){ int n long long sum=0; cin>>n; for(int i=0;i<n;i++){ long long int a; cin>>a; sum+=a; } cout<<sum/n<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:5: error: expected initializer before 'long' 7 | long long sum=0; | ^~~~ a.cc:8:10: error: 'n' was not declared in this scope 8 | cin>>n; | ^ a.cc:12:9: error: 'sum' was not declared in this scope 12 | sum+=a; | ^~~ a.cc:14:11: error: 'sum' was not declared in this scope 14 | cout<<sum/n<<endl; | ^~~
s395246126
p00134
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; while(cin>>n&n!=0){ long long sum=0; for(int i=0;i<n;i++){ int a; cin>>a; sum+=a; } sum/=n; cout<<sum<<endl; } }
a.cc: In function 'int main()': a.cc:5:21: error: no match for 'operator&' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'bool') 5 | while(cin>>n&n!=0){ | ~~~~~~^~~~~ | | | | | bool | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:5:21: note: candidate: 'operator&(int, int)' (built-in) 5 | while(cin>>n&n!=0){ | ~~~~~~^~~~~ a.cc:5:21: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bitset:1557:5: note: candidate: 'template<long unsigned int _Nb> std::bitset<_Nb> std::operator&(const bitset<_Nb>&, const bitset<_Nb>&)' 1557 | operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/bitset:1557:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::bitset<_Nb>' 5 | while(cin>>n&n!=0){ | ^ In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const valarray<_Tp>&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::valarray<_Tp>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::valarray<_Tp>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:25: note: mismatched types 'const std::valarray<_Tp>' and 'bool' 5 | while(cin>>n&n!=0){ | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:141:3: note: candidate: 'constexpr std::byte std::operator&(byte, byte)' 141 | operator&(byte __l, byte __r) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:141:18: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::byte' 141 | operator&(byte __l, byte __r) noexcept | ~~~~~^~~ In file included from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/ios_base.h:84:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(_Ios_Fmtflags, _Ios_Fmtflags)' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:84:27: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Fmtflags' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:134:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(_Ios_Openmode, _Ios_Openmode)' 134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:134:27: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Openmode' 134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:181:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator&(_Ios_Iostate, _Ios_Iostate)' 181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:181:26: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Iostate' 181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/bits/shared_ptr_atomic.h:33, from /usr/include/c++/14/memory:81, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/atomic_base.h:109:3: note: candidate: 'con
s634076367
p00134
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; while(cin>>n&n!=0){ long long sum=0; for(int i=0;i<n;i++){ int a; cin>>a; sum+=a; } sum/=n; cout<<sum<<endl; } }
a.cc: In function 'int main()': a.cc:5:21: error: no match for 'operator&' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'bool') 5 | while(cin>>n&n!=0){ | ~~~~~~^~~~~ | | | | | bool | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:5:21: note: candidate: 'operator&(int, int)' (built-in) 5 | while(cin>>n&n!=0){ | ~~~~~~^~~~~ a.cc:5:21: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bitset:1557:5: note: candidate: 'template<long unsigned int _Nb> std::bitset<_Nb> std::operator&(const bitset<_Nb>&, const bitset<_Nb>&)' 1557 | operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/bitset:1557:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::bitset<_Nb>' 5 | while(cin>>n&n!=0){ | ^ In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const valarray<_Tp>&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::valarray<_Tp>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::valarray<_Tp>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:25: note: mismatched types 'const std::valarray<_Tp>' and 'bool' 5 | while(cin>>n&n!=0){ | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:141:3: note: candidate: 'constexpr std::byte std::operator&(byte, byte)' 141 | operator&(byte __l, byte __r) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:141:18: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::byte' 141 | operator&(byte __l, byte __r) noexcept | ~~~~~^~~ In file included from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/ios_base.h:84:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(_Ios_Fmtflags, _Ios_Fmtflags)' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:84:27: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Fmtflags' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:134:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(_Ios_Openmode, _Ios_Openmode)' 134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:134:27: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Openmode' 134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:181:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator&(_Ios_Iostate, _Ios_Iostate)' 181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:181:26: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Iostate' 181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/bits/shared_ptr_atomic.h:33, from /usr/include/c++/14/memory:81, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/atomic_base.h:109:3: note: candidate: 'con
s915883821
p00134
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; while(cin>>n&n!=0){ long long sum=0; for(int i=0;i<n;i++){ int a; cin>>a; sum+=a; } sum/=n; cout<<sum<<endl; } }
a.cc: In function 'int main()': a.cc:5:21: error: no match for 'operator&' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'bool') 5 | while(cin>>n&n!=0){ | ~~~~~~^~~~~ | | | | | bool | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:5:21: note: candidate: 'operator&(int, int)' (built-in) 5 | while(cin>>n&n!=0){ | ~~~~~~^~~~~ a.cc:5:21: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bitset:1557:5: note: candidate: 'template<long unsigned int _Nb> std::bitset<_Nb> std::operator&(const bitset<_Nb>&, const bitset<_Nb>&)' 1557 | operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/bitset:1557:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::bitset<_Nb>' 5 | while(cin>>n&n!=0){ | ^ In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed: a.cc:5:25: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const valarray<_Tp>&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::valarray<_Tp>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::valarray<_Tp>' 5 | while(cin>>n&n!=0){ | ^ /usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed: a.cc:5:25: note: mismatched types 'const std::valarray<_Tp>' and 'bool' 5 | while(cin>>n&n!=0){ | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:141:3: note: candidate: 'constexpr std::byte std::operator&(byte, byte)' 141 | operator&(byte __l, byte __r) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:141:18: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::byte' 141 | operator&(byte __l, byte __r) noexcept | ~~~~~^~~ In file included from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/bits/ios_base.h:84:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(_Ios_Fmtflags, _Ios_Fmtflags)' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:84:27: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Fmtflags' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:134:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(_Ios_Openmode, _Ios_Openmode)' 134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:134:27: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Openmode' 134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:181:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator&(_Ios_Iostate, _Ios_Iostate)' 181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:181:26: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Iostate' 181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/bits/shared_ptr_atomic.h:33, from /usr/include/c++/14/memory:81, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/atomic_base.h:109:3: note: candidate: 'con
s212265875
p00134
C++
#include <stdio.h> #include <iostream> #include <algorithm> #include <map> #include <vector> int main(){ int n; cin>>n; int sum=0; for(int i=0;i<n;i++){ int u=0; cin>>u; sum+=u; } cout<<sum/n<<endl; }
a.cc: In function 'int main()': a.cc:9:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 9 | cin>>n; | ^~~ | std::cin In file included from a.cc:2: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:16:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 16 | cout<<sum/n<<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:16:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 16 | cout<<sum/n<<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s948796049
p00134
C++
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int r=0,n,t;for(t=n=s.nextInt();t-->0;)r+=s.nextInt();System.out.println(r/n);}}
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int r=0,n,t;for(t=n=s.nextInt();t-->0;)r+=s.nextInt();System.out.println(r/n);}} | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:1:37: error: expected ':' before 'static' 1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int r=0,n,t;for(t=n=s.nextInt();t-->0;)r+=s.nextInt();System.out.println(r/n);}} | ^~~~~~~ | : a.cc:1:55: error: 'String' has not been declared 1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int r=0,n,t;for(t=n=s.nextInt();t-->0;)r+=s.nextInt();System.out.println(r/n);}} | ^~~~~~ a.cc:1:63: error: expected ',' or '...' before 'z' 1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int r=0,n,t;for(t=n=s.nextInt();t-->0;)r+=s.nextInt();System.out.println(r/n);}} | ^ a.cc:1:179: error: expected ';' after class definition 1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int r=0,n,t;for(t=n=s.nextInt();t-->0;)r+=s.nextInt();System.out.println(r/n);}} | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:1:66: error: 'Scanner' was not declared in this scope 1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int r=0,n,t;for(t=n=s.nextInt();t-->0;)r+=s.nextInt();System.out.println(r/n);}} | ^~~~~~~ a.cc:1:119: error: 's' was not declared in this scope 1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int r=0,n,t;for(t=n=s.nextInt();t-->0;)r+=s.nextInt();System.out.println(r/n);}} | ^ a.cc:1:153: error: 'System' was not declared in this scope 1 | import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);int r=0,n,t;for(t=n=s.nextInt();t-->0;)r+=s.nextInt();System.out.println(r/n);}} | ^~~~~~
s753644997
p00134
C++
#include<iostream> using namespace std; main(){ long long n,m,a=0,i=0; for(cin>>n;i<n;i++)cin>>m,a+=m; cout<<a/<<endl; }
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:6:17: error: expected primary-expression before '<<' token 6 | cout<<a/<<endl; | ^~