submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s094492813
p00205
C++
#include<stdio.h> int main(void) { int t[5]={0},t2=0,t3=0,t1=0,k,i; while(scanf("%d",&k)!=0){ t2=0; t3=0; t1=0; for(i=0;i<5;i++){ scnaf("%d",&t[i]); if(t[i]==1) t1++; else if(t[i]==2) t2++; else if(t[i]==3) t3++; } if(t1==0){ if(t2==0 or t3==0) for(i=0;i<5;i++) t[i]=3; else for(i=0;i<5;i++){ if(t[i]==2) t[i]=1; else if(t[i]==3) t[i]=2; } } else if(t2==0){ if(t1==0 or t3==0) for(i=0;i<5;i++) t[i]=3; else for(i=0;i<5;i++){ if(t[i]==1) t[i]=2; else if(t[i]==3) t[i]=1; } } else if(t3==0){ if(t2==0 or t1==0) for(i=0;i<5;i++) t[i]=3; else for(i=0;i<5;i++){ if(t[i]==2) t[i]=2; else if(t[i]==1) t[i]=1; } } else for(i=0;i<5;i++) t[i]=3; } for(i=0;i<5;i++) printf("%d\n",t[i]); return 0 }
a.cc: In function 'int main()': a.cc:12:1: error: 'scnaf' was not declared in this scope; did you mean 'scanf'? 12 | scnaf("%d",&t[i]); | ^~~~~ | scanf a.cc:51:9: error: expected ';' before '}' token 51 | return 0 | ^ | ; 52 | } | ~
s437982353
p00205
C++
#include<stdio.h> int main(void) { int t[5]={0},t2=0,t3=0,t1=0,k,i; while(scanf("%d",&k)!=0){ t2=0; t3=0; t1=0; for(i=0;i<5;i++){ scnaf("%d",&t[i]); if(t[i]==1) t1++; else if(t[i]==2) t2++; else if(t[i]==3) t3++; } if(t1==0){ if((t2==0) or (t3==0)) for(i=0;i<5;i++) t[i]=3; else for(i=0;i<5;i++){ if(t[i]==2) t[i]=1; else if(t[i]==3) t[i]=2; } } else if(t2==0){ if((t1==0) or (t3==0)) for(i=0;i<5;i++) t[i]=3; else for(i=0;i<5;i++){ if(t[i]==1) t[i]=2; else if(t[i]==3) t[i]=1; } } else if(t3==0){ if((t2==0) or (t1==0)) for(i=0;i<5;i++) t[i]=3; else for(i=0;i<5;i++){ if(t[i]==2) t[i]=2; else if(t[i]==1) t[i]=1; } } else for(i=0;i<5;i++) t[i]=3; } for(i=0;i<5;i++) printf("%d\n",t[i]); return 0 }
a.cc: In function 'int main()': a.cc:12:1: error: 'scnaf' was not declared in this scope; did you mean 'scanf'? 12 | scnaf("%d",&t[i]); | ^~~~~ | scanf a.cc:51:9: error: expected ';' before '}' token 51 | return 0 | ^ | ; 52 | } | ~
s056417649
p00205
C++
#include<stdio.h> int main(void) { int t[5]={0},t2=0,t3=0,t1=0,k,i; while(scanf("%d",&k)!=0){ t2=0; t3=0; t1=0; for(i=0;i<5;i++){ scnaf("%d",&t[i]); if(t[i]==1) t1++; else if(t[i]==2) t2++; else if(t[i]==3) t3++; } if(t1==0){ if((t2==0) || (t3==0)) for(i=0;i<5;i++) t[i]=3; else for(i=0;i<5;i++){ if(t[i]==2) t[i]=1; else if(t[i]==3) t[i]=2; } } else if(t2==0){ if((t1==0) || (t3==0)) for(i=0;i<5;i++) t[i]=3; else for(i=0;i<5;i++){ if(t[i]==1) t[i]=2; else if(t[i]==3) t[i]=1; } } else if(t3==0){ if((t2==0) || (t1==0)) for(i=0;i<5;i++) t[i]=3; else for(i=0;i<5;i++){ if(t[i]==2) t[i]=2; else if(t[i]==1) t[i]=1; } } else for(i=0;i<5;i++) t[i]=3; } for(i=0;i<5;i++) printf("%d\n",t[i]); return 0 }
a.cc: In function 'int main()': a.cc:12:1: error: 'scnaf' was not declared in this scope; did you mean 'scanf'? 12 | scnaf("%d",&t[i]); | ^~~~~ | scanf a.cc:51:9: error: expected ';' before '}' token 51 | return 0 | ^ | ; 52 | } | ~
s249370309
p00205
C++
#include <iostream> using namespace std; bool is_draw(int* first, int* last) { bool used[3] = {false, false, false}; for (int* p = first; p != last; p++) { used[*p - 1] = true; } return all_of(used, used + 3, [used](bool x) {return x;}); } int get_win(int* first, int* last) { int mi = 5, ma = 0; for (int*p = first; p != last; p++) { mi = min(mi, *p); ma = max(ma, *p); } if (ma - mi == 1) return mi; return ma; } int main() { int hands[5]; while (cin >> hands[0], hands[0]) { for (int i = 1; i < 5; i++) { cin >> hands[i]; } if (is_draw(hands, hands + 5)) { for (int i = 0; i < 5; i++) { cout << 3 << endl; } } else { int win = get_win(hands, hands + 5); for (int i = 0; i < 5; i++) { if (hands[i] == win) { cout << 1 << endl; } else { cout << 2 << endl; } } } } return 0; }
a.cc: In function 'bool is_draw(int*, int*)': a.cc:9:12: error: 'all_of' was not declared in this scope 9 | return all_of(used, used + 3, [used](bool x) {return x;}); | ^~~~~~
s472590749
p00206
Java
import java.util.ArrayList; import java.util.Scanner; public class NextTrip { public static void main(String[] args) { Scanner scan = new Scanner(System.in); ArrayList<String> arr = new ArrayList<>(); while (true) { int border = Integer.parseInt(scan.next()); if (border == 0) { break; } String ret; int sum = 0; for (int i = 0; i < 12; i++) { int m = Integer.parseInt(scan.next()); int n = Integer.parseInt(scan.next()); int sub = m - n; sum += sub; if (sum >= border) { ret = String.valueOf(i + 1); break; } } ret = "NA"; arr.add(ret); } arr.stream().forEach(System.out::println); } }
Main.java:4: error: class NextTrip is public, should be declared in a file named NextTrip.java public class NextTrip { ^ 1 error
s761646526
p00206
Java
import java.util.Scanner; class Main { public static void main(String[] args){ //declare ArrayList<String> answer = new ArrayList<>(); ArrayList<Integer> month = new ArrayList<>(); Scanner in = new Scanner(System.in); int L,M,N,total; //inmput while(true){ total=0; L = Integer.parseInt(in.next()); if(L==0){break;} //calculate for(int i=1;i<=12;i++){ M = Integer.parseInt(in.next()); N = Integer.parseInt(in.next()); total += M - N; if(L-total<=0){month.add(i);} } if(L-total<=0){answer.add(String.valueOf(month.get(0)));} else{answer.add("NA");} } //output for(String s:answer){ if (s=="NA"){System.out.println("NA");} else{System.out.println(Integer.parseInt(s));} } } }
Main.java:6: error: cannot find symbol ArrayList<String> answer = new ArrayList<>(); ^ symbol: class ArrayList location: class Main Main.java:6: error: cannot find symbol ArrayList<String> answer = new ArrayList<>(); ^ symbol: class ArrayList location: class Main Main.java:7: error: cannot find symbol ArrayList<Integer> month = new ArrayList<>(); ^ symbol: class ArrayList location: class Main Main.java:7: error: cannot find symbol ArrayList<Integer> month = new ArrayList<>(); ^ symbol: class ArrayList location: class Main 4 errors
s598994318
p00206
Java
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ int tripCost = stdIn.nextInt(); if(tripCost == 0)break; for(int i=1;i<=12;i++){ if(i==12){ System.out.println("NA"); break; } savingMoney += stdIn.nextInt() - stdIn.nextInt(); if(savingMoney >= tripCost){ System.out.println(i); break; } } } } }
Main.java:14: error: cannot find symbol savingMoney += stdIn.nextInt() - stdIn.nextInt(); ^ symbol: variable savingMoney location: class Main Main.java:15: error: cannot find symbol if(savingMoney >= tripCost){ ^ symbol: variable savingMoney location: class Main 2 errors
s079966513
p00206
Java
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ int tripCost = stdIn.nextInt(); if(tripCost == 0)break; for(int i=1;i<=12;i++){ if(i==12){ System.out.println("NA"); break; } savingMoney += (stdIn.nextInt() - stdIn.nextInt()); if(savingMoney >= tripCost){ System.out.println(i); break; } } } } }
Main.java:14: error: cannot find symbol savingMoney += (stdIn.nextInt() - stdIn.nextInt()); ^ symbol: variable savingMoney location: class Main Main.java:15: error: cannot find symbol if(savingMoney >= tripCost){ ^ symbol: variable savingMoney location: class Main 2 errors
s400345653
p00206
Java
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ int tripCost = stdIn.nextInt(); if(tripCost == 0)break; for(int i=1;i<=12;i++){ if(i==12){ System.out.println("NA"); break; } savingMoney = savingMoney + stdIn.nextInt() - stdIn.nextInt(); if(savingMoney >= tripCost){ System.out.println(i); break; } } } } }
Main.java:14: error: cannot find symbol savingMoney = savingMoney + stdIn.nextInt() - stdIn.nextInt(); ^ symbol: variable savingMoney location: class Main Main.java:14: error: cannot find symbol savingMoney = savingMoney + stdIn.nextInt() - stdIn.nextInt(); ^ symbol: variable savingMoney location: class Main Main.java:15: error: cannot find symbol if(savingMoney >= tripCost){ ^ symbol: variable savingMoney location: class Main 3 errors
s319824162
p00206
Java
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ int tripCost = stdIn.nextInt(); if(tripCost == 0)break; for(int i=1;i<=12;i++){ if(i==12){ System.out.println("NA"); break; } int income = stdIn.nextInt(); int payOut = stdIn.nextInt(); savingMoney = savingMoney + income - payOut; if(savingMoney >= tripCost){ System.out.println(i); break; } } } } }
Main.java:16: error: cannot find symbol savingMoney = savingMoney + income - payOut; ^ symbol: variable savingMoney location: class Main Main.java:16: error: cannot find symbol savingMoney = savingMoney + income - payOut; ^ symbol: variable savingMoney location: class Main Main.java:17: error: cannot find symbol if(savingMoney >= tripCost){ ^ symbol: variable savingMoney location: class Main 3 errors
s812425371
p00206
Java
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ int tripCost = stdIn.nextInt(); if(tripCost == 0)break; int i = 1; while(true){ else{ int income = stdIn.nextInt(); int payOut = stdIn.nextInt(); int savingMoney = savingMoney + income - payOut; if(savingMoney >= tripCost){ System.out.println(i); break; } }if(i==13){ System.out.println("NA"); break; } i++; } } } }
Main.java:12: error: 'else' without 'if' else{ ^ 1 error
s186746060
p00206
Java
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); while(true){ int tripCost = stdIn.nextInt(); if(tripCost == 0)break; int i = 1; while(true){ int income = stdIn.nextInt(); int payOut = stdIn.nextInt(); int savingMoney = savingMoney + income - payOut; if(savingMoney >= tripCost){ System.out.println(i); break; } i++; if(i==13){ System.out.println("NA"); break; } } } } }
Main.java:14: error: variable savingMoney might not have been initialized int savingMoney = savingMoney + income - payOut; ^ 1 error
s647142628
p00206
C
#include<stdio.h> int main(void) { int a[11], b, c, d, e, g = 0; scanf_s("%d", &c); for (b = 0; b < 12; b++) { scanf("%d %d", &d, &e); a[b] = d - e; g = g + a[b]; if (g >= c) { printf("%d\n", b); break; } else if (b == 11) { printf("NA\n"); } } return 0; }
main.c: In function 'main': main.c:6:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 6 | scanf_s("%d", &c); | ^~~~~~~ | scanf
s032878339
p00206
C
#include<stdio.h> int main(void) { int a[12], b, c, d, e, f; while (1) { scanf_s("%d", &b); c = 0; if (b == 0) break; for (d = 0;d < 12;d++) { scanf_s("%d %d", &e, &f); c += e - f; a[d] = c; } for (d = 0;d < 12;d++){ if (a[d] >= b) { printf("%d\n", d + 1); break; } } if (c < b)printf("NA\n"); } return; }
main.c: In function 'main': main.c:7:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 7 | scanf_s("%d", &b); | ^~~~~~~ | scanf main.c:25:1: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch] 25 | return; | ^~~~~~ main.c:3:5: note: declared here 3 | int main(void) | ^~~~
s405172876
p00206
C
#include<stdio.h> int main(void) { int M, N, L, s=0,i,num[12],z; while (1) { scanf_s("%d",&L); s = 0; if (L == 0)break; for (i = 0; i < 12; i++) { scanf_s("%d %d", &M, &N); s += M - N; num[i] = s; } for (i = 0; i < 12; i++) { if (num[i] >= L) { printf("%d\n", i + 1); break; } } if (s < L)printf("NA\n"); } return 0; }
main.c: In function 'main': main.c:5:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 5 | scanf_s("%d",&L); | ^~~~~~~ | scanf
s406184140
p00206
C
include <stdio.h> int main(void){ int L,M1,M2,sum,i,month; while(1){ sum=0; scanf("%d",&L); if(L==0) break; for(i=0;i<12;i++){ scanf("%d %d",&M1,&M2); sum+=M1-M2; if(sum>=L){ printf("%d",i); break; } } if(sum<L) puts("NA"); } return 0; }
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include <stdio.h> | ^
s649355757
p00206
C
#include <stdio.h> int main(void){ int L,M1,M2,sum,i,month; while(1){ sum=0; month=0; scanf("%d",&L); if(L==0) break; for(i=0;i<12;i++){ scanf("%d %d",&M1,&M2); sum+=M1-M2; if(sum>=L&&month==0){ printf("%d",i); } } if(sum<L) puts("NA"); } return 0; } ~
main.c:24:1: error: expected identifier or '(' before '~' token 24 | ~ | ^
s902521952
p00206
C
#include <stdio.h> int main(void){ int m, n, l; int sum = 0; i = 1; while(1){ scanf("%d", &l); if(l == 0) break; scanf("%d %d", &m, &n); sum += m - n; if(i == 12){ if(sum < l) printf("NA"); i = 1; sum = 0; } } printf("%d\n", i); return 0; }
main.c: In function 'main': main.c:7:5: error: 'i' undeclared (first use in this function) 7 | i = 1; | ^ main.c:7:5: note: each undeclared identifier is reported only once for each function it appears in
s051700446
p00206
C
#include <stdio.h> int main(void){ int L,M1,M2,sum,i,month; while(1){ sum=0; month=0; scanf("%d",&L); if(L==0) break; for(i=0;i<12;i++){ scanf("%d %d",&M1,&M2); sum+=M1-M2; if(sum>=L&&month==0){ month=i+1; } } if(month>0&&month<=12) printf("%d\n",month); else puts("NA"); } return 0; } ~
main.c:26:1: error: expected identifier or '(' before '~' token 26 | ~ | ^
s515052561
p00206
C
#include <stdio.h> int main(void){ int L,M1,M2,sum,i,month; while(1){ sum=0; month=0; scanf("%d",&L); if(L==0) break; for(i=0;i<12;i++){ scanf("%d %d",&M1,&M2); sum+=M1-M2; if(sum>=L&&month==0){ month=i+1; } } if(month>0&&month<=12) printf("%d\n",month); else puts("NA"); } return 0; } ~
main.c:26:1: error: expected identifier or '(' before '~' token 26 | ~ | ^
s540874256
p00206
C
main(l,m,n,a,i{for(;a=12,scanf("%d",&l),l;printf((a>11)?"NA\n":"%d\n",a+1))for(i=0;i<12;++i)if(scanf("%d%d",&m,&n),(l-=m-n)<1)a=(a<i)?a:i;}
main.c:1:15: error: expected ')' before '{' token 1 | main(l,m,n,a,i{for(;a=12,scanf("%d",&l),l;printf((a>11)?"NA\n":"%d\n",a+1))for(i=0;i<12;++i)if(scanf("%d%d",&m,&n),(l-=m-n)<1)a=(a<i)?a:i;} | ^ | )
s766925711
p00206
C++
#include<iostream> using namespace std; int main(){ int L; cin >> L; int t; t = 0; for(i=0;i<12;++i){ int Plus; int Minus; cin >> Plus >> Minus; t += Plus - Minus if (t>=L){ cout << i+1 << endl; break; } } if (t<L){ cout << "NA" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'i' was not declared in this scope 8 | for(i=0;i<12;++i){ | ^ a.cc:12:26: error: expected ';' before 'if' 12 | t += Plus - Minus | ^ | ; 13 | if (t>=L){ | ~~
s027710312
p00206
C++
#include<iostream> using namespace std; int main(){ int L; cin >> L; int t; t = 0; for(int i=0;i<12;++i){ int Plus; int Minus; cin >> Plus >> Minus; t += Plus - Minus if (t>=L){ cout << i+1 << endl; break; } } if (t<L){ cout << "NA" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:26: error: expected ';' before 'if' 12 | t += Plus - Minus | ^ | ; 13 | if (t>=L){ | ~~
s356775667
p00206
C++
int main(){ int L; cin >> L; int t; t = 0; for(int i=0;i<12;++i){ int Plus; int Minus; cin >> Plus >> Minus; t += Plus - Minus if (t>=L){ cout << i+1 << endl; break; } }; if (t<L){ cout << "NA" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:3:5: error: 'cin' was not declared in this scope 3 | cin >> L; | ^~~ a.cc:10:26: error: expected ';' before 'if' 10 | t += Plus - Minus | ^ | ; 11 | if (t>=L){ | ~~ a.cc:17:9: error: 'cout' was not declared in this scope 17 | cout << "NA" << endl; | ^~~~ a.cc:17:25: error: 'endl' was not declared in this scope 17 | cout << "NA" << endl; | ^~~~
s784841453
p00206
C++
#include<iostream> using namespace std; int main(){ int L; cin >> L; int t; t = 0; for(int i=0;i<12;++i){ int Plus; int Minus; cin >> Plus >> Minus; t += Plus - Minus if (t>=L){ cout << i+1 << endl; break; } } if (t<L){ cout << "NA" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:26: error: expected ';' before 'if' 12 | t += Plus - Minus | ^ | ; 13 | if (t>=L){ | ~~
s411654880
p00206
C++
#include<iostream> using namespace std; int main(){ int L; cin >> L; int t; t = 0; for(int i=0;i<12;++i){ int Plus; int Minus; cin >> Plus >> Minus; t += Plus - Minus if (t>=L){ cout << i+1 << endl; break; } } if (t<L){ cout << "NA" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:26: error: expected ';' before 'if' 12 | t += Plus - Minus | ^ | ; 13 | if (t>=L){ | ~~
s252184642
p00206
C++
#include<iostream> using namespace std; int main(){ int L; cin >> L; int t; t = 0; for(int i=0;i<12;++i){ int Plus; int Minus; cin >> Plus >> Minus; t += Plus - Minus if (t>=L){ cout << i+1 << endl; break; } }; if (t<L){ cout << "NA" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:26: error: expected ';' before 'if' 12 | t += Plus - Minus | ^ | ; 13 | if (t>=L){ | ~~
s440368164
p00206
C++
#include <iostream> using namespace std; int main() { // your code goes here int n,m,s,sum; while(cin >> n && n!=0){ sum=0; int i; for(i=0;i<12;i++){ cin >> m >> s; sum+=m-s; if(sum>=n){ cout << i+1 << endl; break; } } for(i=i+1;i<12;i++){ cin >> m >> s; if(sum<n) cout << "NA" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:2: error: expected '}' at end of input 24 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s051573833
p00206
C++
#include<stdio.h> int main(void) { int w,n,z,x,i,k,c; while(1){ scanf("%d",&n); if(n==0) break; c=0; k=0; for(i=0;i<12;i++){ scanf("%d %d",&z,&x); k+=z-x; if(k>=n){ c++ } } if(k<n){ printf("NA\n"); } else{ printf("%d\n",12-c+1); } } return 0; }
a.cc: In function 'int main()': a.cc:14:36: error: expected ';' before '}' token 14 | c++ | ^ | ; 15 | } | ~
s393327160
p00206
C++
#include <stdio.h> int main(){ int n,l,r,tot; bool f; while(1){ scanf("%d",&n); if(n==0)return 0; tot=0; f=false; for(int i=0;i<12;i++){ scanf("%d%d",&l,&r); tot+=l-r; if(tot>=n&&!f){ f=true; printf("%d\n",i+1); } } if(!F)printf("NA\n"); } }
a.cc: In function 'int main()': a.cc:18:13: error: 'F' was not declared in this scope 18 | if(!F)printf("NA\n"); | ^
s462302416
p00206
C++
#include<iostream> #define N 12 int main () { int L; int sum; int mon; bool skip; while ( true ) { cin >> L; if ( L == 0 ) break; //sum = L; skip = false; for ( int i=0; i<N; i++ ) { cin >> m >> n; L -= m-n; if ( L <= 0 && !skip ) mon = i+1; } if ( skip ) cout << mon; else cout << "NA\n"; } }
a.cc: In function 'int main()': a.cc:12:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 12 | cin >> L; | ^~~ | 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:18:14: error: 'm' was not declared in this scope 18 | cin >> m >> n; | ^ a.cc:18:19: error: 'n' was not declared in this scope 18 | cin >> m >> n; | ^ a.cc:26:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 26 | cout << mon; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:28:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 28 | cout << "NA\n"; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s020900505
p00206
C++
#include<iostream> int main(){ while(1){ int a; std::cin>>a; if(a==0)break; int b,c=0; for(int i=1;i<13;i++){ int n,m; std::cin>>n>>m; b+=n; b-=m; if(b>=a)std::cout<<i<<std::endl,c=1,break; } if(c==0)std::cout<<"NA"<<std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:61: error: expected primary-expression before 'break' 13 | if(b>=a)std::cout<<i<<std::endl,c=1,break; | ^~~~~
s886870679
p00206
C++
#include <iosteam> #include <vector> using namespace std; int main(void) { int cost,saving; vector< vector<int> > money(12,2); while(1){ cin >> cost; if(cost==0) break; saving=0; for(int i=0i<12;i++){ cin >> money[i][0] >> money[i][1]; } for(int i=0;i<12;i++){ saving+=money[i][0]-[i][1]; if(cost<=saving){ cout << i+1 << endl; break; } } if(money<saving) cout << "NA" << endl; money.clear(); } return 0; }
a.cc:1:10: fatal error: iosteam: No such file or directory 1 | #include <iosteam> | ^~~~~~~~~ compilation terminated.
s230108007
p00206
C++
#include <iostream> #include <vector> using namespace std; int main(void) { int cost,saving; vector< vector<int> > money(12,2); while(1){ cin >> cost; if(cost==0) break; saving=0; for(int i=0;i<12;i++){ cin >> money[i][0] >> money[i][1]; } for(int i=0;i<12;i++){ saving+=money[i][0]-money[i][1]; if(cost<=saving){ cout << i+1 << endl; break; } } if(cost<saving) cout << "NA" << endl; money.clear(); } return 0; }
a.cc: In function 'int main()': a.cc:7:41: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int, int)' 7 | vector< vector<int> > money(12,2); | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66, from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _InIter> using std::_RequireInputIter = std::__enable_if_t<((bool)std::is_convertible<typename std::iterator_traits< <template-parameter-1-1> >::iterator_category, std::input_iterator_tag>::value)> [with _InIter = int]': /usr/include/c++/14/bits/stl_vector.h:705:9: required from here 705 | typename = std::_RequireInputIter<_InputIterator>> | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:252:57: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>' 252 | input_iterator_tag>::value>; | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<int> >' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::true_type = std::true_type]' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >&' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'} 569 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::allocator_type&' {aka 'const std::allocator<std::vector<int> >&'} 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
s739179751
p00206
C++
#include <iostream> #include <vector> using namespace std; int main(void) { int cost,saving; vector< vector<int> > money(12,2); while(1){ cin >> cost; if(cost==0) break; saving=0; for(int i=0;i<12;i++){ cin >> money[i][0] >> money[i][1]; } for(int i=0;i<12;i++){ saving+=money[i][0]-money[i][1]; if(cost<=saving){ cout << i+1 << endl; break; } } if(saving<cost) cout << "NA" << endl; money.clear(); } return 0; }
a.cc: In function 'int main()': a.cc:7:41: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int, int)' 7 | vector< vector<int> > money(12,2); | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66, from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _InIter> using std::_RequireInputIter = std::__enable_if_t<((bool)std::is_convertible<typename std::iterator_traits< <template-parameter-1-1> >::iterator_category, std::input_iterator_tag>::value)> [with _InIter = int]': /usr/include/c++/14/bits/stl_vector.h:705:9: required from here 705 | typename = std::_RequireInputIter<_InputIterator>> | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:252:57: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>' 252 | input_iterator_tag>::value>; | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<int> >' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::true_type = std::true_type]' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >&' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'} 569 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::allocator_type&' {aka 'const std::allocator<std::vector<int> >&'} 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
s255387973
p00206
C++
#include <iostream> #include <vector> using namespace std; int main(void) { int cost,saving; vector< vector<int> > money(12,2); while(1){ cin >> cost; if(cost==0) break; saving=0; for(int i=0;i<12;i++){ cin >> money[i][0] >> money[i][1]; } for(int i=0;i<12;i++){ saving+=money[i][0]-money[i][1]; if(cost<=saving){ cout << i+1 << endl; break; } } if(saving<cost) cout << "NA" << endl; money.clear(); } return 0; }
a.cc: In function 'int main()': a.cc:7:41: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int, int)' 7 | vector< vector<int> > money(12,2); | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66, from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _InIter> using std::_RequireInputIter = std::__enable_if_t<((bool)std::is_convertible<typename std::iterator_traits< <template-parameter-1-1> >::iterator_category, std::input_iterator_tag>::value)> [with _InIter = int]': /usr/include/c++/14/bits/stl_vector.h:705:9: required from here 705 | typename = std::_RequireInputIter<_InputIterator>> | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:252:57: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>' 252 | input_iterator_tag>::value>; | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<int> >' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::true_type = std::true_type]' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >&' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'} 569 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::allocator_type&' {aka 'const std::allocator<std::vector<int> >&'} 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
s709213090
p00206
C++
#include <iostream> #include <vector> using namespace std; int main(void) { int cost,saving; vector< vector<int> > money(12,2); while(1){ cin >> cost; if(cost==0) break; saving=0; for(int i=0;i<12;i++){ cin >> money[i][0] >> money[i][1]; } for(int i=0;i<12;i++){ saving+=(money[i][0]-money[i][1]); if(cost<=saving){ cout << i+1 << endl; break; } } if(saving<cost) cout << "NA" << endl; money.clear(); } return 0; }
a.cc: In function 'int main()': a.cc:7:41: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int, int)' 7 | vector< vector<int> > money(12,2); | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66, from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _InIter> using std::_RequireInputIter = std::__enable_if_t<((bool)std::is_convertible<typename std::iterator_traits< <template-parameter-1-1> >::iterator_category, std::input_iterator_tag>::value)> [with _InIter = int]': /usr/include/c++/14/bits/stl_vector.h:705:9: required from here 705 | typename = std::_RequireInputIter<_InputIterator>> | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:252:57: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>' 252 | input_iterator_tag>::value>; | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<int> >' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::true_type = std::true_type]' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >&' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'} 569 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::allocator_type&' {aka 'const std::allocator<std::vector<int> >&'} 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
s977146649
p00206
C++
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <map> #include <algorithm> #include <sstream> #define mp make_pair #define rep(i,n) for(int i = 0 ; i < n ; i++) #define ll long long using namespace std; int main(){ int l; while( cin >> l , l) { int money=0 , i , ans=0; for( i = 0; i<12; i++) { int n , m; cin >> m >> n; money += m-n; if( l < money ) { ans = i+1; l = INT_MAX; } } if( ans ) cout << ans; else cout << "NA"; puts(""); } return 0; }
a.cc: In function 'int main()': a.cc:27:37: error: 'INT_MAX' was not declared in this scope 27 | l = INT_MAX; | ^~~~~~~ a.cc:8:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 7 | #include <sstream> +++ |+#include <climits> 8 |
s695520968
p00206
C++
int main(void){ int L,M,N,k[12],i,kai; while(0==0){ scanf("%d\n",&L); if(L==0) break; kai=0; for(i=1;i<13;i++){ scanf("%d %d\n",&M,&N); k[i]=M-N; } for(i=1;i<1;i++){ L-=k[i]; if(L<=0){ kai=i; break; } } if(kai==0) printf("NA\n"); else printf("%d\n",kai); } return 0; }
a.cc: In function 'int main()': a.cc:5:17: error: 'scanf' was not declared in this scope 5 | scanf("%d\n",&L); | ^~~~~ a.cc:23:28: error: 'printf' was not declared in this scope 23 | if(kai==0) printf("NA\n"); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | int main(void){ a.cc:24:18: error: 'printf' was not declared in this scope 24 | else printf("%d\n",kai); | ^~~~~~ a.cc:24:18: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s122903730
p00207
Java
20 20 1 1 9 9 7 2 0 1 1 5 1 1 3 2 1 3 3 1 1 5 2 5 1 7 3 2 0 2 7 2 0 6 8 20 20 9 9 1 1 6 2 0 1 1 1 0 5 1 2 1 1 3 5 0 1 7 3 1 5 5 4 1 8 5 0 0
Main.java:1: error: class, interface, enum, or record expected 20 20 ^ 1 error
s169174446
p00207
Java
import java.util.*; public class Main { int [][] field; int goalx; int goaly; int moveColor; private boolean move(int x, int y){ if(field[y][x] != moveColor){ return false; } if(x == goalx && y == goaly){ return true; } field[y][x] = -1; if(move(x+1,y) || move(x,y+1) || move(x-1,y) || move(x,y-1)) return true; else return false; } public void doIt(){ Scanner sc = new Scanner(System.in); field = new int[102][102]; while(true){ int w = sc.nextInt(); int h = sc.nextInt(); if(w == 0 && h == 0) break; for(int i=0; i < 102; i++){ for(int j=0;j < 102; j++){ field[i][j] = 0; } } int xs = sc.nextInt(); int ys = sc.nextInt(); goalx = sc.nextInt(); goaly = sc.nextInt(); int n = sc.nextInt(); //read a block int [][] block = new int[n][4]; for(int i=0; i < n; i++){ for(int j=0; j < 4; j++){ block[i][j] = sc.nextInt(); } int x = block[i][2]; int y = block[i][3]; if(block[i][1] == 0){ for(int k=y; k < y+2; k++ ){ for(int j=x; j < x+4; j++){ field[k][j] = block[i][0]; } } } else{ for(int k=y; k < y+4; k++ ){ for(int j=x; j < x+2; j++){ field[k][j] = block[i][0]; } } } } //set flame for(int i=0; i <= w + 1; i++){ field[0][i] = -1; field[h+1][i] = -1; field[i][0] = -1; field[i][w+1] = -1; } //start boolean ans; moveColor = field[ys][xs]; if(moveColor == 0){ ans= false; } else{ ans = move(xs, ys); } //print if(ans) System.out.println("OK"); else System.out.println("NG"); } } public static void main(String[] args) { Main obj = new Main(); obj.doIt(); }
Main.java:100: error: reached end of file while parsing } ^ 1 error
s784499133
p00207
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayDeque; import java.util.StringTokenizer; /** * Block */ public class P0207 { static int[][] board; final static int BLOCK_WIDTH = 4; final static int BLOCK_HEIGHT = 2; final static int EMPTY = 0; static int w, h; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; while (!(line = br.readLine()).equals("0 0")) { w = Integer.parseInt(line.substring(0, line.indexOf(' '))); h = Integer.parseInt(line.substring(line.indexOf(' ') + 1)); board = new int[w + 1][h + 1]; line = br.readLine(); int xs = Integer.parseInt(line.substring(0, line.indexOf(' '))); int ys = Integer.parseInt(line.substring(line.indexOf(' ') + 1)); line = br.readLine(); int xg = Integer.parseInt(line.substring(0, line.indexOf(' '))); int yg = Integer.parseInt(line.substring(line.indexOf(' ') + 1)); int n = Integer.parseInt(br.readLine()); for (int i = 0; i < n; ++i) { putBlock(br.readLine()); } if (solve(xs, ys, xg, yg)) { System.out.println("OK"); } else { System.out.println("NG"); } } } static void putBlock(String info) { StringTokenizer st = new StringTokenizer(info); int c, d, x, y; c = Integer.parseInt(st.nextToken()); d = Integer.parseInt(st.nextToken()); x = Integer.parseInt(st.nextToken()); y = Integer.parseInt(st.nextToken()); putBlock(c, d, x, y); } static void putBlock(int c, int d, int x, int y) { if (d == 0) { for (int i = x; i < x + BLOCK_WIDTH; ++i) { for (int j = y; j < y + BLOCK_HEIGHT; ++j) { // assert board[i][j] == EMPTY; board[i][j] = c; } } } else { for (int i = x; i < x + BLOCK_HEIGHT; ++i) { for (int j = y; j < y + BLOCK_WIDTH; ++j) { // assert board[i][j] == EMPTY; board[i][j] = c; } } } } static boolean solve(int xs, int ys, int xg, int yg) { final int V[] = { 1, -1, 0, 0 }; final int H[] = { 0, 0, 1, -1 }; if (board[xs][ys] != board[xg][yg]) { return false; } int[] next, prev; next = new int[] { xs, ys }; ArrayDeque<int[]> queue = new ArrayDeque<int[]>(); queue.offer(next); while (!queue.isEmpty()) { prev = queue.poll(); int px, py, nx, ny, c; px = prev[0]; py = prev[1]; c = board[px][py]; board[px][py] = EMPTY; if (px == xg && py == yg) { return true; } for (int i = 0; i < 4; ++i) { nx = px + V[i]; ny = py + H[i]; if (nx > 0 && nx < w + 1 && ny > 0 && ny < h + 1) { if (board[nx][ny] == c) { queue.offer(new int[] { nx, ny }); } } } } return false; } }
Main.java:10: error: class P0207 is public, should be declared in a file named P0207.java public class P0207 { ^ 1 error
s470302525
p00207
Java
import java.util.ArrayDeque; import java.util.Queue; import java.util.Scanner; public class Main { public static final int[] blockW = {4,2}; public static final int[] blockH = {2,4}; public static final int INF = 100000000; public static final int[] vx = {1,0,-1,0}; public static final int[] vy = {0,-1,0,1}; public static void main(String args[]) { Scanner sc = new Scanner(System.in); while(true) { int w = sc.nextInt(); int h = sc.nextInt(); if (w+h==0) { break; } Pos2d start = new Pos2d(sc.nextInt()-1,sc.nextInt()-1); Pos2d goal = new Pos2d(sc.nextInt()-1,sc.nextInt()-1); int n = sc.nextInt(); int[][] maze = new int[w][h]; for (int i=0;i<n;i++) { int c = sc.nextInt(); int d = sc.nextInt(); int x = sc.nextInt()-1; int y = sc.nextInt()-1; for (int j=0;j<blockW[d];j++) { for (int k=0;k<blockH[d];k++) { maze[x+j][y+k] = c; } } } boolean ans = false; if (maze[start.x][start.y]!=0) { int mc = maze[start.x][start.y]; boolean[][] reach = new boolean[w][h]; Queue<Pos2d> q = new ArrayDeque<Pos2d>(); q.offer(start); while(!q.isEmpty()) { Pos2d p = q.poll(); for(int i=0;i<4;i++) { int nx = p.x + vx[i]; int ny = p.y + vy[i]; if (nx>= 0 && nx<w && ny>=0 && ny<h) { if (maze[nx][ny]==mc) { if (!reach[nx][ny]) { reach[nx][ny]=true; q.offer(new Pos2d(nx,ny)); } } } } } ans = reach[goal.x][goal.y]; } System.out.println(ans ? "OK" : "NG"); } } }
Main.java:20: error: cannot find symbol Pos2d start = new Pos2d(sc.nextInt()-1,sc.nextInt()-1); ^ symbol: class Pos2d location: class Main Main.java:20: error: cannot find symbol Pos2d start = new Pos2d(sc.nextInt()-1,sc.nextInt()-1); ^ symbol: class Pos2d location: class Main Main.java:21: error: cannot find symbol Pos2d goal = new Pos2d(sc.nextInt()-1,sc.nextInt()-1); ^ symbol: class Pos2d location: class Main Main.java:21: error: cannot find symbol Pos2d goal = new Pos2d(sc.nextInt()-1,sc.nextInt()-1); ^ symbol: class Pos2d location: class Main Main.java:41: error: cannot find symbol Queue<Pos2d> q = new ArrayDeque<Pos2d>(); ^ symbol: class Pos2d location: class Main Main.java:41: error: cannot find symbol Queue<Pos2d> q = new ArrayDeque<Pos2d>(); ^ symbol: class Pos2d location: class Main Main.java:44: error: cannot find symbol Pos2d p = q.poll(); ^ symbol: class Pos2d location: class Main Main.java:52: error: cannot find symbol q.offer(new Pos2d(nx,ny)); ^ symbol: class Pos2d location: class Main 8 errors
s230021623
p00207
Java
import java.lang.annotation.Retention; import java.util.*; import org.omg.CORBA.Principal; public class Main { Scanner in = new Scanner(System.in); public static void main(String[] args) { new Main(); } public Main() { new AOJ0207(); } class AOJ0207{ int w,h; int sx,sy,gx,gy; int[][] map; void makeBoead(int bx,int by,int muki,int color){ if(muki==0){//横 for(int i=0;i<2;i++)for(int s=0;s<4;s++)map[by+i][bx+s]=color; }else if(muki==1){ for(int i=0;i<4;i++)for(int s=0;s<2;s++)map[by+i][bx+s]=color; } } void print(){ for(int i=1;i<=h;i++){ for(int s=0;s<w;s++)System.out.print(map[i][s]); System.out.println(); } } public AOJ0207() { while(true){ w = in.nextInt(); h = in.nextInt(); if(w==0&&h==0)break; map = new int[h+1][w+1]; sx = in.nextInt(); sy = in.nextInt(); gx = in.nextInt(); gy = in.nextInt(); int n = in.nextInt(); for(int i=0;i<n;i++){ int color = in.nextInt(); int muki = in.nextInt(); int bx = in.nextInt(); int by = in.nextInt(); makeBoead(bx, by, muki, color); } // print(); LinkedList<Integer> list = new LinkedList<Integer>(); list.add(sx);list.add(sy); boolean sw = false;//flg int[] gox = {1,0,-1,0}; int[] goy = {0,1,0,-1}; int target_c = map[sy][sx]; while(list.size()>0){ int x = list.remove(); int y = list.remove(); if(x==gx&&y==gy){ sw=true; break; } for(int i=0;i<4;i++){ int nx = x+gox[i]; int ny = y+goy[i]; if(nx<0||nx>w||ny<0||ny>h)continue; if(map[ny][nx]!=target_c)continue; map[ny][nx] = -1; list.add(nx);list.add(ny); } } System.out.println(sw? "OK":"NG"); } } } }
Main.java:4: error: package org.omg.CORBA does not exist import org.omg.CORBA.Principal; ^ 1 error
s023696103
p00207
C
#include <stdio.h> int search(xs, ys, c) { } struct blkinfo_t { int c; int d; int x; int y; }; int **board; int **flag; int xg, yg; void createmaze(int n, struct blkinfo_t *blks) { int i; int curx; int cury; for(i = 0; i < n; i++) { curx = blks[n].x; cury = blks[n].y; if(d == 0) { board[cury][curx] = blks[n].c; board[cury][curx+1] = blks[n].c; board[cury][curx+2] = blks[n].c; board[cury][curx+3] = blks[n].c; board[cury+1][curx] = blks[n].c; board[cury+1][curx+1] = blks[n].c; board[cury+1][curx+2] = blks[n].c; board[cury+1][curx+3] = blks[n].c; } else { board[cury][curx] = blks[n].c; board[cury][curx+1] = blks[n].c; board[cury+1][curx] = blks[n].c; board[cury+1][curx+1] = blks[n].c; board[cury+2][curx] = blks[n].c; board[cury+2][curx+1] = blks[n].c; board[cury+3][curx] = blks[n].c; board[cury+3][curx+1] = blks[n].c; } } return; } int search(x, y, c) { int result[4] = {0, 0, 0, 0}; if(flag[y][x] == 1) return -1; if(board[y][x] != c) return -1; if((x == xg) && (y == yg)) return 1; flag[y][x] = 1; if(x+1 > w) { result[0] = search(x+1, y, c); } if(x-1 < 1) { result[1] = search(x-1, y, c); } if(y+1 > h) { result[2] = search(x, y+1, c); } if(y-1 < 1) { result[3] = search(x, y-1, c); } if((result[0] == 1) || (result[1] == 1) || (result[2] == 1) || (result[3] == 1)) return 1; else return -1; } int main() { int i; int w, h; int xs, ys; int n; struct blkinfo_t *blks; scanf("%d %d", w , h); scanf("%d %d", xs, ys); scanf("%d %d", xg, yg); scanf("%d", n); blks = calloc(n, sizeof(struct blkinfo_t)); for(i = 0; i < n; i++) { scanf("%d %d %d %d", blks[n].c, blks[n].d, blks[n].x, blks[n].y); } board = calloc(w*h, sizeof(int)); flag = calloc(w*h, sizeof(int)); if(search(xs, ys, c) == 1) printf("OK"); else printf("NG"); return 0; }
main.c: In function 'search': main.c:3:5: error: type of 'xs' defaults to 'int' [-Wimplicit-int] 3 | int search(xs, ys, c) { | ^~~~~~ main.c:3:5: error: type of 'ys' defaults to 'int' [-Wimplicit-int] main.c:3:5: error: type of 'c' defaults to 'int' [-Wimplicit-int] main.c: In function 'createmaze': main.c:28:8: error: 'd' undeclared (first use in this function) 28 | if(d == 0) { | ^ main.c:28:8: note: each undeclared identifier is reported only once for each function it appears in main.c: At top level: main.c:53:5: error: redefinition of 'search' 53 | int search(x, y, c) { | ^~~~~~ main.c:3:5: note: previous definition of 'search' with type 'int()' 3 | int search(xs, ys, c) { | ^~~~~~ main.c: In function 'search': main.c:53:5: error: type of 'x' defaults to 'int' [-Wimplicit-int] 53 | int search(x, y, c) { | ^~~~~~ main.c:53:5: error: type of 'y' defaults to 'int' [-Wimplicit-int] main.c:53:5: error: type of 'c' defaults to 'int' [-Wimplicit-int] main.c:65:12: error: 'w' undeclared (first use in this function) 65 | if(x+1 > w) { | ^ main.c:71:12: error: 'h' undeclared (first use in this function) 71 | if(y+1 > h) { | ^ main.c: In function 'main': main.c:102:10: error: implicit declaration of function 'calloc' [-Wimplicit-function-declaration] 102 | blks = calloc(n, sizeof(struct blkinfo_t)); | ^~~~~~ main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'calloc' 1 | #include <stdio.h> +++ |+#include <stdlib.h> 2 | main.c:102:10: warning: incompatible implicit declaration of built-in function 'calloc' [-Wbuiltin-declaration-mismatch] 102 | blks = calloc(n, sizeof(struct blkinfo_t)); | ^~~~~~ main.c:102:10: note: include '<stdlib.h>' or provide a declaration of 'calloc' main.c:111:21: error: 'c' undeclared (first use in this function) 111 | if(search(xs, ys, c) == 1) | ^
s066125720
p00207
C
#include<stdio.h> int flag=0; int mp[102][102]; int sn[102][102]; int bc; int px[4]={0,1,0,-1}; int py[4]={1,0,-1,0}; int slv(int xs,int ys); int w,h,xg,yg; int n,c,d,x,y; int i,j,k; int main(){ int xs,ys; while(1){ cin>>w>>h; if(w==0 && h==0)return(0); cin>>xs>>ys; cin>>xg>>yg; flag=0; cin>>n; memset(mp,0,sizeof(mp)); memset(sn,0,sizeof(sn)); for( i=0;i<n;i++){ cin>>c>>d>>x>>y; if(d==1){ for( j=0;j<4;j++){ for( k=0;k<2;k++)mp[x+k][y+j]=c; } } else{ for( j=0;j<2;j++){ for( k=0;k<4;k++)mp[x+k][y+j]=c; } } } bc=mp[xs][ys]; slv(xs,ys); if(flag)cout<<"OK"<<endl; else cout<<"NG"<<endl; } } int slv(int xs,int ys){ if(xs==xg && ys==yg){ flag=1; return(0); } for(i=0;i<4;i++){ xs+=px[i]; ys+=py[i]; if(bc==mp[xs][ys] && sn[xs][ys]==0){ sn[xs][ys]=1; slv(xs,ys); } xs-=px[i]; ys-=py[i]; } return(0); }
main.c: In function 'main': main.c:20:5: error: 'cin' undeclared (first use in this function) 20 | cin>>w>>h; | ^~~ main.c:20:5: note: each undeclared identifier is reported only once for each function it appears in main.c:26:5: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration] 26 | memset(mp,0,sizeof(mp)); | ^~~~~~ main.c:2:1: note: include '<string.h>' or provide a declaration of 'memset' 1 | #include<stdio.h> +++ |+#include <string.h> 2 | main.c:26:5: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch] 26 | memset(mp,0,sizeof(mp)); | ^~~~~~ main.c:26:5: note: include '<string.h>' or provide a declaration of 'memset' main.c:46:13: error: 'cout' undeclared (first use in this function) 46 | if(flag)cout<<"OK"<<endl; | ^~~~ main.c:46:25: error: 'endl' undeclared (first use in this function) 46 | if(flag)cout<<"OK"<<endl; | ^~~~
s107758454
p00207
C
20 20 1 1 9 9 7 2 0 1 1 5 1 1 3 2 1 3 3 1 1 5 2 5 1 7 3 2 0 2 7 2 0 6 8 20 20 9 9 1 1 6 2 0 1 1 1 0 5 1 2 1 1 3 5 0 1 7 3 1 5 5 4 1 8 5 0 0
main.c:1:1: error: expected identifier or '(' before numeric constant 1 | 20 20 | ^~
s275682885
p00207
C
20 20 1 1 9 9 7 2 0 1 1 5 1 1 3 2 1 3 3 1 1 5 2 5 1 7 3 2 0 2 7 2 0 6 8 20 20 9 9 1 1 6 2 0 1 1 1 0 5 1 2 1 1 3 5 0 1 7 3 1 5 5 4 1 8 5 0 0
main.c:1:1: error: expected identifier or '(' before numeric constant 1 | 20 20 | ^~
s173916540
p00207
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s552822217
p00207
C++
#include<iostream> #include<cstdio> #include<queue> using namespace std; #define size_max 100+10 #define Y first #define X second int mx[4] = { 1,-1,0,0 }; int my[4] = { 0,0,1,-1 }; int map[size_max][size_max]; void paint(int c, int y, int x, int H, int W) { int i, j; for (i = y; i < y + H; i++) { for (j = x; j < x + W; j++) { map[i][j] = c; } } } void chek(int w, int h) { int i, j; for (i = 0; i <= h + 1; i++) { for (j = 0; j <= w + 1; j++) { cout << map[i][j]; } cout << endl; } } typedef pair<int, int> PR; int main(void) { PR now, tmp; queue<PR> QU; int w, h; int xs, ys, xg, yg, n; int c, d, set_x, set_y; int i, j; while ((cin >> w >> h), w != 0 && h != 0) { memset(map, 0, sizeof map); cin >> xs >> ys >> xg >> yg >> n; for (i = 0; i < n; i++) { cin >> c >> d >> set_x >> set_y; if (d == 0) { paint(c, set_y, set_x, 2, 4); } else { paint(c, set_y, set_x, 4, 2); } } //chek(w, h); if (map[ys][xs] == 0) { cout << "NG\n"; continue; } now = make_pair(ys, xs); QU.push(now); bool goal = false; while (!QU.empty()) { now = QU.front(); QU.pop(); if (map[now.Y][now.X] != -1) { map[now.Y][now.X] = -1; if (now.Y == yg && now.X == xg) { goal = true; while (!QU.empty()) { QU.pop(); } break; } for (i = 0; i < 4; i++) { if (map[now.Y + my[i]][now.X + mx[i]] == c) { tmp = make_pair(now.Y + my[i], now.X + mx[i]); QU.push(tmp); } } } } if (goal) { cout << "OK\n"; } else { cout << "NG\n"; } } return 0; }
a.cc: In function 'int main()': a.cc:59:17: error: 'memset' was not declared in this scope 59 | memset(map, 0, sizeof map); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<queue> +++ |+#include <cstring> 4 | using namespace std;
s948501035
p00207
C++
#include<map> #include<queue> #include<cstdio> #include<stdio.h> #include<iostream> #include<algorithm> #define SIZE 102 using namespace std; typedef pair<int,int> P; void input_data(void); //データ入力用関数 void make_mass(void); //マス作成用関数 void solve(void); //処理 void clear(void); //データの初期化 int n; //ブロックの個数 int w,h; //ボードの幅、高さ int goal=0; int sx,sy,gx,gy; //スタートの座標、ゴールの座標 int mass[102][102]; int data[102][102]; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; int c[SIZE],d[SIZE],x[SIZE],y[SIZE]; //ブロックの色、向き、左上の座標 int main(){ int i,j; //カウンタ変数 while(1){ /*情報の入力*/ cin>>w>>h; if(w==h && w==0)break; //ループ終了条件 input_data(); make_mass(); solve(); /*printf("%d\n",goal);*/ if(goal==1){ cout<<"OK"<<endl; } else { cout<<"NG"<<endl; } /* for(i=0;i<h;i++){ for(j=0;j<w;j++){ printf("%2d",data[i][j]); } printf(" "); for(j=0;j<w;j++){ printf("%2d",mass[i][j]); } printf("\n"); } */ clear(); } return 0; } void input_data(void){ cin>>sx>>sy; cin>>gx>>gy; cin>>n; for(int i=0;i<n;i++){ cin>>c[i]>>d[i]>>x[i]>>y[i]; } return; } void make_mass(void){ int i,j; int scolor,fcolor; /*マスの作成*/ for(i=0;i<n;i++){ switch(d[i]){ case 0: //横向きなら for(j=0;j<4;j++){ mass[y[i]][x[i]+j]=c[i]; mass[y[i]+1][x[i]+j]=c[i]; } break; case 1: //縦向きなら for(j=0;j<4;j++){ mass[y[i]+j][x[i]]=c[i]; mass[y[i]+j][x[i]+1]=c[i]; } break; } } scolor=mass[sy][sx]; fcolor=mass[gy][gx]; for(i=0;i<h;i++){ for(j=0;j<w;j++){ if(scolor!=mass[i][j]){ mass[i][j]=0; } } } return; } void solve(void){ int i,j; queue<P> que; memset(data,-1,sizeof(data)); que.push(P(sx,sy)); //queにスタート位置の座標を格納 data[sy][sx]==0; while(!que.empty()){ //queが空でない間 P p=que.front(); que.pop(); if(p.first==gx && p.second==gy){ goal=1; /* cout<<" (^q^)くおえうえーーーるえうおおおwwww"<<endl;*/ break; } for(i=0;i<4;i++){ int nx=p.first+dx[i]; int ny=p.second+dy[i]; if(nx>=0 && nx<w && ny>=0 && ny<h && mass[ny][nx]!=0 && data[ny][nx]==-1){ que.push(P(nx,ny)); data[ny][nx]=data[p.second][p.first]+1; } } } return; } void clear(void){ for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ mass[i][j]==0; } } goal=0; return; } /* 花火は他人に向けちゃダメだよ。 ( ・ω・)o─━・*:・:・(※)`Д´)アヂィ! */
a.cc: In function 'void solve()': a.cc:123:10: error: reference to 'data' is ambiguous 123 | memset(data,-1,sizeof(data)); | ^~~~ In file included from /usr/include/c++/14/map:65, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:22:5: note: 'int data [102][102]' 22 | int data[102][102]; | ^~~~ a.cc:123:25: error: reference to 'data' is ambiguous 123 | memset(data,-1,sizeof(data)); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:22:5: note: 'int data [102][102]' 22 | int data[102][102]; | ^~~~ a.cc:123:3: error: 'memset' was not declared in this scope 123 | memset(data,-1,sizeof(data)); | ^~~~~~ a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 6 | #include<algorithm> +++ |+#include <cstring> 7 | #define SIZE 102 a.cc:125:3: error: reference to 'data' is ambiguous 125 | data[sy][sx]==0; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:22:5: note: 'int data [102][102]' 22 | int data[102][102]; | ^~~~ a.cc:139:63: error: reference to 'data' is ambiguous 139 | if(nx>=0 && nx<w && ny>=0 && ny<h && mass[ny][nx]!=0 && data[ny][nx]==-1){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:22:5: note: 'int data [102][102]' 22 | int data[102][102]; | ^~~~ a.cc:141:9: error: reference to 'data' is ambiguous 141 | data[ny][nx]=data[p.second][p.first]+1; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:22:5: note: 'int data [102][102]' 22 | int data[102][102]; | ^~~~ a.cc:141:22: error: reference to 'data' is ambiguous 141 | data[ny][nx]=data[p.second][p.first]+1; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:22:5: note: 'int data [102][102]' 22 | int data[102][102]; | ^~~~
s329446475
p00207
C++
#include<map> #include<queue> #include<stdio.h> #include<iostream> #include<algorithm> #define SIZE 110 using namespace std; typedef pair<int,int> P; void solve(void); //処理 int n; //ブロックの個数 int w,h; //ボードの幅、高さ int goal; //迷路になっているか int scolor; //スタート位置の色 int sx,sy,gx,gy; //スタートの座標、ゴールの座標 int mass[SIZE][SIZE]; int data[SIZE][SIZE]; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; int c[SIZE],d[SIZE],x[SIZE],y[SIZE]; //ブロックの色、向き、左上の座標 int main(){ int i,j; //カウンタ変数 while(1){ goal=0; /*情報の入力*/ cin>>w>>h; if(w==0 && h==0)break; cin>>sx>>sy; cin>>gx>>gy; cin>>n; for(i=0;i<n;i++){ cin>>c[i]>>d[i]>>x[i]>>y[i]; } memset(mass,0,sizeof(mass)); /*マスの作成*/ for(i=0;i<n;i++){ if(d[i]==0){ //横向きなら for(j=0;j<4;j++){ mass[y[i]][x[i]+j]=c[i]; mass[y[i]+1][x[i]+j]=c[i]; } } else if(d[i]==1){ //縦向きなら for(j=0;j<4;j++){ mass[y[i]+j][x[i]]=c[i]; mass[y[i]+j][x[i]+1]=c[i]; } } } scolor=mass[sy][sx]; if(scolor==mass[gy][gx]){ solve(); if(goal==1){ cout<<"OK"<<endl; } else { cout<<"NG"<<endl; } } else { cout<<"NG"<<endl; } } return 0; } void solve(void){ int i,j; queue<P> que; memset(data,-1,sizeof(data)); que.push(P(sy,sx)); //queにスタート位置の座標を格納 data[sy][sx]=0; while(!que.empty()){ //queが空でない間 P p=que.front(); que.pop(); if(p.first==gy && p.second==gx){ goal=1; break; } for(i=0;i<4;i++){ int ny=p.first+dy[i]; int nx=p.second+dx[i]; if(nx>=0 && nx<w && ny>=0 && ny<h && mass[ny][nx]==scolor && data[ny][nx]==-1){ que.push(P(ny,nx)); data[ny][nx]=1; } } } return; }
a.cc: In function 'int main()': a.cc:47:3: error: 'memset' was not declared in this scope 47 | memset(mass,0,sizeof(mass)); | ^~~~~~ a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include<algorithm> +++ |+#include <cstring> 6 | #define SIZE 110 a.cc: In function 'void solve()': a.cc:89:10: error: reference to 'data' is ambiguous 89 | memset(data,-1,sizeof(data)); | ^~~~ In file included from /usr/include/c++/14/map:65, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:19:5: note: 'int data [110][110]' 19 | int data[SIZE][SIZE]; | ^~~~ a.cc:89:25: error: reference to 'data' is ambiguous 89 | memset(data,-1,sizeof(data)); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:19:5: note: 'int data [110][110]' 19 | int data[SIZE][SIZE]; | ^~~~ a.cc:89:3: error: 'memset' was not declared in this scope 89 | memset(data,-1,sizeof(data)); | ^~~~~~ a.cc:89:3: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:91:3: error: reference to 'data' is ambiguous 91 | data[sy][sx]=0; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:19:5: note: 'int data [110][110]' 19 | int data[SIZE][SIZE]; | ^~~~ a.cc:104:68: error: reference to 'data' is ambiguous 104 | if(nx>=0 && nx<w && ny>=0 && ny<h && mass[ny][nx]==scolor && data[ny][nx]==-1){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:19:5: note: 'int data [110][110]' 19 | int data[SIZE][SIZE]; | ^~~~ a.cc:106:9: error: reference to 'data' is ambiguous 106 | data[ny][nx]=1; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:19:5: note: 'int data [110][110]' 19 | int data[SIZE][SIZE]; | ^~~~
s354756154
p00207
C++
include<iostream> using namespace std; #define MAX_H 100 #define MAX_W 100 #define INF 1000; int h,w; int field[MAX_H][MAX_W]; int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0}; void dfs(int y,int x,const int sc){ if(y<=0 || x<=0 || y>h || x>w)return; if(field[y][x]==sc){ field[y][x]=0; for(int i=0;i<4;i++)dfs(y+dy[i],x+dx[i],sc); } return; } int main(){ int sx,sy,gx,gy,n; while(cin>>w>>h){ if(!w && !h)break; cin>>sx>>sy>>gx>>gy>>n; for(int i=0;i<MAX_H;i++){ for(int j=0;j<MAX_W;j++){ field[i][j]=INF; } } while(n--){ int c,d,x,y; cin>>c>>d>>x>>y; for(int i=0;i<2;i++){ for(int j=0;j<4;j++){ if(d)field[y+j][x+i]=c; else field[y+i][x+j]=c; } } } dfs(sy,sx,field[sy][sx]); if(field[gy][gx])cout<<"NG"<<endl; else cout<<"OK"<<endl; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:19:15: error: 'cin' was not declared in this scope 19 | while(cin>>w>>h){ | ^~~ a.cc:38:34: error: 'cout' was not declared in this scope 38 | if(field[gy][gx])cout<<"NG"<<endl; | ^~~~ a.cc:38:46: error: 'endl' was not declared in this scope 38 | if(field[gy][gx])cout<<"NG"<<endl; | ^~~~ a.cc:39:22: error: 'cout' was not declared in this scope 39 | else cout<<"OK"<<endl; | ^~~~ a.cc:39:34: error: 'endl' was not declared in this scope 39 | else cout<<"OK"<<endl; | ^~~~
s927418791
p00207
C++
def g;gets.split.map &:to_i;end while(w,h=g)[0]>0 t,u=s=g;e=g m=[v=[6]*(w+2)]+(1..h).map{[6]+[0]*w<<6}<<v g[0].times{c,d,x,y=g;o=d<1?4:2;m[y,6-o].map{|i|i[x,o]=[c]*o}} q=[s] c=m[t][u] (q.uniq!;a,b=q.shift;m[a][b]=7;[[a,b+1],[a,b-1],[a+1,b],[a-1,b]].map{|i,j|m[i][j]==c&&q<<[i,j]})while q[0]&&q[0]!=e puts q[0]?:OK:"NG"end
a.cc:4:18: error: too many decimal points in number 4 | m=[v=[6]*(w+2)]+(1..h).map{[6]+[0]*w<<6}<<v | ^~~~ a.cc:1:1: error: 'def' does not name a type 1 | def g;gets.split.map &:to_i;end | ^~~ a.cc:1:7: error: 'gets' does not name a type 1 | def g;gets.split.map &:to_i;end | ^~~~ a.cc:1:29: error: 'end' does not name a type 1 | def g;gets.split.map &:to_i;end | ^~~ a.cc:3:9: error: 'e' does not name a type 3 | t,u=s=g;e=g | ^ a.cc:4:41: error: expected unqualified-id before '<<' token 4 | m=[v=[6]*(w+2)]+(1..h).map{[6]+[0]*w<<6}<<v | ^~ a.cc:6:1: error: 'q' does not name a type 6 | q=[s] | ^ a.cc:8:10: error: 'a' does not name a type 8 | (q.uniq!;a,b=q.shift;m[a][b]=7;[[a,b+1],[a,b-1],[a+1,b],[a-1,b]].map{|i,j|m[i][j]==c&&q<<[i,j]})while q[0]&&q[0]!=e | ^ a.cc:8:22: error: 'm' does not name a type 8 | (q.uniq!;a,b=q.shift;m[a][b]=7;[[a,b+1],[a,b-1],[a+1,b],[a-1,b]].map{|i,j|m[i][j]==c&&q<<[i,j]})while q[0]&&q[0]!=e | ^ a.cc:8:37: error: expected ']' before '+' token 8 | (q.uniq!;a,b=q.shift;m[a][b]=7;[[a,b+1],[a,b-1],[a+1,b],[a-1,b]].map{|i,j|m[i][j]==c&&q<<[i,j]})while q[0]&&q[0]!=e | ^ | ] a.cc:8:96: error: expected unqualified-id before ')' token 8 | (q.uniq!;a,b=q.shift;m[a][b]=7;[[a,b+1],[a,b-1],[a+1,b],[a-1,b]].map{|i,j|m[i][j]==c&&q<<[i,j]})while q[0]&&q[0]!=e | ^
s133467801
p00207
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; int w,h,xs,ys,xg,yg,n,ban[101][101]={{0},{0}}; const int START=4545191; const int GOAL=454545; const int CHECKED=432535; bool dfs(int x,int y,int c){ //cout<<x<<" "<<y<<endl; if(ban[x][y+1]==CHECKED&&ban[x+1][y]==CHECKED)return false; if(xg==x&&yg==y)return true; if(ban[x+1][y]==c){ ban[x+1][y]=CHECKED; if(dfs(x+1,y,c))return true; } if(ban[x][y+1]==c){ ban[x][y+1]=CHECKED; if(dfs(x,y+1,c))return true; } return false; } int main(){ while(cin>>w>>h&&w&&h){ cin>>xs>>ys>>xg>>yg>>n; for(int i=0;i<101;i++) for(int j=0;j<101;j++)ban[i][j]=0; for(int i=0;i<n;i++){ int c,d,x,y; cin>>c>>d>>x>>y; if(!d){ for(int i=x;i<x+4;i++){ for(int j=y;j<y+2;j++){ ban[i][j]=c; } } } else{ for(int i=x;i<x+2;i++){ for(int j=y;j<y+4;j++){ ban[i][j]=c; } } } } if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl; else cout<<"NG"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:54:10: error: expected '}' at end of input 54 | } | ^ a.cc:26:11: note: to match this '{' 26 | int main(){ | ^
s235724663
p00207
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; int w,h,xs,ys,xg,yg,n,ban[111][111]={{0},{0}}; bool visited [101][101]; const int START=4545191; const int GOAL=454545; bool dfs(int x,int y){ //cout<<x<<" "<<y<<endl; if(xg==x&&yg==y)return true; if(ban[x+1][y]==ban[xs][ys]&&visited[x][y]==false){ visited[x][y]=true; if(dfs(x+1,y))return true; } if(ban[x][y+1]==ban[xs][ys]&&visited[x][y]==false){ visited[x][y]=true; if(dfs(x,y+1))return true; } if(x>=2&&ban[x-1][y]==ban[xs][y]&&visited[x][y]==false){ visited[x][y]=true; if(dfs(x-1,y))return true; } if(y>=2&&ban[x][y-1]==ban[xs][y]&&visited[x][y]=false;){ visited[x][y]=true; if(dfs(x,y-1))return true; } return false; } int main(){ while(cin>>w>>h&&w&&h){ cin>>xs>>ys>>xg>>yg>>n; for(int i=0;i<101;i++) for(int j=0;j<101;j++)ban[i][j]=0,visited[i][j]=false; for(int i=0;i<n;i++){ int c,d,x,y; cin>>c>>d>>x>>y; if(!d){ for(int i=x;i<x+4;i++){ for(int j=y;j<y+2;j++){ ban[i][j]=c; } } } else{ for(int i=x;i<x+2;i++){ for(int j=y;j<y+4;j++){ ban[i][j]=c; } } } } if(dfs(xs,ys))cout<<"OK"<<endl; else cout<<"NG"<<endl; } return 0; }
a.cc: In function 'bool dfs(int, int)': a.cc:26:49: error: lvalue required as left operand of assignment 26 | if(y>=2&&ban[x][y-1]==ban[xs][y]&&visited[x][y]=false;){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ a.cc:26:71: error: expected primary-expression before ')' token 26 | if(y>=2&&ban[x][y-1]==ban[xs][y]&&visited[x][y]=false;){ | ^
s363353907
p00207
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; int xs,ys,w,h,n,ban[111][111],xg,yg;bool visited[101][101]; bool dfs(int x,int y,int c){ //cout<<x<<" "<<y<<endl; if(c-1||ban[x][y]!=c)return false; if(xg==x&&yg==y)return true; //if(ban[xs][ys]==0)return false; if(ban[x+1][y]==c&&visited[x+1][y]==false){ visited[x+1][y]=true; if(dfs(x+1,y,c))return true; } if(ban[x][y+1]==c&&visited[x][y+1]==false){ visited[x][y+1]=true; if(dfs(x,y+1,c))return true; } if(x>=2&&ban[x-1][y]==c&&visited[x-1][y]==false){ visited[x-1][y]=true; if(dfs(x-1,y,c))return true; } if(y>=2&&ban[x][y-1]=c&&visited[x][y-1]==false){ visited[x][y-1]=true; if(dfs(x,y-1,c))return true; } return false; } int main(){ while(cin>>w>>h&&w&&h){ cin>>xs>>ys>>xg>>yg>>n; for(int i=0;i<101;i++) for(int j=0;j<101;j++)ban[i][j]=-1,visited[i][j]=false; for(int i=0;i<n;i++){ int c,d,x,y; cin>>c>>d>>x>>y; if(!d){ for(int i=x;i<x+4;i++){ for(int j=y;j<y+2;j++){ ban[i][j]=c; } } } else{ for(int i=x;i<x+2;i++){ for(int j=y;j<y+4;j++){ ban[i][j]=c; } } } } if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl; else cout<<"NG"<<endl; } return 0; }
a.cc: In function 'bool dfs(int, int, int)': a.cc:23:24: error: lvalue required as left operand of assignment 23 | if(y>=2&&ban[x][y-1]=c&&visited[x][y-1]==false){ | ~~~~^~~~~~~~~~~~~
s016930349
p00207
C++
if(ban[x][y+1]==c&&visited[x][y+1]==false){ visited[x][y+1]=true; if(dfs(x,y+1,c))return true; } if(x>=2&&ban[x-1][y]==c&&visited[x-1][y]==false){ visited[x-1][y]=true; if(dfs(x-1,y,c))return true; } if(y>=2&&ban[x][y-1]==c&&visited[x][y-1]==false){ visited[x][y-1]=true; if(dfs(x,y-1,c))return true; } return false; } int main(){ while(cin>>w>>h&&w&&h){ cin>>xs>>ys>>xg>>yg>>n; for(int i=0;i<101;i++) for(int j=0;j<101;j++)ban[i][j]=-1,visited[i][j]=false; for(int i=0;i<n;i++){ int c,d,x,y; cin>>c>>d>>x>>y; if(!d){ for(int i=x;i<x+4;i++){ for(int j=y;j<y+2;j++){ ban[i][j]=c; } } } else{ for(int i=x;i<x+2;i++){ for(int j=y;j<y+4;j++){ ban[i][j]=c; } } } } if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl; else cout<<"NG"<<endl; } return 0; }
a.cc:1:17: error: expected unqualified-id before 'if' 1 | if(ban[x][y+1]==c&&visited[x][y+1]==false){ | ^~ a.cc:5:17: error: expected unqualified-id before 'if' 5 | if(x>=2&&ban[x-1][y]==c&&visited[x-1][y]==false){ | ^~ a.cc:9:17: error: expected unqualified-id before 'if' 9 | if(y>=2&&ban[x][y-1]==c&&visited[x][y-1]==false){ | ^~ a.cc:13:17: error: expected unqualified-id before 'return' 13 | return false; | ^~~~~~ a.cc:14:9: error: expected declaration before '}' token 14 | } | ^ a.cc: In function 'int main()': a.cc:19:15: error: 'cin' was not declared in this scope 19 | while(cin>>w>>h&&w&&h){ | ^~~ a.cc:19:20: error: 'w' was not declared in this scope 19 | while(cin>>w>>h&&w&&h){ | ^ a.cc:19:23: error: 'h' was not declared in this scope 19 | while(cin>>w>>h&&w&&h){ | ^ a.cc:20:14: error: 'xs' was not declared in this scope 20 | cin>>xs>>ys>>xg>>yg>>n; | ^~ a.cc:20:18: error: 'ys' was not declared in this scope 20 | cin>>xs>>ys>>xg>>yg>>n; | ^~ a.cc:20:22: error: 'xg' was not declared in this scope 20 | cin>>xs>>ys>>xg>>yg>>n; | ^~ a.cc:20:26: error: 'yg' was not declared in this scope 20 | cin>>xs>>ys>>xg>>yg>>n; | ^~ a.cc:20:30: error: 'n' was not declared in this scope 20 | cin>>xs>>ys>>xg>>yg>>n; | ^ a.cc:22:31: error: 'ban' was not declared in this scope 22 | for(int j=0;j<101;j++)ban[i][j]=-1,visited[i][j]=false; | ^~~ a.cc:22:44: error: 'visited' was not declared in this scope 22 | for(int j=0;j<101;j++)ban[i][j]=-1,visited[i][j]=false; | ^~~~~~~ a.cc:30:41: error: 'ban' was not declared in this scope 30 | ban[i][j]=c; | ^~~ a.cc:37:41: error: 'ban' was not declared in this scope 37 | ban[i][j]=c; | ^~~ a.cc:42:30: error: 'ban' was not declared in this scope 42 | if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl; | ^~~ a.cc:42:20: error: 'dfs' was not declared in this scope 42 | if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl; | ^~~ a.cc:42:43: error: 'cout' was not declared in this scope 42 | if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl; | ^~~~ a.cc:42:55: error: 'endl' was not declared in this scope 42 | if(dfs(xs,ys,ban[xs][ys]))cout<<"OK"<<endl; | ^~~~ a.cc:43:14: error: 'cout' was not declared in this scope 43 | else cout<<"NG"<<endl; | ^~~~ a.cc:43:26: error: 'endl' was not declared in this scope 43 | else cout<<"NG"<<endl; | ^~~~
s489224277
p00207
C++
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int fie[101][101],ans,gol[101][101],st[101][101],col,muki,bx,by; int bex[4]={0,1,0,-1},bey[4]={1,0,-1,0},cou,a,b; int sx,sy,gx,gy,n; int func(int y,int x){ if(fie[sy][sx]==-1)return 0; if(y<1||x<1||y>b||x>a)return 0; if(fie[y][x]==ans){ fie[y][x]=0; for(int i=0;i<4;i++){ func(y+bey[i],x+bex[i]); } } return 0; } int main(){ for(;;){ cin>>a>>b; if(a==0&&b==0)break; fill(fie[0],fie[0]+101*101,-1); fill(vis[0],vis[0]+101*101,true); cin>>sx>>sy>>gx>>gy; cin>>n; for(int i=0;i<n;i++){ cin>>col>>muki>>bx>>by; if(muki==0){ for(int i=0;i<=1;i++){ for(int j=0;j<=3;j++){ fie[by+i][bx+j]=col; } } } if(muki==1){ for(int i=0;i<=3;i++){ for(int j=0;j<=1;j++){ fie[by+i][bx+j]=col; } } } } ans=fie[sy][sx]; if(fie[sy][sx]!=0){ func(sy,sx); } /*for(int i=1;i<=a;i++){ for(int j=1;j<=b;j++){ cout<<fie[i][j]; } cout<<endl; }*/ if(!fie[gy][gx])cout<<"OK"<<endl; else cout<<"NG"<<endl; cou=0; /*for(int i=1;i<=a;i++){ for(int j=1;j<=b;j++){ cout<<fie[i][j]; } cout<<endl; }*/ } return 0; } /*6 5 1 1 5 5 3 2 0 1 1 2 0 2 3 2 0 2 5 */
a.cc: In function 'int main()': a.cc:24:14: error: 'vis' was not declared in this scope 24 | fill(vis[0],vis[0]+101*101,true); | ^~~
s483977983
p00207
C++
int board[101][101]; int xg , yg; int w, h; int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; int sc; bool b; void dfs(int x , int y){ if(x==xg&&y==yg) {b=true;return;} for(int i=0;i<4;++i){ int tx=x+dx[i]; int ty=y+dy[i]; if(tx<=0||ty<=0||tx>w||ty>h) continue; if(board[tx][ty]!=sc || board[tx][ty]==0) continue; if(b) continue; dfs(tx,ty); } } int main(){ while(cin >> w >> h , w||h){ int xs , ys; int n; b=false; memset(board,0,sizeof(board)); cin >> xs >> ys >> xg >> yg >> n; for(int i=0;i<n;++i){ int c , d , x , y; cin >> c >> d >> x >> y; if(d==0){ for(int k=0;k<2;++k){ for(int j=0;j<4;++j){ board[x+j][y+k]=c; } } } else if(d==1){ for(int k=0;k<4;++k){ for(int j=0;j<2;++j){ board[x+j][y+k]=c; } } } } sc=board[xs][ys]; int gc=board[xg][yg]; if(sc!=gc) {} else dfs(xs,ys); cout << ( b ? "OK" : "NG") << endl; } return 0; }
a.cc: In function 'int main()': a.cc:22:15: error: 'cin' was not declared in this scope 22 | while(cin >> w >> h , w||h){ | ^~~ a.cc:26:17: error: 'memset' was not declared in this scope 26 | memset(board,0,sizeof(board)); | ^~~~~~ a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | int board[101][101]; a.cc:49:17: error: 'cout' was not declared in this scope 49 | cout << ( b ? "OK" : "NG") << endl; | ^~~~ a.cc:49:47: error: 'endl' was not declared in this scope 49 | cout << ( b ? "OK" : "NG") << endl; | ^~~~
s884167296
p00207
C++
void Eratosthenes(){ for(int i = 0; i < N; i++){ arr[i] = 1; } for(int i = 2; i < sqrt(N); i++){ if(arr[i]){ for(int j = 0; i * (j + 2) < N; j++){ arr[i *(j + 2)] = 0; } } } for(int i = 2; i < N; i++){ if(arr[i]){ //cout << i << endl; } } }
a.cc: In function 'void Eratosthenes()': a.cc:2:28: error: 'N' was not declared in this scope 2 | for(int i = 0; i < N; i++){ | ^ a.cc:3:17: error: 'arr' was not declared in this scope 3 | arr[i] = 1; | ^~~ a.cc:5:33: error: 'N' was not declared in this scope 5 | for(int i = 2; i < sqrt(N); i++){ | ^ a.cc:5:28: error: 'sqrt' was not declared in this scope 5 | for(int i = 2; i < sqrt(N); i++){ | ^~~~ a.cc:6:20: error: 'arr' was not declared in this scope 6 | if(arr[i]){ | ^~~ a.cc:13:28: error: 'N' was not declared in this scope 13 | for(int i = 2; i < N; i++){ | ^ a.cc:14:20: error: 'arr' was not declared in this scope 14 | if(arr[i]){ | ^~~
s328526413
p00207
C++
#include <bits/stdc++.h> using namespace std; // #define int long long #define pb push_back typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vector<int> > vii; template <class X> void print(X Target){ cout << Target << '\n'; } const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; int w, h; int xs, ys, xg, yg; int mp[128][128]; bool check[128][128]; void dfs(int y, int x, int color) { if (x < 1 || x > w || y < 1 || y > h) return; if (check[y][x]) return; check[y][x] = true; for (int i = 0; i < 4; i++){ if (mp[y + dy[i]][x + dx[i]] == color){ dfs(y + dy[i], x + dx[i], color); } } } signed main() { ios::sync_with_stdio(false); int n; while (cin >> w >> h, w || h){ memset(field, false, sizeof(check)); memset(mp, 0, sizeof(mp)); cin >> xs >> ys >> xg >> yg >> n; for (int i = 0; i < n; i++){ int c, d, x, y; cin >> c >> d >> x >> y; if (d){ for (int j = 0; j < 4; j++){ for (int k = 0; k < 2; k++){ mp[y + j][x + k] = c; } } } else { for (int j = 0; j < 2; j++){ for (int k = 0; k < 4; k++){ mp[y + j][x + k] = c; } } } } dfs(ys, xs, mp[ys][xs]); (check[yg][xg]) ? print("OK") : print("NG"); } return (0); }
a.cc: In function 'int main()': a.cc:39:12: error: 'field' was not declared in this scope 39 | memset(field, false, sizeof(check)); | ^~~~~
s008343676
p00207
C++
#include<bits/stdc++.h> using namespace std; #define ANSWER(x) cout<<x<<endl #define debug(x) cout<<#x<<": "<<x const int BA = 1000; const int INFTY = (1<<21); int xg,yg,w,h,gc; int maps[101][101]; int solve(int ys,int xs); int main(){ int tate[2] = {2,4}; int yoko[2] = {4,2}; int xs,ys,n; int c[101],d[101],x[101],y[101]; while(1){ fill(maps[0],maps[101],0); cin >> w >> h; if(w==0 && h==0)break; cin >> xs >> ys >> xg >> yg >> n; for(int i=0;i<n;i++){ cin >> c[i] >> d[i] >> x[i] >> y[i]; } for(int i=0;i<n;i++){ for(int j=y[i];j<y[i]+tate[d[i]];j++){ for(int k=x[i];k<x[i]+yoko[d[i]];k++){ if(j == ys && k == xs)gc = c[i]; maps[j-1][k-1] = c[i]; } } } /* for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ cout << maps[i][j]; } cout << endl; }*///マップ確認用 if(solve(ys-1,xs-1))cout << "OK\n"; else cout << "NG\n"; } } int solve(int ys,int xs){ if(xs < 0 || ys < 0 || xs > w-1 || ys > h-1 || maps[ys][xs] == 0 || map[ys][xs] != gc){ return 0; } else if(maps[ys][xs] == maps[yg-1][xg-1]){ return 1; } maps[ys][xs] = 0; return solve(ys+1,xs) + solve(ys,xs+1)+ solve(ys-1,xs) + solve(ys,xs-1); }
a.cc: In function 'int solve(int, int)': a.cc:42:74: error: missing template arguments before '[' token 42 | if(xs < 0 || ys < 0 || xs > w-1 || ys > h-1 || maps[ys][xs] == 0 || map[ys][xs] != gc){ | ^
s708891178
p00207
C++
#include <iostream> using namespace std; int F[102][102]; void DFScolor(int X,int Y,int color){ if(F[X][Y]!=color) return; F[X][Y]=9; DFScolor(X-1,Y,color); DFScolor(X,Y+1,color); DFScolor(X+1,Y,color); DFScolor(X,Y-1,color); } int main(){ while(1){ int H,W,xg,yg,xs,ys,n,count=0; cin>>H; if(H==0) count++; cin>>W; if(W==0) count++; if(count==2) return 0; cin>>xs>>ys; cin>>xg>>yg; cin>>n; int c,d,x,y; int xb[n],yb[n],colo[n]; for(int i=0;i<n;i++){ cin>>c>>d>>x>>y; colo[i]=c; xb[i]=x; yb[i]=y; if(d==0){ for(int o=y;o<y+2;o++){ for(int j=x;j<x+4;j++){ F[j][o]=c; } } } else if(d==1){ for(int o=y;o<y+4;o++){ for(int j=x;j<x+2;j++){ F[j][o]=c; } } } } for(int i=0;i<n;i++){ if(xb[i]==xs&&yb[i]==ys){ DFScolor(xb[i],yb[i],colo[i],xg,yg); break; } } if(F[xg][yg]==9) cout<<"OK"<<endl; else cout<<"NG"<<endl; } }
a.cc: In function 'int main()': a.cc:60:33: error: too many arguments to function 'void DFScolor(int, int, int)' 60 | DFScolor(xb[i],yb[i],colo[i],xg,yg); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:5:6: note: declared here 5 | void DFScolor(int X,int Y,int color){ | ^~~~~~~~
s237095157
p00207
C++
#include <iostream> using namespace std; int F[102][102]; void DFScolor(int X,int Y,int color){ if(F[X][Y]!=color) return; F[X][Y]=9; DFScolor(X-1,Y,color); DFScolor(X,Y+1,color); DFScolor(X+1,Y,color); DFScolor(X,Y-1,color); } int main(){ while(1){ int H,W,xg,yg,xs,ys,n,count=0; cin>>H; if(H==0) count++; cin>>W; if(W==0) count++; if(count==2) return 0; cin>>xs>>ys; cin>>xg>>yg; cin>>n; int c,d,x,y; int xb[n],yb[n],colo[n]; for(int i=0;i<n;i++){ cin>>c>>d>>x>>y; colo[i]=c; xb[i]=x; yb[i]=y; if(d==0){ for(int o=y;o<y+2;o++){ for(int j=x;j<x+4;j++){ F[j][o]=c; } } } else if(d==1){ for(int o=y;o<y+4;o++){ for(int j=x;j<x+2;j++){ F[j][o]=c; } } } } for(int i=0;i<n;i++){ if(xb[i]==xs&&yb[i]==ys){ DFScolor(xb[i],yb[i],colo[i],xg,yg); break; } } if(F[xg][yg]==9) cout<<"OK"<<endl; else cout<<"NG"<<endl; } }
a.cc: In function 'int main()': a.cc:60:33: error: too many arguments to function 'void DFScolor(int, int, int)' 60 | DFScolor(xb[i],yb[i],colo[i],xg,yg); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:5:6: note: declared here 5 | void DFScolor(int X,int Y,int color){ | ^~~~~~~~
s025630401
p00207
C++
#include<bits/stdc++.h> #define range(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,b) range(i,0,b) #define pb(a) push_back(a) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; using namespace std; bool isMaze; int blocks[105][105], xg, yg, w,h; void dfs(int target, int x, int y){ if(x < 0 || y < 0 || x >= w || y >= h) return; if(x == xg && y == yg){ isMaze = true; return; } if(blocks[y][x] != target || blocks[y][x] == 0){ return; } blocks[y][x] = 9; dfs(target, x + 1, y); dfs(target, x - 1, y); dfs(target, x, y + 1); dfs(target, x, y - 1); return; } int main(){ int xs, ys, n; while(cin >> w >> h, w||h){ rep(i,h) rep(j,w) blocks[i][j] = 0; cin >> xs >> ys >> xg >> yg >> n; xs--; ys--; xg--; yg--; rep(i,n){ int c, d, x, y; cin >> c >> d >> x >> y; x--; y--; rep(j, (d?4:2)) rep(k, (d?2:4)) b[x + j][y + k] = c; } isMaze = false; dfs(blocks[ys][xs], xs, ys); if(isMaze) cout << "OK" << endl; else cout << "NG" << endl; } }
a.cc: In function 'int main()': a.cc:41:45: error: 'b' was not declared in this scope 41 | rep(j, (d?4:2)) rep(k, (d?2:4)) b[x + j][y + k] = c; | ^
s152080703
p00207
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define INF 1010001000 #define loop(i, n) for (int i = 0; i < n; i++) #define mp make_pair typedef pair<int, int> i_i; int sx, sy, gx, gy; int n, m; int main() { while(cin >> n >> m,(n|m)){ m++; n++; vector<vector<int> > graph(m,vector<int>(n,0)); cin>>sx>>sy>>gx>>gy; int bl; cin>>bl; loop(i, bl){ int a,b,c,t; cin>>a>>b>>c>>t; if(b){ for(int j=t;j<t+2;j++){ for(int k=c;k<c+4;k++){ graph[k][j] = a; } } } else { for(int j=c;j<c+2;j++){ for(int k=t;k<t+4;k++){ graph[k][j] = a; } } } } cout<<(dfs(graph))?"OK":"NG"<<endl; } return 0; } bool dfs(vector<vector<int> > &g) { int cl = g[sx][sy]; vector<vector<bool> > vsed(m,vector<bool>(n,false)); queue<i_i > q; q.push(mp(sx,sy)); while(!q.empty()){ int x = q.top().first, y = q.top().second; q.pop(); if(x == gx && y == gy){ return true; } if(vsed[x][y]){ continue; } else { vsed[x][y]=true; } loop(i, 4) { int nx = x +dx[i], ny = y +dy[i]; if(0<nx && nx < n && 0<ny && ny < m){ if(g[nx][ny] == cl){ q.push(mp(nx,ny)); } } } } return false; }
a.cc: In function 'int main()': a.cc:38:8: error: 'dfs' was not declared in this scope 38 | cout<<(dfs(graph))?"OK":"NG"<<endl; | ^~~ a.cc:38:29: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<' 38 | cout<<(dfs(graph))?"OK":"NG"<<endl; | ~~~~^~~~~~ a.cc: In function 'bool dfs(std::vector<std::vector<int> >&)': a.cc:46:1: error: 'queue' was not declared in this scope 46 | queue<i_i > q; | ^~~~~ a.cc:4:1: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>' 3 | #include <algorithm> +++ |+#include <queue> 4 | using namespace std; a.cc:46:11: error: expected primary-expression before '>' token 46 | queue<i_i > q; | ^ a.cc:46:13: error: 'q' was not declared in this scope 46 | queue<i_i > q; | ^ a.cc:51:15: error: 'y' was not declared in this scope 51 | if(x == gx && y == gy){ | ^ a.cc:54:12: error: 'y' was not declared in this scope 54 | if(vsed[x][y]){ | ^ a.cc:61:13: error: 'dx' was not declared in this scope; did you mean 'nx'? 61 | int nx = x +dx[i], ny = y +dy[i]; | ^~ | nx a.cc:62:24: error: 'ny' was not declared in this scope; did you mean 'nx'? 62 | if(0<nx && nx < n && 0<ny && ny < m){ | ^~ | nx
s302846425
p00207
C++
#include <iostream> #include <vector> #include <algorithm> #include <queue> using namespace std; #define INF 1010001000 #define loop(i, n) for (int i = 0; i < n; i++) #define mp make_pair typedef pair<int, int> i_i; bool dfs(vector<vector<int> > &g); int sx, sy, gx, gy; int n, m; int dx[4]={0,1,0,-1}; int dy[4]={1,0,-1,0}; int main() { while(cin >> n >> m,(n|m)){ m++; n++; vector<vector<int> > graph(m,vector<int>(n,0)); cin>>sx>>sy>>gx>>gy; int bl; cin>>bl; loop(i, bl){ int a,b,c,t; cin>>a>>b>>c>>t; if(b){ for(int j=t;j<t+2;j++){ for(int k=c;k<c+4;k++){ graph[k][j] = a; } } } else { for(int j=c;j<c+2;j++){ for(int k=t;k<t+4;k++){ graph[k][j] = a; } } } } cout << (dfs(graph)) ? "OK" : "NG" << endl; } return 0; } bool dfs(vector<vector<int> > &g) { int cl = g[sx][sy]; vector<vector<bool> > vsed(m,vector<bool>(n,false)); queue<i_i > q; q.push(mp(sx,sy)); while(!q.empty()){ int x = q.top().first, y = q.top().second; q.pop(); if(x == gx && y == gy){ return true; } if(vsed[x][y]){ continue; } else { vsed[x][y]=true; } loop(i, 4) { int nx = x +dx[i], ny = y +dy[i]; if(0<nx && nx < n && 0<ny && ny < m){ if(g[nx][ny] == cl){ q.push(mp(nx,ny)); } } } } return false; }
a.cc: In function 'int main()': a.cc:43:36: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<' 43 | cout << (dfs(graph)) ? "OK" : "NG" << endl; | ~~~~~^~~~~~~ a.cc: In function 'bool dfs(std::vector<std::vector<int> >&)': a.cc:54:11: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'? 54 | int x = q.top().first, y = q.top().second; | ^~~ | pop a.cc:56:15: error: 'y' was not declared in this scope 56 | if(x == gx && y == gy){ | ^ a.cc:59:12: error: 'y' was not declared in this scope 59 | if(vsed[x][y]){ | ^ a.cc:66:25: error: 'y' was not declared in this scope; did you mean 'ny'? 66 | int nx = x +dx[i], ny = y +dy[i]; | ^ | ny
s689547970
p00207
C++
#include<cstdio> #include<cstring> #include<stack> struct p{ int x; int y; }; using namespace std; int main(){ int w,h,sx,sy,gx,gy,n,c,d,x,y,i,j,k,o; int map[100][100]; int used[100][100]; int mx[4]={-1,0,1,0}; int my[4]={0,-1,0,1}; p v,u; stack<p> s; while(1){ scanf("%d %d",&w,&h); if(w==0&&h==0){ break; } memset(map,0,sizeof(map)); memset(used,0,sizeof(used)); scanf("%d %d",&sx,&sy); sx--; sy--; scanf("%d %d",&gx,&gy); gx--; gy--; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %d %d %d",&c,&d,&x,&y); x--; y--; if(!d){ for(j=y;j<y+2;j++){ for(k=x;k<x+4;k++){ map[j][k]=c; } } } else{ for(j=y;j<y+4;j++){ for(k=x;k<x+2;k++){ map[j][k]=c; } } } } if(map[sy][sx]!=map[gy][gx]){ printf("NG\n"); continue; } v.x=sx; v.y=sy; s.push(v); o=0; while(!s.empty()){ v=s.top(); s.pop(); if(used[v.y][v.x]){ continue; } else{ used[v.y][v.x]=1; } if(v.x==gx&&v.y==gy){ o=1; while(!s.empty){ s.pop(); } break; } for(i=0;i<4;i++){ u=v; u.x+=mx[i]; u.y+=my[i]; if(u.x>=0&&u.x<w&&u.y>=0&&u.y<h&&map[u.y][u.x]==map[sy][sx]){ s.push(u); } } } if(o){ printf("OK\n"); } else{ printf("NG\n"); } } return 0; }
a.cc: In function 'int main()': a.cc:69:42: error: cannot convert 'std::stack<p>::empty' from type 'bool (std::stack<p>::)() const' to type 'bool' 69 | while(!s.empty){ | ^~~~~ a.cc:69:42: error: in argument to unary ! 69 | while(!s.empty){ | ~~^~~~~
s487833019
p00207
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i = 0; i < n; ++i) #define rep2(i, n) for(int i = 1; i <= n; ++i) #define INF 0 #define MAX 102 using namespace std; const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; int field[102][102]; int h, w, sx, sy, gx, gy, n; int col, dire, x, y; int scol; bool dfs(int nx, int ny) { if(nx == gx && ny == gy) return true; field[nx][ny] = -1; for(int i = 0; i < 4; ++i) { int nex = nx + dx[i]; int ney = ny + dy[i]; if(0 < nex && nex <= w && 0 < ney && ney <= h && scol == field[nex][ney]) { if(dfs(nex, ney)) return true; } } return false; } int main() { while(1) { scol = INF; cin >> h >> w; for(int i = 1; i <= h; ++i) { for(int j = 1; j <= w; ++j) { field[i][j] = 0; } } if(h == 0 && w == 0) break; cin >> sx >> sy >> gx >> gy; cin >> n; rep(k, n) { cin >> col >> dire >> x >> y; if(dire == 1) { for(int i = 0; i < 4; ++i) { for(int j = 0; j < 2; ++j) field[x+j][y+i] = col; }a } else { for(int i = 0; i < 2; ++i) { for(int j = 0; j < 4; ++j) field[x+j][y+i] = col; } } } scol = field[sx][sy]; if(dfs(sx, sy)) cout << "OK" << endl; else cout << "NG" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:48:34: error: 'a' was not declared in this scope 48 | }a | ^
s379882824
p00207
C++
#include<iostream> using namespace std; int F[102][102]; bool DFS(int X, int Y, int Xg, int Yg, int c){ if(F[Y][X] != c){ return false; }else if(F[Y][X] == c && X == Xg && Y == Yg){ return true; } F[Y][X] = -1; if(DFS(X, Y - 1, Xg, Yg, c)){ return true; }else if(DFS(X + 1, Y, Xg, Yg, c)){ return true; }else if(DFS(X, Y + 1, Xg, Yg, c)){ return true; }else if(DFS(X - 1, Y, Xg, Yg, c)){ return true; } return false; } int main(){ while(true){ int w, h; cin >> w >> h; if(w == 0 && h == 0){ break; } int xs, ys, xg, yg; cin >> xs >> ys >> xg >> yg; int n; cin >> n; for(int i = 0; i < n; i++){ int c, d, x, y; cin >> c >> d >> x >> y; if(d == 0){ for(int X = x; X < x + 4; X++){ for(int Y = y; Y < y + 2; Y++){ F[Y][X] = c; } } }else if(d == 1){ for(int X = x; X < x + 2; X++){ for(int Y = y; Y < y + 4; Y++){ F[Y][X] = c; } } } } if(DFS(xs, ys, xg, yg, F[xg][yg])){ cout << "OK" << "\n"; }else{ cout << "NG" << "\n";#include<iostream> using namespace std; int F[102][102]; bool DFS(int X, int Y, int Xg, int Yg, int c){ if(F[Y][X] != c){ return false; }else if(F[Y][X] == c && X == Xg && Y == Yg){ return true; } F[Y][X] = -1; if(DFS(X, Y - 1, Xg, Yg, c)){ return true; }else if(DFS(X + 1, Y, Xg, Yg, c)){ return true; }else if(DFS(X, Y + 1, Xg, Yg, c)){ return true; }else if(DFS(X - 1, Y, Xg, Yg, c)){ return true; } return false; } int main(){ bool isfirst = true; while(true){ if(isfirst){ isfirst = false; }else{ cout << endl; } int w, h; cin >> w >> h; if(w == 0 && h == 0){ break; } int xs, ys, xg, yg; cin >> xs >> ys >> xg >> yg; int n; cin >> n; for(int i = 0; i < n; i++){ int c, d, x, y; cin >> c >> d >> x >> y; if(d == 0){ for(int X = x; X < x + 4; X++){ for(int Y = y; Y < y + 2; Y++){ F[Y][X] = c; } } }else if(d == 1){ for(int X = x; X < x + 2; X++){ for(int Y = y; Y < y + 4; Y++){ F[Y][X] = c; } } } } if(DFS(xs, ys, xg, yg, F[xg][yg])){ cout << "OK"; }else{ cout << "NG"; } } return 0; } } } return 0; }
a.cc:59:38: error: stray '#' in program 59 | cout << "NG" << "\n";#include<iostream> | ^ a.cc: In function 'int main()': a.cc:59:39: error: 'include' was not declared in this scope 59 | cout << "NG" << "\n";#include<iostream> | ^~~~~~~ a.cc:59:55: error: expected primary-expression before '>' token 59 | cout << "NG" << "\n";#include<iostream> | ^ a.cc:60:1: error: expected primary-expression before 'using' 60 | using namespace std; | ^~~~~ a.cc:64:46: error: a function-definition is not allowed here before '{' token 64 | bool DFS(int X, int Y, int Xg, int Yg, int c){ | ^ a.cc:84:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 84 | int main(){ | ^~ a.cc:84:9: note: remove parentheses to default-initialize a variable 84 | int main(){ | ^~ | -- a.cc:84:9: note: or replace parentheses with braces to value-initialize a variable a.cc:84:11: error: a function-definition is not allowed here before '{' token 84 | int main(){ | ^
s242302511
p00207
C++
#include<iostream> using namespace std; int Array[200][200]; #define START 20 void DFS(int h,int w,int c){ if(Array[h][w] == GOAL){ is_goal = true; return; } if(Array[h][w] != c || Array[h][w] == 0 || Array[h][w] == 6){ return; } int tmp=Array[h][w]; Array[h][w] = 6; DFS(h-1,w,tmp); DFS(h,w+1,tmp); DFS(h+1,w,tmp); DFS(h,w-1,tmp); } int main(){ while(1){ int H,W; int Start[2],Goal[2]; int BlockNum; int color,dir,xpos,ypos; for(int i=0;i<200;i++){ for(int j=0;j<200;j++){ Array[i][j] = 0; } } cin >> H >> W; if(H == 0 && W == 0){ break; } cin >> Start[0] >> Start[1]; cin >> Goal[0] >> Goal[1]; cin >> BlockNum; for(int i=0;i<BlockNum;i++){ cin >> color >> dir >> xpos >> ypos; for(int i=0;i<4;i++){ for(int j=0;j<2;j++){ if(!dir){//?¨? Array[xpos+i][ypos+j] = color; } else{ Array[xpos+j][ypos+i] = color; } } } } /*for(int i=1;i<=H;i++){ for(int j=1;j<=W;j++){ cout << Array[i][j]; } cout << endl; }*/ if(Array[Start[0]][Start[1]] != 0){ DFS(Start[0],Start[1],Array[Start[0]][Start[1]]); } if(Array[Goal[0]][Goal[1]] == 6){ cout << "OK" << endl; } else{ cout << "NG" << endl; } } return 0; }
a.cc: In function 'void DFS(int, int, int)': a.cc:10:23: error: 'GOAL' was not declared in this scope 10 | if(Array[h][w] == GOAL){ | ^~~~ a.cc:11:7: error: 'is_goal' was not declared in this scope 11 | is_goal = true; | ^~~~~~~
s070525875
p00207
C++
#include<iostream> using namespace std; char F[102][102]; void DFS(int Y,int X,char C){ if(F[Y][X]!=C) return; F[Y][X]='.'; DFS(Y-1,X,C); DFS(Y,X+1,C); DFS(Y+1,X,C); DFS(Y,X-1,C); } int main(){ while(1){ int w,h; cin>>w>>h; if(w==0&&h==0) break; int xs,ys,xg,yg; cin>>xs>>ys>>xg>>yg; int n; cin>> #include<iostream> using namespace std; char F[102][102]; void DFS(int Y,int X,char C){ if(F[Y][X]!=C) return; F[Y][X]='.'; DFS(Y-1,X,C); DFS(Y,X+1,C); DFS(Y+1,X,C); DFS(Y,X-1,C); } int main(){ while(1){ int w,h; cin>>w>>h; if(w==0&&h==0) break; int xs,ys,xg,yg; cin>>xs>>ys>>xg>>yg; int n; cin>>n; char C; for(int i=0;i<n;i++){ int d,x,y; char c; cin>>c; cin>>d>>x>>y; if(d==0){ for(int j=0;j<2;j++){ for(int l=0;l<4;l++){ F[y+j][x+l]=c; } } }else{ for(int j=0;j<4;j++){ for(int l=0;l<2;l++){ F[y+j][x+l]=c; } } } } C=F[ys][xs]; if(C!=0){ DFS(ys,xs,C); if(F[yg][xg]=='.'&&F[ys][xs]=='.'){ cout<<"OK"<<endl; }else{ cout<<"NG"<<endl; } }else{ cout<<"NG"<<endl; } } return 0; }n; char C; for(int i=0;i<n;i++){ int d,x,y; char c; cin>>c; cin>>d>>x>>y; if(d==0){ for(int j=0;j<2;j++){ for(int l=0;l<4;l++){ F[y+j][x+l]=c; } } }else{ for(int j=0;j<4;j++){ for(int l=0;l<2;l++){ F[y+j][x+l]=c; } } } } C=F[ys][xs]; if(C!=0){ DFS(ys,xs,C); if(F[yg][xg]=='.'&&F[ys][xs]=='.'){ cout<<"OK"<<endl; }else{ cout<<"NG"<<endl; } }else{ cout<<"NG"<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:32:1: error: expected primary-expression before 'using' 32 | using namespace std; | ^~~~~ a.cc:36:29: error: a function-definition is not allowed here before '{' token 36 | void DFS(int Y,int X,char C){ | ^ a.cc:50:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 50 | int main(){ | ^~ a.cc:50:9: note: remove parentheses to default-initialize a variable 50 | int main(){ | ^~ | -- a.cc:50:9: note: or replace parentheses with braces to value-initialize a variable a.cc:50:11: error: a function-definition is not allowed here before '{' token 50 | int main(){ | ^
s688291874
p00207
C++
include <iostream> using namespace std; int F[101][102]; void DFS(int Y, int X, int c) { //cout << Y << " " << X << endl; if (F[Y][X] != c || F[Y][X] == 0) return; F[Y][X] = 10; DFS(Y - 1, X, c);//??? //DFS(Y - 1, X+1, A_ito);//?????? DFS(Y, X + 1, c);//??? //DFS(Y + 1, X+1, A_ito);//?????? DFS(Y + 1, X, c);//??? //DFS(Y + 1, X-1, A_ito);//?????? DFS(Y, X - 1, c);//??? //DFS(Y - 1, X-1, A_ito);//?????? } int main() { int xs, ys, xg, yg, n; int c, d, x, y; int W = 0, H = 0; while (!(W == H == 0)) { cin >> W >> H; cin >> xs >> ys >> xg >> yg >> n; for (int i = 1;i <= n;i++) { cin >> c >> d >> x >> y; if (d == 0) { F[x][y] = c; F[x][y + 1] = c; F[x + 1][y] = c; F[x + 1][y + 1] = c; F[x + 2][y] = c; F[x + 2][y + 1] = c; F[x + 3][y] = c; F[x + 3][y + 1] = c; } if (d == 1) { F[x][y] = c; F[x + 1][y] = c; F[x][y + 1] = c; F[x + 1][y + 1] = c; F[x][y + 2] = c; F[x + 1][y + 2] = c; F[x][y + 3] = c; F[x + 1][y + 3] = c; } } DFS(ys, xs, F[ys][xs]); if (F[yg][xg] == 10) { cout << "OK" << endl; } else { cout << "NG"<<endl; } for (int i = 0;i < H;i++) { for (int j = 0;j < W;j++) { F[i][j] = 0; } } } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:29:17: error: 'cin' was not declared in this scope 29 | cin >> W >> H; | ^~~ a.cc:57:25: error: 'cout' was not declared in this scope 57 | cout << "OK" << endl; | ^~~~ a.cc:57:41: error: 'endl' was not declared in this scope 57 | cout << "OK" << endl; | ^~~~ a.cc:59:24: error: 'cout' was not declared in this scope 59 | else { cout << "NG"<<endl; } | ^~~~ a.cc:59:38: error: 'endl' was not declared in this scope 59 | else { cout << "NG"<<endl; } | ^~~~
s976198168
p00207
C++
#include "stdafx.h" #include <iostream> using namespace std; int F[102][102]; void DFS(int Y, int X, int c) { //cout << Y << " " << X << endl; if (F[Y][X] != c || c != 0) return; F[Y][X] = 10; DFS(Y - 1, X, c);//??? //DFS(Y - 1, X+1, A_ito);//?????? DFS(Y, X + 1, c);//??? //DFS(Y + 1, X+1, A_ito);//?????? DFS(Y + 1, X, c);//??? //DFS(Y + 1, X-1, A_ito);//?????? DFS(Y, X - 1, c);//??? //DFS(Y - 1, X-1, A_ito);//?????? } int main() { int xs, ys, xg, yg, n; int c, d, x, y; int W = 1, H = 1; while ((W != 0) && (H != 0)) { cin >> W >> H; cin >> xs >> ys >> xg >> yg >> n; for (int i = 1;i <= n;i++) { cin >> c >> d >> x >> y; if (d == 0) { F[x][y] = c; F[x][y + 1] = c; F[x + 1][y] = c; F[x + 1][y + 1] = c; F[x + 2][y] = c; F[x + 2][y + 1] = c; F[x + 3][y] = c; F[x + 3][y + 1] = c; } if (d == 1) { F[x][y] = c; F[x + 1][y] = c; F[x][y + 1] = c; F[x + 1][y + 1] = c; F[x][y + 2] = c; F[x + 1][y + 2] = c; F[x][y + 3] = c; F[x + 1][y + 3] = c; } } if (F[ys][xs] != 0) DFS(ys, xs, F[ys][xs]); if (F[yg][xg] == 10) { cout << "OK" << endl; } else { cout << "NG" << endl; } /*for (int i = 0;i < H;i++) { for (int j = 0;j < W;j++) { F[i][j] = 0; } } */ } return 0; }
a.cc:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s252853809
p00207
C++
#include "stdafx.h" #include <iostream> using namespace std; int F[102][102] = { 0 }; void DFS(int Y, int X, int c) { //cout << Y << " " << X << endl; if (F[Y][X] != c) return; F[Y][X] = 10; DFS(Y - 1, X, c);//??? //DFS(Y - 1, X+1, A_ito);//?????? DFS(Y, X + 1, c);//??? //DFS(Y + 1, X+1, A_ito);//?????? DFS(Y + 1, X, c);//??? //DFS(Y + 1, X-1, A_ito);//?????? DFS(Y, X - 1, c);//??? //DFS(Y - 1, X-1, A_ito);//?????? } int main() { int xs, ys, xg, yg, n; int c, d, x, y; int W = 1, H = 1; while ((W != 0) && (H != 0)) { cin >> W >> H; for (int i = 1;i <= H;i++) { for (int j = 1;j <= W;j++) { F[i][j] = 6; } } cin >> xs >> ys >> xg >> yg >> n; for (int i = 1;i <= n;i++) { cin >> c >> d >> x >> y; if (d == 0) { F[x][y] = c; F[x][y + 1] = c; F[x + 1][y] = c; F[x + 1][y + 1] = c; F[x + 2][y] = c; F[x + 2][y + 1] = c; F[x + 3][y] = c; F[x + 3][y + 1] = c; } if (d == 1) { F[x][y] = c; F[x + 1][y] = c; F[x][y + 1] = c; F[x + 1][y + 1] = c; F[x][y + 2] = c; F[x + 1][y + 2] = c; F[x][y + 3] = c; F[x + 1][y + 3] = c; } } if(F[ys][xs]!=0) DFS(ys, xs, F[ys][xs]); if (F[yg][xg] == F[ys][yg]) { cout << "OK" << endl; } else { cout << "NG" << endl; } for (int i = 0;i <= H;i++) { for (int j = 0;j <= W;j++) { F[i][j] = 0; } } } return 0; }
a.cc:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s156398423
p00207
C++
#include<iostream> using namespace std; int F[102][102]; void DFS(int Y,int X,int C){ if(F[Y][X]!=C) return; F[Y][X]=6; DFS(Y-1,X,C); DFS(Y,X+1,C); DFS(Y+1,X,C); DFS(Y,X-1,C); } int main(){ int w,h,xs,ys,xg,yg,n; int c,d,x,y; while(true){ cin >> w >> h; if(w==0&&h==0) break; cin >> xs >> ys; cin >> xg >> yg; cin >> n; for(int i=1;i<=n;i++){ cin >> c >> d >> x >> y; if(d==0){ F[x+1][y+1]=c; F[x+2][y+1]=c; F[x+3][y+1]=c; F[x+4][y+1]=c; F[x+1][y+2]=c; F[x+2][y+2]=c; F[x+3][y+2]=c; F[x+4][y+2]=c; } if(d==1){ F[x+1][y+1]=c; F[x+1][y+2]=c; F[x+1][y+3]=c; F[x+1][y+4]=c; F[x+2][y+1]=c; F[x+2][y+2]=c; F[x+2][y+3]=c; F[x+2][y+4]=c; } } if(F[xs][xy]!=1&&F[xs][xy]!=2&&F[xs][xy]!=3&&F[xs][xy]!=4&&F[xs][xy]!=5) cout << "NG" << endl; else{ DFS(xs+1,ys+1,c); if(F[xg+1][yg+1]==6) cout << "OK" << endl; else cout << "NG" << endl; for(int i=1;i<=w;i++) for(int j=1;j<=h;j++) F[i][j]=0; } } return 0; }
a.cc: In function 'int main()': a.cc:49:16: error: 'xy' was not declared in this scope; did you mean 'y'? 49 | if(F[xs][xy]!=1&&F[xs][xy]!=2&&F[xs][xy]!=3&&F[xs][xy]!=4&&F[xs][xy]!=5) | ^~ | y
s988934961
p00207
C++
#include<functional> #include<algorithm> #include<iostream> #include<utility> #include<string> #include<vector> #include<cmath> #include<stack> #include<queue> #include<deque> #include<map> #define rep(i,n) for(int i=0;i<n;i++) #define loop(i,x,n) for(int i=x;i<n;i++) #define all(v) (v).begin(),(v).end() #define pf push_front #define pb push_back #define int long long using namespace std; const int INF=1000000007; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; int mp[100001][100001]; bool ans; int w,h,tmp; int xs,ys,xg,yg; void dfs(int y,int x,int c){ if(y>0&&y<=h&&x>0&&x<=w&&mp[y][x]==c){ mp[y][x]=0; rep(i,4){ dfs(y+dy[i],x+dx[i],c); } }else return; if(y==yg&&x==xg){ ans=true; return; } } signed main(){ while(cin>>w>>h,w){ rep(i,w)rep(j,h)mp[i][j]==0; ans=false; cin>>xs>>ys>>xg>>yg; //xs--;ys--;xg--;yg--; int n; cin>>n; rep(i,n){ int c,d,x,y; cin>>c>>d>>x>>y; //x--;y--; if(d==0)rep(i,2)rep(j,4)mp[y+i][x+j]=c; else rep(i,2)rep(j,4)mp[y+j][x+i]=c; } tmp=mp[ys][xs]; if(mp[ys][xs]==tmp&&mp[yg][xg]==tmp)dfs(ys,xs,tmp); cout<<(ans?"OK":"NG")<<endl; } return 0; }
/tmp/ccCsALhd.o: in function `dfs(long long, long long, long long)': a.cc:(.text+0x22): relocation truncated to fit: R_X86_64_PC32 against symbol `h' defined in .bss section in /tmp/ccCsALhd.o a.cc:(.text+0x3e): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccCsALhd.o a.cc:(.text+0x10b): relocation truncated to fit: R_X86_64_PC32 against symbol `yg' defined in .bss section in /tmp/ccCsALhd.o a.cc:(.text+0x118): relocation truncated to fit: R_X86_64_PC32 against symbol `xg' defined in .bss section in /tmp/ccCsALhd.o a.cc:(.text+0x124): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccCsALhd.o /tmp/ccCsALhd.o: in function `main': a.cc:(.text+0x157): relocation truncated to fit: R_X86_64_PC32 against symbol `h' defined in .bss section in /tmp/ccCsALhd.o a.cc:(.text+0x169): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccCsALhd.o a.cc:(.text+0x175): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccCsALhd.o a.cc:(.text+0x17d): relocation truncated to fit: R_X86_64_PC32 against symbol `xs' defined in .bss section in /tmp/ccCsALhd.o a.cc:(.text+0x199): relocation truncated to fit: R_X86_64_PC32 against symbol `ys' defined in .bss section in /tmp/ccCsALhd.o a.cc:(.text+0x1ae): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s514088375
p00207
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s880364448
p00207
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s903855738
p00207
C++
#include<iostream> #include<algorithm> #include<vector> #include<string> #define ll long long #define loop(i,n) for (int i = 0; i < n; i++) #define loops(i,f,n) for (int i = (f); i < n; i++) #define INF 100000000000000 #define sort(a) sort(a.begin(),a.end()) #define rsort(a) sort(a.rbegin(),a.rend()) using namespace std; int w, h, sx, sy, gx, gy, n; vector <vector<int > > grid(105, vector<int>(105, 0)); vector <vector<bool > > grid_visited(105, vector<bool>(105, false)); void input(int c, int d, int x, int y) { if (d == 0)//yokonaga { loop(i, 2) { loop(j, 4) { grid[y + i][x + j] = c; } } } else//tatenaga { loop(i, 4) { loop(j, 2) { grid[y + i][x + j] = c; } } } } bool a = false; bool dfs(int nx, int ny) { if (nx == gx&&ny == gy)return true; if (nx < 0 || ny < 0 || nx >= h || ny >= w || grid[nx][ny] == 0 || grid_visited[nx][ny])return false; grid_visited[nx][ny] = true; if ((nx + 1) >= 0 && ny >= 0 && (nx + 1) < h && ny < w)if (grid[nx + 1][ny] == grid[nx][ny])a |= dfs(nx + 1, ny); if (nx >= 0 && (ny + 1) >= 0 && nx < h && (ny + 1) < w)if (grid[nx][ny + 1] == grid[nx][ny])a |= dfs(nx, ny + 1); if ((nx - 1) >= 0 && ny >= 0 && (nx - 1) < h && ny < w)if (grid[nx - 1][ny] == grid[nx][ny])a |= dfs(nx - 1, ny); if (nx >= 0 && (ny - 1) >= 0 && nx < h && (ny - 1) < w)if (grid[nx][ny - 1] == grid[nx][ny])a |= dfs(nx, ny - 1); //return (dfs(nx + 1, ny) || dfs(nx, ny + 1) || dfs(nx - 1, ny) || dfs(nx, ny - 1)); return a; return false; } int main() { while (1) { cin >> w >> h; if (!w && !h) break; else { cin >> sx >> sy >> gx >> gy >> n; sx--; sy--; gx--; gy--; loop(i, n) { int c, d, x, y; cin >> c >> d >> x >> y; x--; y--; input(c, d, x, y); } /*loop(i, h) { loop(j, w) { cout << grid[i][j] << " "; } cout << endl; }*/ grid = vector<vector<int> >(105, vector<int>(105, 0)); grid_visited = vector <vector<bool > > (105, vector<bool>(105, false)); a = false; cout << (dfs(sx, sy) ? "OK" : "NG") << endl; } } }#include<iostream> #include<algorithm> #include<vector> #include<string> #define ll long long #define loop(i,n) for (int i = 0; i < n; i++) #define loops(i,f,n) for (int i = (f); i < n; i++) #define INF 100000000000000 #define sort(a) sort(a.begin(),a.end()) #define rsort(a) sort(a.rbegin(),a.rend()) using namespace std; int w, h, sx, sy, gx, gy, n; vector <vector<int > > grid(105, vector<int>(105, 0)); vector <vector<bool > > grid_visited(105, vector<bool>(105, false)); void input(int c, int d, int x, int y) { if (d == 0)//yokonaga { loop(i, 2) { loop(j, 4) { grid[y + i][x + j] = c; } } } else//tatenaga { loop(i, 4) { loop(j, 2) { grid[y + i][x + j] = c; } } } } bool a = false; bool dfs(int nx, int ny) { if (nx == gx&&ny == gy)return true; if (nx < 0 || ny < 0 || nx >= h || ny >= w || grid[nx][ny] == 0 || grid_visited[nx][ny])return false; grid_visited[nx][ny] = true; if ((nx + 1) >= 0 && ny >= 0 && (nx + 1) < h && ny < w)if (grid[nx + 1][ny] == grid[nx][ny])a |= dfs(nx + 1, ny); if (nx >= 0 && (ny + 1) >= 0 && nx < h && (ny + 1) < w)if (grid[nx][ny + 1] == grid[nx][ny])a |= dfs(nx, ny + 1); if ((nx - 1) >= 0 && ny >= 0 && (nx - 1) < h && ny < w)if (grid[nx - 1][ny] == grid[nx][ny])a |= dfs(nx - 1, ny); if (nx >= 0 && (ny - 1) >= 0 && nx < h && (ny - 1) < w)if (grid[nx][ny - 1] == grid[nx][ny])a |= dfs(nx, ny - 1); //return (dfs(nx + 1, ny) || dfs(nx, ny + 1) || dfs(nx - 1, ny) || dfs(nx, ny - 1)); return a; return false; } int main() { while (1) { cin >> w >> h; if (!w && !h) break; else { cin >> sx >> sy >> gx >> gy >> n; sx--; sy--; gx--; gy--; loop(i, n) { int c, d, x, y; cin >> c >> d >> x >> y; x--; y--; input(c, d, x, y); } /*loop(i, h) { loop(j, w) { cout << grid[i][j] << " "; } cout << endl; }*/ grid = vector<vector<int> >(105, vector<int>(105, 0)); grid_visited = vector <vector<bool > > (105, vector<bool>(105, false)); a = false; cout << (dfs(sx, sy) ? "OK" : "NG") << endl; } } }
a.cc:85:2: error: stray '#' in program 85 | }#include<iostream> | ^ a.cc:85:3: error: 'include' does not name a type 85 | }#include<iostream> | ^~~~~~~ a.cc:96:5: error: redefinition of 'int w' 96 | int w, h, sx, sy, gx, gy, n; | ^ a.cc:12:5: note: 'int w' previously declared here 12 | int w, h, sx, sy, gx, gy, n; | ^ a.cc:96:8: error: redefinition of 'int h' 96 | int w, h, sx, sy, gx, gy, n; | ^ a.cc:12:8: note: 'int h' previously declared here 12 | int w, h, sx, sy, gx, gy, n; | ^ a.cc:96:11: error: redefinition of 'int sx' 96 | int w, h, sx, sy, gx, gy, n; | ^~ a.cc:12:11: note: 'int sx' previously declared here 12 | int w, h, sx, sy, gx, gy, n; | ^~ a.cc:96:15: error: redefinition of 'int sy' 96 | int w, h, sx, sy, gx, gy, n; | ^~ a.cc:12:15: note: 'int sy' previously declared here 12 | int w, h, sx, sy, gx, gy, n; | ^~ a.cc:96:19: error: redefinition of 'int gx' 96 | int w, h, sx, sy, gx, gy, n; | ^~ a.cc:12:19: note: 'int gx' previously declared here 12 | int w, h, sx, sy, gx, gy, n; | ^~ a.cc:96:23: error: redefinition of 'int gy' 96 | int w, h, sx, sy, gx, gy, n; | ^~ a.cc:12:23: note: 'int gy' previously declared here 12 | int w, h, sx, sy, gx, gy, n; | ^~ a.cc:96:27: error: redefinition of 'int n' 96 | int w, h, sx, sy, gx, gy, n; | ^ a.cc:12:27: note: 'int n' previously declared here 12 | int w, h, sx, sy, gx, gy, n; | ^ a.cc:97:24: error: redefinition of 'std::vector<std::vector<int> > grid' 97 | vector <vector<int > > grid(105, vector<int>(105, 0)); | ^~~~ a.cc:13:24: note: 'std::vector<std::vector<int> > grid' previously declared here 13 | vector <vector<int > > grid(105, vector<int>(105, 0)); | ^~~~ a.cc:98:25: error: redefinition of 'std::vector<std::vector<bool> > grid_visited' 98 | vector <vector<bool > > grid_visited(105, vector<bool>(105, false)); | ^~~~~~~~~~~~ a.cc:14:25: note: 'std::vector<std::vector<bool> > grid_visited' previously declared here 14 | vector <vector<bool > > grid_visited(105, vector<bool>(105, false)); | ^~~~~~~~~~~~ a.cc:99:6: error: redefinition of 'void input(int, int, int, int)' 99 | void input(int c, int d, int x, int y) | ^~~~~ a.cc:15:6: note: 'void input(int, int, int, int)' previously defined here 15 | void input(int c, int d, int x, int y) | ^~~~~ a.cc:122:6: error: redefinition of 'bool a' 122 | bool a = false; | ^ a.cc:38:6: note: 'bool a' previously defined here 38 | bool a = false; | ^ a.cc:123:6: error: redefinition of 'bool dfs(int, int)' 123 | bool dfs(int nx, int ny) | ^~~ a.cc:39:6: note: 'bool dfs(int, int)' previously defined here 39 | bool dfs(int nx, int ny) | ^~~ a.cc:136:5: error: redefinition of 'int main()' 136 | int main() | ^~~~ a.cc:52:5: note: 'int main()' previously defined here 52 | int main() | ^~~~
s656440694
p00207
C++
#include <iostream> using namespace std; int F[102][102]; int xg,yg; int flag = 0; void DFS(int Y,int X,int c){ if(F[Y][X]!=c){ return 0; } if(Y == xg && X == yg){ flag = 1; } F[Y][X] = 0; DFS(Y-1,X ,c); //DFS(Y-1,X+1,c); DFS(Y ,X+1,c); //DFS(Y+1,X+1,c); DFS(Y+1,X ,c); //DFS(Y+1,X-1,c); DFS(Y ,X-1,c); //DFS(Y-1,X-1,c); } int main(){ int w,h,xs,ys,n; cin >> w >> h >> xs >> ys >> xg >> yg >> n; for(int i=0;i<n;i++){ int c,d,x,y; cin >> c >> d >> x >> y; if(d == 0){ for(int j=0;j<4;j++){ F[x+j][y] = c; F[x+j][y+1] = c; } } else { for(int j=0;j<4;j++){ F[x][y+j] = c; F[x+1][y+j] = c; } } } DFS(xs,ys,F[xs][ys]); if(flag == 1){ cout << "OK" << endl; } else { cout << "NG" <<endl; } }
a.cc: In function 'void DFS(int, int, int)': a.cc:10:12: error: return-statement with a value, in function returning 'void' [-fpermissive] 10 | return 0; | ^
s498071429
p00207
C++
#include <iostream> using namespace std; int F[102][102]; int xg,yg; int flag = 0; void DFS(int Y,int X,int c){ if(F[Y][X]!=c){ return; } if(Y == xg && X == yg){ flag = 1; } F[Y][X] = 0; DFS(Y-1,X ,c); //DFS(Y-1,X+1,c); DFS(Y ,X+1,c); //DFS(Y+1,X+1,c); DFS(Y+1,X ,c); //DFS(Y+1,X-1,c); DFS(Y ,X-1,c); //DFS(Y-1,X-1,c); } int main(){ int w,h,xs,ys,n; cin >> w >> h >> xs >> ys >> xg >> yg >> n; for(int i=0;i<n;i++){ int c,d,x,y; cin >> c >> d >> x >> y; if(d == 0){ for(int j=0;j<4;j++){ F[x+j][y] = c; F[x+j][y+1] = c; } } else {#include <iostream> using namespace std; int F[102][102]; int xg,yg; int flag = 0; void DFS(int Y,int X,int c){ if(F[Y][X]!=c){ return 0; } if(Y == xg && X == yg){ flag = 1; } F[Y][X] = 0; DFS(Y-1,X ,c); //DFS(Y-1,X+1,c); DFS(Y ,X+1,c); //DFS(Y+1,X+1,c); DFS(Y+1,X ,c); //DFS(Y+1,X-1,c); DFS(Y ,X-1,c); //DFS(Y-1,X-1,c); } int main(){ int w,h,xs,ys,n; cin >> w >> h >> xs >> ys >> xg >> yg >> n; for(int i=0;i<n;i++){ int c,d,x,y; cin >> c >> d >> x >> y; if(d == 0){ for(int j=0;j<4;j++){ F[x+j][y] = c; F[x+j][y+1] = c; } } else { for(int j=0;j<4;j++){ F[x][y+j] = c; F[x+1][y+j] = c; } } } DFS(xs,ys,F[xs][ys]); if(flag == 1){ cout << "OK" << endl; } else { cout << "NG" <<endl; } } for(int j=0;j<4;j++){ F[x][y+j] = c; F[x+1][y+j] = c; } } } DFS(xs,ys,F[xs][ys]); if(flag == 1){ cout << "OK" << endl; } else { cout << "NG" <<endl; } }
a.cc:39:13: error: stray '#' in program 39 | } else {#include <iostream> | ^ a.cc: In function 'int main()': a.cc:39:14: error: 'include' was not declared in this scope 39 | } else {#include <iostream> | ^~~~~~~ a.cc:39:31: error: expected primary-expression before '>' token 39 | } else {#include <iostream> | ^ a.cc:40:1: error: expected primary-expression before 'using' 40 | using namespace std; | ^~~~~ a.cc:46:28: error: a function-definition is not allowed here before '{' token 46 | void DFS(int Y,int X,int c){ | ^ a.cc:66:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 66 | int main(){ | ^~ a.cc:66:9: note: remove parentheses to default-initialize a variable 66 | int main(){ | ^~ | -- a.cc:66:9: note: or replace parentheses with braces to value-initialize a variable a.cc:66:11: error: a function-definition is not allowed here before '{' token 66 | int main(){ | ^
s793727403
p00207
C++
#include <iostream> using namespace std; int F[102][102]; bool DFS(int Y, int X, int C, int yg, int xg) { if(Y == yg && X == xg) return true; if(F[Y][X]!=C) return false; F[Y][X] = 0; bool tmp = 0; tmp += DFS(Y-1, X, C, yg, xg); tmp += DFS(Y+1, X, C, yg, xg); tmp += DFS(Y, X-1, C, yg, xg); tmp += DFS(Y, X+1, C, yg, xg); return tmp; } int main() { while(1){ F[102][102] = {} int w, h; cin >> w >> h; if(w == 0 && h == 0) return 0; int xs, ys; cin >> xs >> ys; int xg, yg; cin >> xg >> yg; int n; cin >> n; int c, d, x, y; for(int i=0; i<n; i++){ cin >> c >> d >> x >> y; if(d == 0) for(int j=0; j<2; j++) for(int k=0; k<4; k++) F[y+j][x+k] = c; else for(int j=0; j<4; j++) for(int k=0; k<2; k++) F[y+j][x+k] = c; } bool res = DFS(ys, xs, F[ys][xs], yg, xg); if(res) cout << "OK" << endl; else cout << "NG" << endl; } }
a.cc: In function 'int main()': a.cc:26:21: error: expected ';' before 'int' 26 | F[102][102] = {} | ^ | ; 27 | 28 | int w, h; | ~~~ a.cc:29:12: error: 'w' was not declared in this scope 29 | cin >> w >> h; | ^ a.cc:29:17: error: 'h' was not declared in this scope 29 | cin >> w >> h; | ^
s659140428
p00207
C++
#include <iostream> using namespace std; int F[105][105]; int xg,yg; void DFS(int Y,int X,int c){ if(F[Y][X] != c){ return; } F[Y][X] = -1; DFS(Y-1,X ,c); DFS(Y ,X+1,c); DFS(Y+1,X ,c); DFS(Y ,X-1,c); } int main(){ int w,h,xs,ys,n; while(1){ cin >> w >> h; if(w == 0 && h == 0) break; for(int i=0;i<105;i++){ for(int j=0;j<105;j++){ F[i][j]=0 } } cin >> xs >> ys >> xg >> yg >> n; for(int i=0;i<n;i++){ int c,d,x,y; cin >> c >> d >> x >> y; if(d == 0){ for(int j=0;j<4;j++){ F[x+j][y] = c; F[x+j][y+1] = c; } } else { for(int j=0;j<4;j++){ F[x][y+j] = c; F[x+1][y+j] = c; } } } DFS(xs,ys,F[xs][ys]); if(F[xg][yg] == -1){ cout << "OK" << endl; } else { cout << "NG" <<endl; } } }
a.cc: In function 'int main()': a.cc:30:26: error: expected ';' before '}' token 30 | F[i][j]=0 | ^ | ; 31 | } | ~
s281557462
p00207
C++
#include <iostream> using namespace std;
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s140961469
p00207
C++
#include <iostream> using namespace std; int F[105][105]; void DFS(int Y,int X,int c){ if(F[Y][X] != c){ return; } F[Y][X] = -1; DFS(Y-1,X ,c); DFS(Y ,X+1,c); DFS(Y+1,X ,c); DFS(Y ,X-1,c); } int main(){ int w,h,xs,ys,xgyg,n; while(1){ cin >> w >> h; if(w == 0 && h == 0) break; for(int i=0;i<105;i++){ for(int j=0;j<105;j++){ F[i][j]=0; } } cin >> xs >> ys >> xg >> yg >> n; for(int i=0;i<n;i++){ int c,d,x,y; cin >> c >> d >> x >> y; if(d == 0){ for(int j=0;j<4;j++){ F[x+j][y] = c; F[x+j][y+1] = c; } } else { for(int j=0;j<4;j++){ F[x][y+j] = c; F[x+1][y+j] = c; } } } DFS(xs,ys,F[xs][ys]); if(F[xg][yg] == -1){ cout << "OK" << endl; } else { cout << "NG" <<endl; } } }
a.cc: In function 'int main()': a.cc:32:24: error: 'xg' was not declared in this scope; did you mean 'xs'? 32 | cin >> xs >> ys >> xg >> yg >> n; | ^~ | xs a.cc:32:30: error: 'yg' was not declared in this scope; did you mean 'ys'? 32 | cin >> xs >> ys >> xg >> yg >> n; | ^~ | ys
s504671967
p00207
C++
#include <iostream> using namespace std; int F[102][102]; int DFS(int Y,int X,int c){ int cnt = 0; if(F[Y][X] != c){ return 0; } F[Y][X] = -1; cnt += DFS(Y-1,X ,c); cnt += DFS(Y ,X+1,c); cnt += DFS(Y+1,X ,c); cnt += DFS(Y ,X-1,c); return cnt; } int main(){ int w,h,xs,ys,xg,yg,n; while(1){ cin >> w >> h; if(w == 0 && h == 0) break; for(int i=0;i<102;i++){ for(int j=0;j<102;j++){ F[i][j]=0; } } cin >> xs >> ys >> xg >> yg >> n; for(int i=0;i<n;i++){ int c,d,x,y; cin >> c >> d >> x >> y; if(d == 0){ for(int j=0;j<4;j++){ F[x+j][y] = c; F[x+j][y+1] = c; } } else { for(int j=0;j<4;j++){ F[x][y+j] = c; F[x+1][y+j] = c; } } } DFS(xs,ys,F[xs][ys]) if(1){ cout << "OK" << endl; } else { cout << "NG" << endl; } } }
a.cc: In function 'int main()': a.cc:52:23: error: expected ';' before 'if' 52 | DFS(xs,ys,F[xs][ys]) | ^ | ; 53 | if(1){ | ~~ a.cc:55:5: error: 'else' without a previous 'if' 55 | } else { | ^~~~
s303066708
p00207
C++
#include <iostream> using namespace std; int F[102][102]; int DFS(int Y,int X,int c){ int cnt = 0; if(F[Y][X] != c){ return 0; } F[Y][X] = -1; cnt += DFS(Y-1,X ,c); cnt += DFS(Y ,X+1,c); cnt += DFS(Y+1,X ,c); cnt += DFS(Y ,X-1,c); return cnt; } int main(){ int w,h,xs,ys,xg,yg,n; while(1){ cin >> w >> h; if(w == 0 && h == 0) break; for(int i=0;i<102;i++){ for(int j=0;j<102;j++){ F[i][j]=0; } } cin >> xs >> ys >> xg >> yg >> n; for(int i=0;i<n;i++){ int c,d,x,y; cin >> c >> d >> x >> y; if(d == 0){ for(int j=0;j<4;j++){ F[x+j][y] = c; F[x+j][y+1] = c; } } else { for(int j=0;j<4;j++){ F[x][y+j] = c; F[x+1][y+j] = c; } } } DFS(xs,ys,F[xs][ys]) if(x == 8){ cout << "OK" << endl; } else { cout << "NG" << endl; } } }
a.cc: In function 'int main()': a.cc:52:23: error: expected ';' before 'if' 52 | DFS(xs,ys,F[xs][ys]) | ^ | ; 53 | if(x == 8){ | ~~ a.cc:55:5: error: 'else' without a previous 'if' 55 | } else { | ^~~~
s218683590
p00207
C++
#include <iostream> using namespace std; int F[102][102]; int DFS(int Y,int X,int c){ int cnt = 0; if(F[Y][X] != c){ return 0; } F[Y][X] = -1; cnt += DFS(Y-1,X ,c); cnt += DFS(Y ,X+1,c); cnt += DFS(Y+1,X ,c); cnt += DFS(Y ,X-1,c); return cnt; } int main(){ int w,h,xs,ys,xg,yg,n; while(1){ cin >> w >> h; if(w == 0 && h == 0) break; for(int i=0;i<102;i++){ for(int j=0;j<102;j++){ F[i][j]=0; } } cin >> xs >> ys >> xg >> yg >> n; for(int i=0;i<n;i++){ int c,d,x,y; cin >> c >> d >> x >> y; if(d == 0){ for(int j=0;j<4;j++){ F[x+j][y] = c; F[x+j][y+1] = c; } } else { for(int j=0;j<4;j++){ F[x][y+j] = c; F[x+1][y+j] = c; } } } DFS(xs,ys,F[xs][ys]); if(x == 8){ cout << "OK" << endl; } else { cout << "NG" << endl; } } }
a.cc: In function 'int main()': a.cc:53:6: error: 'x' was not declared in this scope 53 | if(x == 8){ | ^
s209043774
p00207
C++
#include <iostream> using namespace std; int C[102][102]; int ans; int xg,yg; void meiro(int W,int H,int c){ if(W==xg && H==yg){ ans = 1; return; } if(C[W][H]!=c){ return; } C[W][H] = '.'; meiro(W-1,H ,c); meiro(W ,H+1,c); meiro(W+1,H ,c); meiro(W ,H-1,c); } int main(){ while(1){ int w,h; cin >> w >> h; if(w==0 && h==0){ break; } int xs,ys; cin >> xs >> ys; cin >> xg >> yg; int n; cin >> n; int c[n],d[n],x[n],y[n]; int cbase; for(int i=0;i<n;i++){ cin >> c[i] >> d[i] >> x[i] >> y[i]; if(d[i]==0){ for(int j=x[i];j<x[i]+4;j++){ for(int k=y[i];k<y[i]+2;k++){ C[j][k]=c[i]; } } } if(d[i]==1){ for(int j=x[i];j<x[i]+2;j++){ for(int k=y[i];k<y[i]+4;k++){ C[j][k]=c[i]; } } } if(x[i]==1 &&y[i]==1){ cbase = c[i]; } } ans = 0; if(cbasew == 0){ cout << "NG"<<endl; continue; } meiro(xs,ys,cbase); if(ans==1){ cout << "OK" << endl; }else{ cout << "NG" << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:70:4: error: 'cbasew' was not declared in this scope; did you mean 'cbase'? 70 | if(cbasew == 0){ | ^~~~~~ | cbase
s405045718
p00207
C++
include<iostream> using namespace std; struct board{ int mass[102][102]; }; bool goal_flag; void DFS(int x,int y,int gx,int gy,board b,int c){ if(b.mass[y][x]!=c)return; if(!b.mass[y][x])return; b.mass[y][x]=-1; if(x==gx&&y==gy)goal_flag=true; DFS(x+1,y,gx,gy,b,c); DFS(x-1,y,gx,gy,b,c); DFS(x,y+1,gx,gy,b,c); DFS(x,y-1,gx,gy,b,c); } int main(){ int h,w; int start_x,start_y; int goal_x,goal_y; int n; int c,d,x,y; while(1){ cin>>w>>h; if(w==0&&h==0)break; cin>>start_x>>start_y; cin>>goal_x>>goal_y; cin>>n; board b; for(int i=0;i<h+2;i++){ for(int j=0;j<w+2;j++){ b.mass[i][j]=0; } } for(int i=0;i<n;i++){ cin>>c>>d>>x>>y; for(int j=0;j<2;j++){ for(int k=0;k<4;k++){ if(d==0){b.mass[y+j][x+k]=c;} else if(d==1){b.mass[y+k][x+j]=c;} } } } goal_flag=false; DFS(start_x,start_y,goal_x,goal_y,b,b.mass[start_y][start_x]); if(goal_flag)cout<<"OK"; else cout<<"NG"; cout<<endl; } }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:27:5: error: 'cin' was not declared in this scope 27 | cin>>w>>h; | ^~~ a.cc:51:18: error: 'cout' was not declared in this scope 51 | if(goal_flag)cout<<"OK"; | ^~~~ a.cc:52:10: error: 'cout' was not declared in this scope 52 | else cout<<"NG"; | ^~~~ a.cc:53:5: error: 'cout' was not declared in this scope 53 | cout<<endl; | ^~~~ a.cc:53:11: error: 'endl' was not declared in this scope 53 | cout<<endl; | ^~~~
s350046923
p00207
C++
#include <iostream> using namespace std; int C[102][102]; int ans; int xg,yg; void meiro(int W,int H,int c){ if(W==xg && H==yg){ ans = 1; return; } if(C[W][H]!=c){ return; } C[W][H] = '.'; meiro(W-1,H ,c); meiro(W ,H+1,c); meiro(W+1,H ,c); meiro(W ,H-1,c); } int main(){ while(1){ int w,h; cin >> w >> h; for(int i=0;i<w;i++){ for(int j=0;j<h;j++){ C[i][j] = 0; } } if(w==0 && h==0){ break; } int xs,ys; cin >> xs >> ys; cin >> xg >> yg; int n; cin >> n; int c[n],d[n],x[n],y[n]; int cbase; for(int i=0;i<n;i++){ cin >> c[i] >> d[i] >> x[i] >> y[i]; if(x[i]==xs &&y[i]==ys){ cbase = c[i]; } if(d[i]==0 && c[i]==cbase){ for(int j=x[i];j<x[i]+4;j++){ for(int k=y[i];k<y[i]+2;k++){ C[j][k]=c[i]; } } } if(d[i]==1 && c[i]==cbase){ for(int j=x[i];j<x[i]+2;j++){ for(int k=y[i];k<y[i]+4;k++){ C[j][k]=c[i]; } } } } ans = 0; meiro(xs,ys,cbase); if(ans == 1){ cout << "OK" << endl; } if(ans != 1 || c[xs][ys] == 0){ cout << "NG" << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:80:25: error: invalid types 'int[int]' for array subscript 80 | if(ans != 1 || c[xs][ys] == 0){ | ^
s711158644
p00207
C++
\#include <iostream> using namespace std; int F[105][105]; int xg,yg; void DFS(int Y,int X,int c){ if(F[Y][X] != c){ return; } F[Y][X] = -2000; DFS(Y-1,X ,c); DFS(Y ,X+1,c); DFS(Y+1,X ,c); DFS(Y ,X-1,c); } int main(){ int w,h,xs,ys,n; while(1){ cin >> w >> h; if(w == 0 && h == 0) break; cin >> xs >> ys >> xg >> yg >> n; int c[n],d[n],x[n],y[n],ca; for(int i=0;i<n;i++){ cin >> c[i] >> d[i] >> x[i] >> y[i]; } for(int i=0;i<n;i++){ if(c[i] == 0) ca = 10 else if(i == n-1) c = 0: } for(int i=0; i<102; i++){ for(int j=0; j<102; j++){ F[i][j]=ca; } } for(int i=0;i<n;i++){ if(d[i] == 0){ for(int j=0;j<4;j++){ F[x[i]+j][y[i]] = c[i]; F[x[i]+j][y[i]+1] = c[i]; } } else { for(int j=0;j<4;j++){ F[x[i]][y[i]+j] = c[i]; F[x[i]+1][y[i]+j] = c[i]; } } } DFS(xs,ys,F[xs][ys]); if(F[xg][yg] == -2000){ cout << "OK" << endl; } else { cout << "NG" <<endl; } } }
a.cc:1:1: error: stray '\' in program 1 | \#include <iostream> | ^ a.cc:1:2: error: stray '#' in program 1 | \#include <iostream> | ^ a.cc:1:3: error: 'include' does not name a type 1 | \#include <iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:24:5: error: 'cin' was not declared in this scope 24 | cin >> w >> h; | ^~~ a.cc:36:16: error: expected ';' before 'else' 36 | ca = 10 | ^ | ; 37 | else if(i == n-1) | ~~~~ a.cc:62:5: error: 'cout' was not declared in this scope 62 | cout << "OK" << endl; | ^~~~ a.cc:62:21: error: 'endl' was not declared in this scope 62 | cout << "OK" << endl; | ^~~~ a.cc:64:5: error: 'cout' was not declared in this scope 64 | cout << "NG" <<endl; | ^~~~ a.cc:64:20: error: 'endl' was not declared in this scope 64 | cout << "NG" <<endl; | ^~~~
s143841984
p00207
C++
#include <iostream> using namespace std; int F[105][105]; int xg,yg; void DFS(int Y,int X,int c){ if(F[Y][X] != c){ return; } F[Y][X] = -2000; DFS(Y-1,X ,c); DFS(Y ,X+1,c); DFS(Y+1,X ,c); DFS(Y ,X-1,c); } int main(){ int w,h,xs,ys,n; while(1){ cin >> w >> h; if(w == 0 && h == 0) break; cin >> xs >> ys >> xg >> yg >> n; int c[n],d[n],x[n],y[n],ca; for(int i=0;i<n;i++){ cin >> c[i] >> d[i] >> x[i] >> y[i]; } for(int i=0;i<n;i++){ if(c[i] == 0) ca = 10 else if(i == n-1) c = 0: } for(int i=0; i<102; i++){ for(int j=0; j<102; j++){ F[i][j]=ca; } } for(int i=0;i<n;i++){ if(d[i] == 0){ for(int j=0;j<4;j++){ F[x[i]+j][y[i]] = c[i]; F[x[i]+j][y[i]+1] = c[i]; } } else { for(int j=0;j<4;j++){ F[x[i]][y[i]+j] = c[i]; F[x[i]+1][y[i]+j] = c[i]; } } } DFS(xs,ys,F[xs][ys]); if(F[xg][yg] == -2000){ cout << "OK" << endl; } else { cout << "NG" <<endl; } } }
a.cc: In function 'int main()': a.cc:36:16: error: expected ';' before 'else' 36 | ca = 10 | ^ | ; 37 | else if(i == n-1) | ~~~~
s837009959
p00207
C++
#include <iostream> using namespace std; int F[105][105]; int xg,yg; void DFS(int Y,int X,int c){ if(F[Y][X] != c){ return; } F[Y][X] = -2000; DFS(Y-1,X ,c); DFS(Y ,X+1,c); DFS(Y+1,X ,c); DFS(Y ,X-1,c); } int main(){ int w,h,xs,ys,n; while(1){ cin >> w >> h; if(w == 0 && h == 0) break; cin >> xs >> ys >> xg >> yg >> n; int c[n],d[n],x[n],y[n],ca; for(int i=0;i<n;i++){ cin >> c[i] >> d[i] >> x[i] >> y[i]; } for(int i=0;i<n;i++){ if(c[i] == 0) ca = 10; else if(i == n-1) c = 0; } for(int i=0; i<102; i++){ for(int j=0; j<102; j++){ F[i][j]=ca; } } for(int i=0;i<n;i++){ if(d[i] == 0){ for(int j=0;j<4;j++){ F[x[i]+j][y[i]] = c[i]; F[x[i]+j][y[i]+1] = c[i]; } } else { for(int j=0;j<4;j++){ F[x[i]][y[i]+j] = c[i]; F[x[i]+1][y[i]+j] = c[i]; } } } DFS(xs,ys,F[xs][ys]); if(F[xg][yg] == -2000){ cout << "OK" << endl; } else { cout << "NG" <<endl; } } }
a.cc: In function 'int main()': a.cc:38:11: error: incompatible types in assignment of 'int' to 'int [n]' 38 | c = 0; | ~~^~~
s199482843
p00207
C++
#include <iostream> using namespace std; int F[105][105]; int xg,yg,w,h; void DFS(int Y,int X,int c){ if(F[Y][X] != c){ return; } F[Y][X] = -1; DFS(Y+1,X ,c); DFS(Y-1 ,X,c); DFS(Y,X+1 ,c); DFS(Y ,X-1,c); } int main(){ int xs,ys,n; while(1){ cin >> w >> h; if(w == 0 && h == 0) break; for(int i=0; i<105; i++){ for(int j=0; j<105; j++){ F[i][j] = 10; } } cin >> xs >> ys >> xg >> yg >> n; for(int i=0;i<n;i++){ int c,d,x,y; cin >> c >> d >> x >> y; if(d == 0){ for(int j=0;j<4;j++){ F[x+j][y] = c; F[x+j][y+1] = c; } } else { for(int j=0;j<4;j++){ F[x][y+j] = c; F[x+1][y+j] = c; } } } if(F[xs][ys] == 10){ cout << "NG" << endl; continue; DFS(xs,ys,F[xs][ys]); if(F[xg][yg] == -1){ cout << "OK" << endl; } else { cout << "NG" <<endl; } } }
a.cc: In function 'int main()': a.cc:63:2: error: expected '}' at end of input 63 | } | ^ a.cc:21:11: note: to match this '{' 21 | int main(){ | ^
s783050159
p00207
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s606864832
p00207
C++
#include<iostream> using namespace std; char F[102][102]; void DFS(int x,int y,char c){ if(F[x][y]!=c) return; F[x][y]='@'; DFS(x-1,y,c); DFS(x,y+1,c); DFS(x+1,y,c); DFS(x,y-1,c); } void Block(int c,int d,int x,int y){ char b; if(c=0) b='+'; if(c=1) b='-'; if(c=2) b='*'; if(c=3) b='/'; F[x][y]=b; F[x][y+1]=b; F[x+1][y]=b; F[x+1][y+1]=b; if(d==1){ F[x][y+2]=b; F[x][y+3]=b; F[x+1][y+2]=b; F[x+1][y+3]=b; }else{ F[x+2][y]=b; F[x+2][y+1]=b; F[x+3][y]=b; F[x+3][y+1]=b; } } int main(){ int w=1,h; int xs,ys; int xg,yg; int n; int c,d,x,y; while(w>0){ cin>>w>>h; if(w==0&&h==0) break; for(int i=0;i<w;i++){ for(int j=0;j<h;j++){ F[i][j]='.'; } } cin>>xs>>ys; cin>>xg>>yg; cin>>n; for(int i=0;i<n;i++){ cin>>c>>d>>x>>y; Block(c,d,x,y); } DFS(xs,yscout<<endl;,F[xs][ys]); if(F[xg][yg]=='@') cout<<"OK"<<endl; else cout<<"NG"<<endl; } }
a.cc: In function 'int main()': a.cc:64:12: error: 'yscout' was not declared in this scope 64 | DFS(xs,yscout<<endl;,F[xs][ys]); | ^~~~~~ a.cc:64:25: error: expected primary-expression before ',' token 64 | DFS(xs,yscout<<endl;,F[xs][ys]); | ^
s066237023
p00207
C++
#include<stdio.h> #include<windows.h> int main(void) { int w,h; int map[101][101]; int st[2],go[2]; int i,j,k,l,m; int num; int b_c,b_ang,b_x,b_y; int sign; int ans; for(;;) { ans=0; for(i=0;i<100;i++) { for(j=0;j<100;j++) map[i][j]=0; } scanf("%d%d",&w,&h); if(w==0 && h==0) break; scanf("%d%d%d%d",&st[0],&st[1],&go[0],&go[1]); scanf("%d",&num); for(i=0;i<num;i++) { scanf("%d%d%d%d",&b_c,&b_ang,&b_x,&b_y); if(b_ang==0) { for(j=0;j<4;j++) { for(k=0;k<2;k++) map[b_x+j][b_y+k]=b_c; } } else { for(j=0;j<4;j++) { for(k=0;k<2;k++) map[b_x+k][b_y+j]=b_c; } } } if(map[st[0]][st[1]]==0 || map[go[0]][go[1]]==0) printf("NG"); else { sign=map[st[0]][st[1]]; for(i=0;i<w;i++) { for(j=0;j<h;j++) { if(map[i][j]!=sign) map[i][j]=0; } } map[st[0]][st[1]]=-1; map[go[0]][go[1]]=-2; for(i=st[0],j=st[1];;) { /* for(l=0;l<h;l++) { for(m=0;m<w;m++) { printf("%d ",map[l][m]); } printf("%dツ行\n",l); } getchar(); system("cls"); */ if(map[i+1][j]==-2 || map[i][j+1]==-2 || map[i-1][j]==-2 || map[i][j-1]==-2) { ans=1; break; } else if(map[i-1][j]!=0 && map[i][j-1]!=0 && map[i+1][j]!=0 && map[i][j+1]!=0) { if(map[i+1][j]==sign) { map[i][j]=7; i++; } else if(map[i][j+1]==sign) { map[i][j]=7; j++; } else if(map[i-1][j]==sign) { map[i][j]=7; i--; } else if(map[i][j-1]==sign) { map[i][j]=7; j--; } } else if(map[i+1][j]==sign/* && map[i][j-1]!=sign*/)//ツ右 { // printf("migi\n"); map[i][j]=7; i++; } else if(/*map[i+1][j]!=sign && */map[i][j+1]==sign)//ツ可コ { // printf("sita1\n"); map[i][j]=7; j++; } else if(map[i-1][j]==sign/* && map[i][j+1]!=sign*/)//ツ債カ { // printf("hidari\n"); map[i][j]=7; i--; } else if(/*map[i+1][j]!=sign && */map[i][j-1]==sign)//ツ湘」 { // printf("ue1\n"); map[i][j]=7; j--; } else if(/*map[i-1][j]!=sign && */map[i][j+1]==sign)//ツ可コ { // printf("sita2\n"); map[i][j]=7; j++; } else if(map[i-1][j]!=sign && map[i][j-1]==sign)//ツ湘」 { // printf("ue2\n"); map[i][j]=7; j--; } else if(map[i+1][j]!=sign && map[i][j+1]!=sign && map[i-1][j]!=sign && map[i][j-1]!=sign) { ans=2; break; } } if(ans==1) printf("OK"); else if(ans==2) printf("NG"); } } }
a.cc:2:9: fatal error: windows.h: No such file or directory 2 | #include<windows.h> | ^~~~~~~~~~~ compilation terminated.