submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s093694134
p00067
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList al2 = new ArrayList(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(al3); //al.add(a); } for(int i=0;i<al2.size();i++){ for(int j=0;j<12;j++){ for(int k=0;k<12;k++){ System.out.print(al2.get(i).get(trans(j,k))); } System.out.println(); } System.out.println("\n"); } int num; int cl; int yn; for(int r=0;r<al2.size();r++){ al = al2.get(r); num = 0; for(int i=0;i<12;i++){ cl = -1; for(int j=0;j<12;j++){ if(al.get(trans(i,j)) == 1){ /*try{ if(al.get(trans(i,j)) == 1){ al2.set(trans(i,j), al2.get(trans(i,j)) + 1); } }catch(IndexOutOfBoundsException e){ } try{ if(al.get(trans(i-1,j)) == 1){ al2.set(trans(i,j), al2.get(trans(i,j)) + 1); } }catch(IndexOutOfBoundsException e){ } try{ if(al.get(trans(i,j-1)) == 1){ al2.set(trans(i,j), al2.get(trans(i,j)) + 1); } }catch(IndexOutOfBoundsException e){ } try{ if(al.get(trans(i+1,j)) == 1){ al2.set(trans(i,j), al2.get(trans(i,j)) + 1); } }catch(IndexOutOfBoundsException e){ } try{ if(al.get(trans(i,j+1)) == 1){ al2.set(trans(i,j), al2.get(trans(i,j)) + 1); } }catch(IndexOutOfBoundsException e){ } if(al2.get(trans(i,j)) == 0){ num++; }*/ if(j == 0 || al.get(trans(i,j-1)) == 0){ lsf.add(j); lsl.add(j); lsn.add(1); cl++; dead.add(0); } try{ if(j <= 10 && al.get(trans(i,j+1)) == 1){ lsl.set(cl,j+1); } }catch(IndexOutOfBoundsException e){ } } } if(i != 0){ for(int q=0;q<lsf2.size();q++){ yn = 0; for(int w=0;w<lsf.size();w++){ if((lsf2.get(q) <= lsf.get(w) && lsl.get(w) <= lsl2.get(q)) ||(lsf.get(w) <= lsf2.get(q) && lsl2.get(q) <= lsl.get(w))){ yn++; dead.set(w, dead.get(w) + 1); if(dead.get(w) < 2){ if(yn >= 2){ lsn.set(w, 2); } if(lsn2.get(q) == 2){ lsn.set(w, 2); } } } } if(yn == 0 && lsn2.get(q) != 2){ num++; } } } if(i == 11){ for(int q=0;q<lsf.size();q++){ if(lsn.get(q) != 2){ num++; } if( lsn.get(q) == 2 && dead.get(q) != 1){ num++; } } } lsf2.clear(); lsl2.clear(); lsn2.clear(); dead.clear(); for(int q=0;q<lsf.size();q++){ lsf2.add(lsf.get(q)); lsl2.add(lsl.get(q)); lsn2.add(lsn.get(q)); } lsf.clear(); lsl.clear(); lsn.clear(); } System.out.println(num); } } public static int trans(int h,int w){ int ret = 0; ret = h*12+w; return ret; } }
Main.java:71: error: cannot find symbol System.out.print(al2.get(i).get(trans(j,k))); ^ symbol: method get(int) location: class Object Main.java:83: error: incompatible types: Object cannot be converted to ArrayList<Integer> al = al2.get(r); ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors
s674540437
p00067
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class aoj06 { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(al3); //al.add(a); } for(int i=0;i<al2.size();i++){ for(int j=0;j<12;j++){ for(int k=0;k<12;k++){ System.out.print(al2.get(i).get(trans(j,k))); } System.out.println(); } System.out.println("\n"); } } public static int trans(int h,int w){ int ret = 0; ret = h*12+w; return ret; } }
Main.java:8: error: class aoj06 is public, should be declared in a file named aoj06.java public class aoj06 { ^ 1 error
s228167710
p00067
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class aoj06 { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(al3); //al.add(a); } } public static int trans(int h,int w){ int ret = 0; ret = h*12+w; return ret; } }
Main.java:8: error: class aoj06 is public, should be declared in a file named aoj06.java public class aoj06 { ^ 1 error
s934631605
p00067
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class aoj06 { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(al3); //al.add(a); } } }
Main.java:8: error: class aoj06 is public, should be declared in a file named aoj06.java public class aoj06 { ^ 1 error
s669657734
p00067
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class aoj06 { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d=0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(al3); //al.add(a); } } }
Main.java:8: error: class aoj06 is public, should be declared in a file named aoj06.java public class aoj06 { ^ 1 error
s341653086
p00067
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(al3); } }
Main.java:67: error: reached end of file while parsing } ^ 1 error
s330785851
p00067
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(al3); //al.add(a); } for(int i=0;i<al2.size();i++){ for(int j=0;j<12;j++){ for(int k=0;k<12;k++){ System.out.print(al2.get(i).get(trans(j,k))); } System.out.println(); } System.out.println("\n"); } } }
Main.java:71: error: cannot find symbol System.out.print(al2.get(i).get(trans(j,k))); ^ symbol: method trans(int,int) location: class Main 1 error
s938743803
p00067
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class aoj06 { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(al3); //al.add(a); } for(int i=0;i<al2.size();i++){ for(int j=0;j<12;j++){ for(int k=0;k<12;k++){ System.out.print(al2.get(i).get(trans(j,k))); } System.out.println(); } System.out.println("\n"); } int num; int cl; int yn; for(int r=0;r<al2.size();r++){ al = al2.get(r); num = 0; for(int i=0;i<12;i++){ cl = -1; for(int j=0;j<12;j++){ if(al.get(trans(i,j)) == 1){ if(j == 0 || al.get(trans(i,j-1)) == 0){ lsf.add(j); lsl.add(j); lsn.add(1); cl++; dead.add(0); } try{ if(j <= 10 && al.get(trans(i,j+1)) == 1){ lsl.set(cl,j+1); } }catch(IndexOutOfBoundsException e){ } } } if(i != 0){ for(int q=0;q<lsf2.size();q++){ yn = 0; for(int w=0;w<lsf.size();w++){ if((lsf2.get(q) <= lsf.get(w) && lsl.get(w) <= lsl2.get(q)) ||(lsf.get(w) <= lsf2.get(q) && lsl2.get(q) <= lsl.get(w))){ yn++; dead.set(w, dead.get(w) + 1); if(dead.get(w) < 2){ if(yn >= 2){ lsn.set(w, 2); } if(lsn2.get(q) == 2){ lsn.set(w, 2); } } } } if(yn == 0 && lsn2.get(q) != 2){ num++; } } } if(i == 11){ for(int q=0;q<lsf.size();q++){ if(lsn.get(q) != 2){ num++; } if( lsn.get(q) == 2 && dead.get(q) != 1){ num++; } } } lsf2.clear(); lsl2.clear(); lsn2.clear(); dead.clear(); for(int q=0;q<lsf.size();q++){ lsf2.add(lsf.get(q)); lsl2.add(lsl.get(q)); lsn2.add(lsn.get(q)); } lsf.clear(); lsl.clear(); lsn.clear(); } System.out.println(num); } } public static int trans(int h,int w){ int ret = 0; ret = h*12+w; return ret; } }
Main.java:8: error: class aoj06 is public, should be declared in a file named aoj06.java public class aoj06 { ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s739311635
p00067
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(al3); //al.add(a); } for(int i=0;i<al2.size();i++){ for(int j=0;j<12;j++){ for(int k=0;k<12;k++){ System.out.print(al2.get(i).get(trans(j,k))); } System.out.println(); } System.out.println("\n"); } } } public static int trans(int h,int w){ int ret = 0; ret = h*12+w; return ret; } }
Main.java:80: error: unnamed classes are a preview feature and are disabled by default. public static int trans(int h,int w){ ^ (use --enable-preview to enable unnamed classes) Main.java:90: error: class, interface, enum, or record expected } ^ 2 errors
s067037164
p00067
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class aoj06 { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(al3); //al.add(a); } for(int i=0;i<al2.size();i++){ for(int j=0;j<12;j++){ for(int k=0;k<12;k++){ System.out.print(al2.get(i).get(trans(j,k))); } System.out.println(); } System.out.println("\n"); } } public static int trans(int h,int w){ int ret = 0; ret = h*12+w; return ret; } }
Main.java:8: error: class aoj06 is public, should be declared in a file named aoj06.java public class aoj06 { ^ 1 error
s437961772
p00067
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class aoj06 { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(al3); } } public static int trans(int h,int w){ int ret = 0; ret = h*12+w; return ret; } }
Main.java:8: error: class aoj06 is public, should be declared in a file named aoj06.java public class aoj06 { ^ 1 error
s797213937
p00067
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class aoj06 { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } al2.add(al3); } } public static int trans(int h,int w){ int ret = 0; ret = h*12+w; return ret; } }
Main.java:8: error: class aoj06 is public, should be declared in a file named aoj06.java public class aoj06 { ^ 1 error
s016999301
p00067
Java
package aoj; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class aoj06 { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<ArrayList> al2 = new ArrayList<ArrayList>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ ArrayList<Integer> al3 = new ArrayList<Integer>(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ al3.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } } } public static int trans(int h,int w){ int ret = 0; ret = h*12+w; return ret; } }
Main.java:8: error: class aoj06 is public, should be declared in a file named aoj06.java public class aoj06 { ^ 1 error
s850462953
p00067
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<tyu> al2 = new ArrayList<tyu>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ tyu io = new tyu(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ io.t.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(io); //al.add(a); } /*for(int i=0;i<al2.size();i++){ for(int j=0;j<12;j++){ for(int k=0;k<12;k++){ System.out.print(al2.get(i).get(trans(j,k))); } System.out.println(); } System.out.println("\n"); }*/ int num; int cl; int yn; for(int r=0;r<al2.size();r++){ al = al2.get(r).t; num = 0; for(int i=0;i<12;i++){ cl = -1; for(int j=0;j<12;j++){ if(al.get(trans(i,j)) == 1){ if(j == 0 || al.get(trans(i,j-1)) == 0){ lsf.add(j); lsl.add(j); lsn.add(1); cl++; dead.add(0); } try{ if(j <= 10 && al.get(trans(i,j+1)) == 1){ lsl.set(cl,j+1); } }catch(IndexOutOfBoundsException e){ } } } if(i != 0){ for(int q=0;q<lsf2.size();q++){ yn = 0; for(int w=0;w<lsf.size();w++){ if((lsf2.get(q) <= lsf.get(w) && lsl.get(w) <= lsl2.get(q)) ||(lsf.get(w) <= lsf2.get(q) && lsl2.get(q) <= lsl.get(w))){ yn++; dead.set(w, dead.get(w) + 1); if(dead.get(w) < 2){ if(yn >= 2){ lsn.set(w, 2); } if(lsn2.get(q) == 2){ lsn.set(w, 2); } } } } if(yn == 0 && lsn2.get(q) != 2){ num++; } } } }}}} } System.out.println(num); } } public static int trans(int h,int w){ int ret = 0; ret = h*12+w; return ret; } } class tyu{ ArrayList<Integer> t = new ArrayList<Integer>(); }
Main.java:135: error: class, interface, enum, or record expected } ^ Main.java:139: error: class, interface, enum, or record expected } ^ Main.java:142: error: unnamed classes are a preview feature and are disabled by default. public static int trans(int h,int w){ ^ (use --enable-preview to enable unnamed classes) Main.java:152: error: class, interface, enum, or record expected } ^ 4 errors
s078239048
p00067
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String tes = null; int g=0; int d = 0; ArrayList<Integer> al = new ArrayList<Integer>(); ArrayList<tyu> al2 = new ArrayList<tyu>(); ArrayList<Integer> lsf = new ArrayList<Integer>(); ArrayList<Integer> lsl = new ArrayList<Integer>(); ArrayList<Integer> lsn = new ArrayList<Integer>(); ArrayList<Integer> lsf2 = new ArrayList<Integer>(); ArrayList<Integer> lsl2 = new ArrayList<Integer>(); ArrayList<Integer> lsn2 = new ArrayList<Integer>(); ArrayList<Integer> dead = new ArrayList<Integer>(); while(true){ tyu io = new tyu(); for(int s=0;s<12;s++){ try { tes = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } if(tes == null){ if(g == 1){ d = 1; break; } g = 1; continue; } if(tes.equals("")){ if(g == 1){ d = 1; break; } g = 1; continue; } g = 0; try{ for(int i=0;i<12;i++){ io.t.add(Integer.parseInt(String.valueOf(tes.charAt(i)))); dead.add(0); } }catch(NumberFormatException e){ break; } } if(d == 1){ break; } al2.add(io); //al.add(a); } /*for(int i=0;i<al2.size();i++){ for(int j=0;j<12;j++){ for(int k=0;k<12;k++){ System.out.print(al2.get(i).get(trans(j,k))); } System.out.println(); } System.out.println("\n"); }*/ int num; int cl; int yn; al = al2.get(r).t; al.get(0); } public static int trans(int h,int w){ int ret = 0; ret = h*12+w; return ret; } } class tyu{ ArrayList<Integer> t = new ArrayList<Integer>(); }
Main.java:82: error: cannot find symbol al = al2.get(r).t; ^ symbol: variable r location: class Main 1 error
s743968502
p00067
Java
import java.io.*; ckass Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; int count; char[][] map=new char[12][12]; while(true){ count=0; for(int i=0;i<12;i++){ line=br.readLine(); for(int j=0;j<12;j++){ map[i][j]=line.charAt(j); } } for(int i=0;i<12;i++){ for(int j=0;j<12;j++){ if(map[i][j]=='1'){ dfs(i,j,map); count++; } } } System.out.println(count); line=br.readLine(); if(line==null){ break; } } } private static void dfs(int x,int y,char[][] map){ int nx,ny; map[x][y]='0'; int[] dx={-1,0,1,0}; int[] dy={0,-1,0,1}; for(int i=0;i<4;i++){ nx=x+dx[i]; ny=x+dy[i]; if(nx>=0&&nx<12&&ny>=0&&ny<12&&map[nx][ny]=='1'){ dfs(nx,ny,map); } } return; } }
Main.java:3: error: class, interface, enum, or record expected ckass Main{ ^ Main.java:4: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) throws IOException{ ^ (use --enable-preview to enable unnamed classes) Main.java:46: error: class, interface, enum, or record expected } ^ 3 errors
s744300437
p00067
Java
import java.util.Scanner; public class Main { static Scanner scan = new Scanner(System.in); static boolean[][] map = new boolean[12][12]; static boolean[][] check = new boolean[12][12]; static int island = 0; public static void main(String[] args) { while(scan.hasNext()) { for(int i = 0; i < 12; i++) { int count = 0; for( String s : scan.nextLine().split("",0)) { if(s.equals("1")) { map[i][count] = true; } else { map[i][count] = false; } count++; } } for(int i = 0; i < 12 ; i++) { for(int u = 0; u < 12; u++) { if(map[i][u] && !check[i][u]) { fun(i,u); } } } } } static void fun(int x, int y) { fun(x,y,0); island++; } static void fun(int x, int y, int muki) { check[x][y] = true; if(y + 1 < 12 && map[x][y+1]) { fun(x,y+1,0); } else { fun(x+1,y,1); if(x+1 < 12 && map[x+1][y]) { fun(x+1,y,1); } else { fun(x,y-1,2); if(y - 1 > - 1 && map[x][y-1]) { fun(x,y-1,2); } else { fun(x+1,y,3); if(x - 1 > -1 && map[x-1][y]) { fun(x-1,y,3); } } }
Main.java:66: error: reached end of file while parsing } ^ 1 error
s114602585
p00067
Java
#include<iostream> #include<vector> #include<string> using namespace std; char tisei[12][12]; void shima(int a, int b) { tisei[a][b] = 0; if (tisei[a - 1][b] && a - 1>0 )shima(a - 1, b); if (tisei[a + 1][b] && a + 1<13)shima(a + 1, b); if (tisei[a][b - 1] && b - 1>0 )shima(a, b - 1); if (tisei[a][b + 1] && b + 1<13)shima(a, b + 1); } int main() { while (1) { for (int a = 0; a < 12; a++) { string c; cin >> c; if (cin.fail())goto l; for (int b = 0; b < 12; b++) { tisei[a][b] = c[b] - 48; } } int s = 0; for (int e = 0; e < 12; e++) { for (int f = 0; f < 12; f++) { if (tisei[e][f]) { s++; shima(e, f); } } } cout << s << endl; } l:; }
Main.java:1: error: illegal character: '#' #include<iostream> ^ Main.java:2: error: illegal character: '#' #include<vector> ^ Main.java:3: error: illegal character: '#' #include<string> ^ Main.java:6: error: class, interface, enum, or record expected char tisei[12][12]; ^ Main.java:7: error: unnamed classes are a preview feature and are disabled by default. void shima(int a, int b) { ^ (use --enable-preview to enable unnamed classes) Main.java:18: error: not a statement cin >> c; ^ Main.java:19: error: not a statement if (cin.fail())goto l; ^ Main.java:30: error: not a statement cout << s << endl; ^ Main.java:19: error: illegal start of expression if (cin.fail())goto l; ^ 9 errors
s934201465
p00067
Java
package NumberOfIsland; import java.io.IOException; import java.util.Scanner; /** * <pre> * NumberOfIsland * * ??¶?????°??????????????? * </pre> * * @author ?????????????????§??? * */ public class NumberofIsland { static boolean[][] map; static boolean[][] check; static int island ; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { map = new boolean[12][12]; check = new boolean[12][12]; island = 0; for(int cnt = 0; cnt < map.length; cnt++) { int trans = 0; for( String s : sc.next().split("",0)) { if(s.equals("1")) { map[cnt][trans] = true; } else { map[cnt][trans] = false; } trans++; } } for(int mh = 0; mh < map.length ; mh++) { for(int mw = 0; mw < map.length; mw++) { if(map[mh][mw] && !check[mh][mw]) { fun(mh,mw); } } } System.out.println(island); } // ????????????????????? }// ????????????????????????????????? static void fun(int mh, int mw) { flag(mh,mw); island++; } static void flag(int mh, int mw) { check[mh][mw] = true; if(mw + 1 < 12 && map[mh][mw+1] && !check[mh][mw+1]) { flag(mh,mw+1); } if(mh + 1 < 12 && map[mh+1][mw] && !check[mh+1][mw]) { flag(mh+1,mw); } if(mw - 1 > -1 && map[mh][mw-1] && !check[mh][mw-1]) { flag(mh,mw-1); } if(mh - 1 > -1 && map[mh-1][mw] && !check[mh-1][mw]) { flag(mh-1,mw); } } }// ??????????????????????????????
Main.java:16: error: class NumberofIsland is public, should be declared in a file named NumberofIsland.java public class NumberofIsland { ^ 1 error
s692373519
p00067
Java
111100001111 111000001111 110000001111 100000001111 000100010000 000000111000 000001111100 100011111110 110001111100 111000111000 111100010000 000000000000 010001111100 110010000010 010010000001 010000000001 010000000110 010000111000 010000000100 010000000010 010000000001 010010000001 010010000010 111001111100 000000000000 111111111111 100010100001 100010100001 100010100001 100010100001 100100100101 101000011101 100000000001 100000000001 111111111111 100000000001
Main.java:1: error: class, interface, enum, or record expected 111100001111 ^ 1 error
s168638480
p00067
Java
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { // ?????????????????????(??????????????????) PackMan packman = new PackMan(); // ?????????????????¨?¨????????????°?????¨??? final int VERTICALLIMIT = 12; final int SIDELIMIT = 12; Scanner in = new Scanner(System.in); // ????????°??????????´????????????? String[][] worldMap = new String[VERTICALLIMIT][SIDELIMIT]; // ???????????????????£?????????¶?????°???????´???????????????? ArrayList<Integer> packmanCount = new ArrayList<>(); // ?£?????????¶?????°????????????????????????????????°; int count = 0; while (in.hasNext()) { // ????????????????????????????????§?????????????????? for (int verticalNum = 0; verticalNum < VERTICALLIMIT; verticalNum++) { // ??????????§?????????\??? String world = in.next(); // ??????????§??????????????????°???????????? worldMap[verticalNum] = world.split(""); } } // ????????????????????????????????§?????????????????? for (int verticalNum = 0; verticalNum < VERTICALLIMIT; verticalNum++) { // ?¨??????????????????????????????§?????????????????? for (int sideNum = 0; sideNum < SIDELIMIT; sideNum++) { // ??¶?????????????????? if (worldMap[verticalNum][sideNum].equals("1")) { // ????????????????????¶????£?????°??????? packman.eatIsland(worldMap, verticalNum, sideNum); // ??????????????£?????¶?????°??????(???????????\?????????) count++; } } } // ???????????????????£???????????????¶?????°????????? packmanCount.add(count); // ?¬???????????????????????????????????????¨?????????????????? count = 0; } // ????????????????????????????????£?????¶???????¨?????????? for(int result: packmanCount) { System.out.println(result); } } } // ????????????????????????????????¨????????????????????????????????§????????¨??????????????????????????????????????±??§???????????? class PackMan{ // ?????????????????????????????°?????¨??? final int VERTICALZERO = 0; final int VERTICALLIMIT = 11; final int SIDEZERO = 0; final int SIDELIMIT = 11; void eatIsland(String[][] worldMap, int verticalNum, int sideNum) { // ????????????????????¶????±????????????¨??? if (worldMap[verticalNum][sideNum].equals("1")) { // ??¶???????????????????£?????§??????? worldMap[verticalNum][sideNum] = "0"; // ???????????????????????????????????????????????????????°????????????? if (verticalNum > VERTICALZERO) { // ?????????????£??????? eatIsland(worldMap, verticalNum - 1, sideNum); } // ???????????????????????????????????????????????????????°????????????? if (verticalNum < VERTICALLIMIT) { // ???????????§?£??????? eatIsland(worldMap, verticalNum + 1, sideNum); } // ???????????????????????????????????????????????????????°????????????? if (sideNum > SIDEZERO) { // ???????????§????£??????? eatIsland(worldMap, verticalNum, sideNum - 1); } // ???????????????????????????????????????????????????????°????????????? if (sideNum < SIDELIMIT) { // ??¨?????§????????¶??? eatIsland(worldMap, verticalNum, sideNum + 1); } } } } // ==============================?????°???????????????======================================= /*if(worldMap[i + 1][j] == 0 && worldMap[i - 1][j] == 0 && worldMap[i][j + 1] == 0 && worldMap[i][j - 1] == 0) { worldMap[i][j] = 0; } else if(worldMap[i + 1][j] == 1 || worldMap[i - 1][j] != 0 || worldMap[i][j + 1] != 0 || worldMap[i][j - 1] != 0){ packman(worldMap, i + 1, j); } else if(worldMap[j + 1][j] == 1 && worldMap[i + 1][j] == 0 || worldMap[i - 1][j] != 0 || worldMap[i][j - 1] != 0) { packman(worldMap, i, j + 1); } else if(worldMap[i][j - 1] == 1 && worldMap[i + 1][j] == 0 || worldMap[i - 1][j] != 0 || worldMap[i][j - 1] != 0){ packman(worldMap, i, j - 1); } else if(worldMap[i][i - 1] == 1 && worldMap[i + 1][j] == 0 || worldMap[i][j + 1] != 0 || worldMap[i][j - 1] != 0){ packman(worldMap, i - 1, j); } worldMap[i][j] = 0;*/
Main.java:66: error: illegal start of type for(int result: packmanCount) { ^ Main.java:66: error: ';' expected for(int result: packmanCount) { ^ Main.java:66: error: <identifier> expected for(int result: packmanCount) { ^ Main.java:72: error: class, interface, enum, or record expected } ^ 4 errors
s132873774
p00067
Java
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { // ?????????????????????(??????????????????) PackMan packman = new PackMan(); // ?????????????????¨?¨????????????°?????¨??? final int VERTICALLIMIT = 12; final int SIDELIMIT = 12; Scanner in = new Scanner(System.in); // ????????°??????????´????????????? String[][] worldMap = new String[VERTICALLIMIT][SIDELIMIT]; // ???????????????????£?????????¶?????°???????´???????????????? ArrayList<Integer> packmanCount = new ArrayList<>(); // ?£?????????¶?????°????????????????????????????????°; int count = 0; while (in.hasNext()) { // ????????????????????????????????§?????????????????? for (int verticalNum = 0; verticalNum < VERTICALLIMIT; verticalNum++) { // ??????????§?????????\??? String world = in.next(); // ??????????§??????????????????°???????????? worldMap[verticalNum] = world.split(""); } } // ????????????????????????????????§?????????????????? for (int verticalNum = 0; verticalNum < VERTICALLIMIT; verticalNum++) { // ?¨??????????????????????????????§?????????????????? for (int sideNum = 0; sideNum < SIDELIMIT; sideNum++) { // ??¶?????????????????? if (worldMap[verticalNum][sideNum].equals("1")) { // ????????????????????¶????£?????°??????? packman.eatIsland(worldMap, verticalNum, sideNum); // ??????????????£?????¶?????°??????(???????????\?????????) count++; } } } // ???????????????????£???????????????¶?????°????????? packmanCount.add(count); // ?¬???????????????????????????????????????¨?????????????????? count = 0; } // ????????????????????????????????£?????¶???????¨?????????? for(int result: packmanCount) { System.out.println(result); } } } // ????????????????????????????????¨????????????????????????????????§????????¨??????????????????????????????????????±??§???????????? class PackMan{ // ?????????????????????????????°?????¨??? final int VERTICALZERO = 0; final int VERTICALLIMIT = 11; final int SIDEZERO = 0; final int SIDELIMIT = 11; void eatIsland(String[][] worldMap, int verticalNum, int sideNum) { // ????????????????????¶????±????????????¨??? if (worldMap[verticalNum][sideNum].equals("1")) { // ??¶???????????????????£?????§??????? worldMap[verticalNum][sideNum] = "0"; // ???????????????????????????????????????????????????????°????????????? if (verticalNum > VERTICALZERO) { // ?????????????£??????? eatIsland(worldMap, verticalNum - 1, sideNum); } // ???????????????????????????????????????????????????????°????????????? if (verticalNum < VERTICALLIMIT) { // ???????????§?£??????? eatIsland(worldMap, verticalNum + 1, sideNum); } // ???????????????????????????????????????????????????????°????????????? if (sideNum > SIDEZERO) { // ???????????§????£??????? eatIsland(worldMap, verticalNum, sideNum - 1); } // ???????????????????????????????????????????????????????°????????????? if (sideNum < SIDELIMIT) { // ??¨?????§????????¶??? eatIsland(worldMap, verticalNum, sideNum + 1); } } } } // ==============================?????°???????????????======================================= /*if(worldMap[i + 1][j] == 0 && worldMap[i - 1][j] == 0 && worldMap[i][j + 1] == 0 && worldMap[i][j - 1] == 0) { worldMap[i][j] = 0; } else if(worldMap[i + 1][j] == 1 || worldMap[i - 1][j] != 0 || worldMap[i][j + 1] != 0 || worldMap[i][j - 1] != 0){ packman(worldMap, i + 1, j); } else if(worldMap[j + 1][j] == 1 && worldMap[i + 1][j] == 0 || worldMap[i - 1][j] != 0 || worldMap[i][j - 1] != 0) { packman(worldMap, i, j + 1); } else if(worldMap[i][j - 1] == 1 && worldMap[i + 1][j] == 0 || worldMap[i - 1][j] != 0 || worldMap[i][j - 1] != 0){ packman(worldMap, i, j - 1); } else if(worldMap[i][i - 1] == 1 && worldMap[i + 1][j] == 0 || worldMap[i][j + 1] != 0 || worldMap[i][j - 1] != 0){ packman(worldMap, i - 1, j); } worldMap[i][j] = 0;*/
Main.java:66: error: illegal start of type for(int result: packmanCount) { ^ Main.java:66: error: ';' expected for(int result: packmanCount) { ^ Main.java:66: error: <identifier> expected for(int result: packmanCount) { ^ Main.java:72: error: class, interface, enum, or record expected } ^ 4 errors
s760432335
p00067
Java
import java.util.Scanner; public class Main { class Island { int[][] map = new int[14][14]; int num = 2; public Island(int[][] map) { this.map = map; } private void label(int row, int column) { map[row][column] = num; for(int i=0; i<4; i++) { if(i==0) { if(map[row][column-1] == 1) label(row, column-1); } else if(i == 1) { if(map[row-1][column] == 1) label(row-1, column); } else if(i == 2) { if(map[row][column+1] == 1) label(row, column+1); } else if(i == 3) { if(map[row+1][column] == 1) label(row+1, column); } } } public int count() { for(int i=1; i<13; i++) { for(int j=1; j<13; j++) { if(map[i][j] == 1) { num++; label(i, j); } } } return num-2; } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int[][] map = new int[14][14]; // 外を埋める for(int i=0; i<14; i++) { map[0][i] = 0; map[13][i] = 0; map[i][0] = 0; map[i][13] = 0; } for(int i=1; i<13; i++) { String line = sc.next(); for(int j=1; j<13; j++) { map[i][j] = Integer.parseInt(line.split("")[j-1]); } } Island island = new Main().new Island(map); System.out.println(island.count()); } sc.close(); }
Main.java:74: error: reached end of file while parsing } ^ 1 error
s321916104
p00067
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); boolean hasNext = true; while (hasNext) { int[][] before = new int[12][]; int[][] line = new int[12][]; int count = 0, num = 0; int[][] old = null; char[] read = new char[12]; for (int col = 0; col < 12; col++) { old = before; before = line; line = old; br.read(read); for (int row = 0; row < 12; row++) { if (read[row] == '1') { boolean upperHas = before[row] != null; boolean leftHas = row != 0 && line[row - 1] != null; if (!(upperHas || leftHas)) { line[row] = new int[] { num++ }; count++; } else if (leftHas) { line[row] = line[row - 1]; if (upperHas && line[row][0] != before[row][0]) { line[row][0] = before[row][0]; count--; } } else if (upperHas) { line[row] = before[row]; } } else { line[row] = null; } } br.readLine(); } System.out.print(count); hasNext = br.readLine() != null; if (hasNext) { System.out.print(" "); } else { System.out.println(); } } }
Main.java:52: error: reached end of file while parsing } ^ 1 error
s738863790
p00067
C
#include <stdio.h> char m[14][14]; int w[4][2]={{-1,0},{1,0},{0,-1},{0,1}}; void sol(int i,int j) { int ni,nj; m[i][j]=='0'; for(int k=0;k<4;++k) { ni=i+w[k][0]; nj=j+w[k][1]; if(m[ni][nj]=='1') sol(ni,nj); } } int main(){ int ans; for (;;) { ans=0; memset(m,'0',sizeof(m)); for (int i=1;i<=12;++i) { if (scanf("%s",&m[i][1])==EOF) return 0; m[i][13]='0'; } for (int i=1;i<=12;++i) { for (int j=1;j<=12;++j) { if (m[i][j]=='1') { sol(i,j); ans++; } } } printf("%d\n",ans); } }
main.c: In function 'main': main.c:21:9: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration] 21 | memset(m,'0',sizeof(m)); | ^~~~~~ main.c:2:1: note: include '<string.h>' or provide a declaration of 'memset' 1 | #include <stdio.h> +++ |+#include <string.h> 2 | main.c:21:9: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch] 21 | memset(m,'0',sizeof(m)); | ^~~~~~ main.c:21:9: note: include '<string.h>' or provide a declaration of 'memset'
s467883976
p00067
C
#include <stdio.h> bool setMap(); void search(int x,int y); int map[12][12]; int w=12; int h=12; int main(void) { while(setMap()){ } } bool setMap(){ char t; int count=0; int r; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ r=scanf(" %c",&t); if(r<1){ return false; } map[i][j]=t-'0'; } } for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ if(map[i][j]==1){ search(j,i); count++; } } } printf("%d\n",count); return true; } void search(int x,int y){ if(w>x && x>=0 && h>y && y>=0 && map[y][x]==1){ map[y][x]=0; search(x+1,y); search(x-1,y); search(x,y+1); search(x,y-1); } }
main.c:2:1: error: unknown type name 'bool' 2 | bool setMap(); | ^~~~ main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 1 | #include <stdio.h> +++ |+#include <stdbool.h> 2 | bool setMap(); main.c:15:1: error: unknown type name 'bool' 15 | bool setMap(){ | ^~~~ main.c:15:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' main.c: In function 'setMap': main.c:24:40: error: 'false' undeclared (first use in this function) 24 | return false; | ^~~~~ main.c:24:40: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' main.c:24:40: note: each undeclared identifier is reported only once for each function it appears in main.c:40:16: error: 'true' undeclared (first use in this function) 40 | return true; | ^~~~ main.c:40:16: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
s700241330
p00067
C
#include<iostream> #include<string> using namespace std; #define N 12 int map[N][N], ans = 0; int toInt(string str, int n); int search(); int loop(int x, int y); int main(){ string str; while(cin >>str){ toInt(str, 0); for(int i = 1; i < N; i++){ ans = 0; cin >>str; toInt(str, i); } search(); cout <<ans <<endl; } } int toInt(string str, int n){ for(int i = 0; i < N; i++){ map[n][i] = str[i] - '0'; } } int search(){ for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++){ if(map[i][j] == 1){ ans++; loop(j, i); } } } } int loop(int x, int y){ int xm[] = {0, 1, 0, -1}, ym[] = {-1, 0, 1, 0}; if(map[y][x] == 1){ map[y][x] = 0; for(int i = 0; i < 4; i++){ int xn = x + xm[i], yn = y + ym[i]; if(xn >= 0 && yn >= 0 && xn < N && yn < N && map[yn][xn] == 1) loop(xn, yn); } } }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s336846386
p00067
C++
#include <iostream> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <map> #include <cmath> #include <string> #include <sstream> #include <iomanip> #include <complex> using namespace std; #define ll long long #define vvi vector< vector<int> > #define All(X) X.begin(),X.end() #define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define REP(i,n) for(int i=0;i<(int)(n);i++) #define pb push_back ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;} bool inrange(int x,int y){ if(x<0||y<0||x>11||y>11) return false; else return true; } int data[20][20]; int dx[4] = {-1,0,1,0}; int dy[4] = {0,-1,0,1}; void search(int x,int y){ REP(i,4){ int nx = x + dx[i]; int ny = y + dy[i]; if(!inrange(nx,ny)) continue; if(data[nx][ny]==1) { data[nx][ny] = 0; search(nx,ny); } } } int main(){ while(1){ string str; REP(i,12){ if(!cin >> str) return 0; REP(j,12){ data[i][j] = str[j] - '0'; } } ll int cnt = 0; REP(i,12){ REP(j,12){ if(data[i][j]==1){ search(i,j); cnt++; } } } cout << cnt << endl; REP(i,12) //if(cin.eof()) break; } }
a.cc: In function 'void search(int, int)': a.cc:37:20: error: reference to 'data' is ambiguous 37 | if(data[nx][ny]==1) { | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:28:5: note: 'int data [20][20]' 28 | int data[20][20]; | ^~~~ a.cc:38:25: error: reference to 'data' is ambiguous 38 | data[nx][ny] = 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:28:5: note: 'int data [20][20]' 28 | int data[20][20]; | ^~~~ a.cc: In function 'int main()': a.cc:48:33: error: no match for 'operator>>' (operand types are 'bool' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 48 | if(!cin >> str) return 0; | ~~~~ ^~ ~~~ | | | | bool std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/string:55: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:48:36: note: mismatched types 'std::basic_istream<_CharT, _Traits>' and 'bool' 48 | if(!cin >> str) return 0; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:48:28: note: cannot convert 'std::cin.std::basic_istream<char>::std::basic_ios<char>.std::basic_ios<char>::operator!()' (type 'bool') to type 'std::byte' 48 | if(!cin >> str) return 0; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:48:36: note: mismatched types 'std::basic_istream<_CharT, _Traits>' and 'bool' 48 | if(!cin >> str) return 0; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:48:36: note: mismatched types 'std::basic_istream<char, _Traits>' and 'bool' 48 | if(!cin >> str) return 0; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:48:36: note: mismatched types 'std::basic_istream<char, _Traits>' and 'bool' 48 | if(!cin >> str) return 0; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:48:36: note: mismatched types 'std::basic_istream<_CharT, _Traits>' and 'bool' 48 | if(!cin >> str) return 0; | ^~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:48:36: note: mismatched types 'std::basic_istream<char, _Traits>' and 'bool' 48 | if(!cin >> str) return 0; | ^~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:48:36: note: mismatched types 'std::basic_istream<char, _Traits>' and 'bool' 48 | if(!cin >> str) return 0; | ^~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = bool; _Tp = std::__cxx11::basic_string<char>&]': a.cc:48:15: required from here 48 | if(!cin >> str) return 0; | ^~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ In file included from a.cc:10: /usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)' 76 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:76:5: note: template argument deduction/substitution failed: a.cc:48:36: note: mismatched types 'std::basic_istream<_CharT, _Traits>' and 'bool' 48 | if(!cin >> str) return 0; | ^~~ /usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)' 106 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:106:5: note: template argument deduction/substitution failed: a.cc:48:36: note: mismatched types 'std::basic_istream<_CharT, _Traits>' and 'bool' 48 | if(!cin >> str) return 0; | ^~~ /usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)' 137 | operator
s742436408
p00067
C++
#include <iostream> #include <cstdio> using namespace std; char island[12][12]; void wn(int i, int j){ island[i][j] = '0'; for(int k = -1; k <= 1; k+=2){ if(i + k < 0 || j + k < 0) continue; if(island[i+k][j] == '1'){ wn(i+k, j); } if(island[i][j+k] == '1'){ wn(i, j+k); } } return; } int main(){ int num; for(int c = 0; c < 20; c++){ num = 0; for(int i = 0; i < 12; i++){ scanf("%s", island[i]); } for(int i = 0; i < 12; i++){ for(int j = 0; j < 12; j++){ if(island[i][j] == '1'){ wn(i, j); num++; } } } cout << num << endl;          cout << endl; } return 0; }
a.cc:41:1: error: extended character   is not valid in an identifier 41 |          cout << endl; | ^ a.cc:41:1: error: extended character   is not valid in an identifier a.cc:41:1: error: extended character   is not valid in an identifier a.cc:41:1: error: extended character   is not valid in an identifier a.cc:41:1: error: extended character   is not valid in an identifier a.cc:41:1: error: extended character   is not valid in an identifier a.cc:41:1: error: extended character   is not valid in an identifier a.cc:41:1: error: extended character   is not valid in an identifier a.cc: In function 'int main()': a.cc:40:32: error: 'endl\U0000ff1b' was not declared in this scope 40 | cout << num << endl; | ^~~~~~
s579934393
p00067
C++
#include <iostream> #include <cstdio> #include <cstdlib> #include <time.h> #include <math.h> #include <vector> #include <queue> #include <map> #include <set> #include <algorithm> #include <iterator> #include <sstream> #include <string> #include <bitset> using namespace std; #define rep(I,N) for(int I = 0; I < (int)(N); I++) #define FIN(V) cout<<V<<endl #define pb push_back #define INF (1 << 30) typedef pair<int, int> P; typedef long long ll; typedef priority_queue<int> pq; int StrToInt(string); string IntToStr(int); string maze[13]; int dx[4] = {1, -1, 0, 0}; int dy[4] = {0, 0, 1, -1}; void bfs(int x, int y){ maze[y][x] = '0'; rep(i, 4){ int nx = x + dx[i]; int ny = y + dy[i]; if(nx >= 0 && nx <= 12 && ny >= 0 && ny <= 12 && maze[ny][nx] == '1'){ maze[ny][nx] = '0'; bfs(nx, ny); } } } int main(void){ int w, h; while(cin >> maze[0]){ rep(i, 11){ cin >> maze[i+1]; } int cnt = 0; rep(i, 12){ rep(j, 12){ if(maze[i][j] == '1'){ bfs(j, i); cnt++; } } } FIN(cnt); return 0; } int StrToInt(string s){ stringstream ss; ss << s; int val; ss >> val; return val; } string IntToStr(int i){ stringstream ss; ss << i; return ss.str(); }
a.cc: In function 'int main()': a.cc:62:23: error: a function-definition is not allowed here before '{' token 62 | int StrToInt(string s){ | ^ a.cc:69:23: error: a function-definition is not allowed here before '{' token 69 | string IntToStr(int i){ | ^ a.cc:73:2: error: expected '}' at end of input 73 | } | ^ a.cc:41:15: note: to match this '{' 41 | int main(void){ | ^
s780719798
p00067
C++
#include <iostream> #include <cstdio> #include <cstdlib> #include <time.h> #include <math.h> #include <vector> #include <queue> #include <map> #include <set> #include <algorithm> #include <iterator> #include <sstream> #include <string> #include <bitset> using namespace std; #define rep(I,N) for(int I = 0; I < (int)(N); I++) #define FIN(V) cout<<V<<endl #define pb push_back #define INF (1 << 30) typedef pair<int, int> P; typedef long long ll; typedef priority_queue<int> pq; int StrToInt(string); string IntToStr(int); string maze[13]; int dx[4] = {1, -1, 0, 0}; int dy[4] = {0, 0, 1, -1}; void bfs(int x, int y){ maze[y][x] = '0'; rep(i, 4){ int nx = x + dx[i]; int ny = y + dy[i]; if(nx >= 0 && nx <= 12 && ny >= 0 && ny <= 12 && maze[ny][nx] == '1'){ maze[ny][nx] = '0'; bfs(nx, ny); } } } int main(void){ int w, h; while(cin >> maze[0]){ rep(i, 11){ cin >> maze[i+1]; } int cnt = 0; rep(i, 12){ rep(j, 12){ if(maze[i][j] == '1'){ bfs(j, i); cnt++; } } } FIN(cnt); return 0; } int StrToInt(string s){ stringstream ss; ss << s; int val; ss >> val; return val; } string IntToStr(int i){ stringstream ss; ss << i; return ss.str(); }
a.cc: In function 'int main()': a.cc:62:23: error: a function-definition is not allowed here before '{' token 62 | int StrToInt(string s){ | ^ a.cc:69:23: error: a function-definition is not allowed here before '{' token 69 | string IntToStr(int i){ | ^ a.cc:73:2: error: expected '}' at end of input 73 | } | ^ a.cc:41:15: note: to match this '{' 41 | int main(void){ | ^
s831637664
p00067
C++
#include<iostream> #include<vector> #include<string> using namespace std; char ma[12][12]; bool vi[12][12]; int mv[4][2]={{0,1},{0,-1},{1,0},{-1,0}}; void dfs(int x, int y){ vi[y][x]=1; for(int i=0;i<4;i++){ int nx=x+mv[i][0],ny=y+mv[i][1]; if(ny>=0&&nx>=0&&ny<12&&nx<12&&(!vi[ny][nx])&&(ma[ny][nx]=='1')) dfs(nx,ny); } } int main(){ while(cin>>ma[0][0]){ for(int i=0;i<12;i++){ for(int j=0;j<12;j++){ if(!i&&!j)continue; cin>>ma[i][j]; } } int co=0; memset(vi, 0, sizeof(vi)); for(int i=0;i<12;i++){ for(int j=0;j<12;j++){ if(ma[i][j]=='1'&&!vi[i][j]){ co++; dfs(j,i); } } } cout<<co<<endl; } }
a.cc: In function 'int main()': a.cc:29:9: error: 'memset' was not declared in this scope 29 | memset(vi, 0, sizeof(vi)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<vector> +++ |+#include <cstring> 3 | #include<string>
s340841584
p00067
C++
#include<iostream> using namespace std; int field[12][12]; int came[12][12]; int islands; void checker(int X,int Y) { if(field[Y][X] == 1 && came[Y][X] == 0) { came[Y][X] = 1; if(X!=0) { checker(X-1,Y); } if(Y!=0) { checker(X,Y-1); } if(X!=11) { checker(X+1,Y); } if(Y!=11) { checker(X,Y+1); } } } int main() { while (for(int a = 0;a<12;a++) { cin >> field[a]; }) { for(int y = 0;x<12;x++) { for(int x = 0;y<12;y++) { if(field[y][x] == 1 && came[y][x] == 0) { island++; checker(x,y); } } } cout << islands << endl; for(int y = 0;y<11;y++) { for(int x = 0;x<11;x++) { came[y][x] = 0; } } islands = 0; } return 0; }
a.cc: In function 'int main()': a.cc:35:16: error: expected primary-expression before 'for' 35 | while (for(int a = 0;a<12;a++) | ^~~ a.cc:35:16: error: expected ')' before 'for' 35 | while (for(int a = 0;a<12;a++) | ~^~~ | ) a.cc:37:21: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [12]') 37 | cin >> field[a]; | ~~~ ^~ ~~~~~~~~ | | | | | int [12] | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:37:31: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*' 37 | cin >> field[a]; | ~~~~~~~^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:37:31: error: invalid conversion from 'int*' to 'short int' [-fpermissive] 37 | cin >> field[a]; | ~~~~~~~^ | | | int* a.cc:37:31: error: cannot bind rvalue '(short int)((int*)(& field[a]))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:37:31: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive] 37 | cin >> field[a]; | ~~~~~~~^ | | | int* a.cc:37:31: error: cannot bind rvalue '(short unsigned int)((int*)(& field[a]))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:37:31: error: invalid conversion from 'int*' to 'int' [-fpermissive] 37 | cin >> field[a]; | ~~~~~~~^ | | | int* a.cc:37:31: error: cannot bind rvalue '(int)((int*)(& field[a]))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:37:31: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive] 37 | cin >> field[a]; | ~~~~~~~^ | | | int* a.cc:37:31: error: cannot bind rvalue '(unsigned int)((int*)(& field[a]))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:37:31: error: invalid conversion from 'int*' to 'long int' [-fpermissive] 37 | cin >> field[a]; | ~~~~~~~^ | | | int* a.cc:37:31: error: cannot bind rvalue '(long int)((int*)(& field[a]))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:37:31: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive] 37 | cin >> field[a]; | ~~~~~~~^ | | | int* a.cc:37:31: error: cannot bind rvalue '(long unsigned int)((int*)(& field[a]))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:37:31: error: invalid conversion from 'int*' to 'long long int' [-fpermissive] 37 | cin >> field[a]; | ~~~~~~~^ | | | int* a.cc:37:31: error: cannot bind rvalue '(long long int)((int*)(& field[a]))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:37:31: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive] 37 | cin >> field[a]; | ~~~~~~~^ | | | int* a.cc:37:31: error: cannot bind rvalue '(long long unsigned int)((int*)(& field[a]))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:37:31: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 37 | cin >> field[a]; | ~~~~~~~^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'int [12]' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'int [12]' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'int [12]' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'int [12]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_ist
s956253994
p00067
C++
#include<stdio.h> #include<iostream> #include<string> #include<vector> #include<math.h> #define CI cin >> #define CO cout << #define E << endl; #define F(i,max) (for(int i = 0;i < max;++i)) using namespace std; char board[14][14]; int vvv = 0; int JudgeSurround(int x, int y) { if (board[x][y] == '0') { return vvv; } if (board[x][y] == '1') { board[x][y] = 0; vvv = 1; JudgeSurround(x + 1, y); JudgeSurround(x, y + 1); JudgeSurround(x - 1, y); JudgeSurround(x, y - 1); return vvv; } } int main(void) { int count = 0; bool flag = false; vector<int> answer; for (int i = 0; i < 14; ++i) { for (int j = 0; j < 14; ++j) { board[i][j] = 0; } } while (true) { count = 0; for (int i = 1; i < 13; ++i) { for (int j = 1; j < 13; ++j) { if (!(CI board[i][j])) { flag = true; } } } for (int i = 1; i < 13; ++i) { for (int j = 1; j < 13; ++j) { if (vvv = 0, JudgeSurround(i, j) == 1) { count++; } } } answer.push_back(count); if (flag) { break } } for (int i = 0; i < answer.size(); ++i) { CO answer[i] E } return 0; }
a.cc: In function 'int main()': a.cc:70:30: error: expected ';' before '}' token 70 | break | ^ | ; 71 | } | ~ a.cc: In function 'int JudgeSurround(int, int)': a.cc:32:1: warning: control reaches end of non-void function [-Wreturn-type] 32 | } | ^
s071232254
p00067
C++
/*#include<map> #include<list> #include<cmath> #include<stack> #include<string> #include<vector> #include<iostream> #include<algorithm> using namespace std; int A[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; int cunt = 0; void depth(int n, int s, int i){ if (n == 0 && s == 0){ cunt++; return; } else if (n == 0) return; else if (s < 0) return; else if (i == 10) return; depth(n - 1, s - A[i],i+1); depth(n, s, i+1); } int main(){ int n, s; while (cin >> n >> s){ if (n == 0 && s == 0) break; depth(n, s, 0); cout << cunt << endl; cunt = 0; } return 0; } */ #include<map> #include<list> #include<stack> #include<queue> #include<cmath> #include<string> #include<stdio.h> #include<iostream> #include<algorithm> using namespace std; int tmap[12][12]; void Terrain(int i,int l){ if (i<0 || i>11 || l<0 || i>11 || tmap[i][l] == 0){ return; } tmap[i][l] = 0; Terrain(i + 1, l); Terrain(i - 1, l); Terrain(i, l + 1); Terrain(i, l - 1); } int main(){ int cunt = 0; for (int c = 0; c < 3; c++){ for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ scanf_s("%1d", &tmap[i][l]); } } for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (tmap[i][l] == 1){ Terrain(i, l); cunt++; } } } cout << cunt << endl; cunt = 0; } return 0; }
a.cc: In function 'int main()': a.cc:73:33: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 73 | scanf_s("%1d", &tmap[i][l]); | ^~~~~~~ | scanf
s474233844
p00067
C++
#include<map> #include<list> #include<stack> #include<queue> #include<cmath> #include<string> #include<stdio.h> #include<iostream> #include<algorithm> using namespace std; int tmap[12][12]; void Terrain(int i,int l){ if (i<0 || i>11 || l<0 || i>11 || tmap[i][l] == 0){ return; } tmap[i][l] = 0; Terrain(i + 1, l); Terrain(i - 1, l); Terrain(i, l + 1); Terrain(i, l - 1); } int main(){ int cunt = 0; for (int c = 0; c < 3; c++){ for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ scanf_s("%1d", &tmap[i][l]); } } for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (tmap[i][l] == 1){ Terrain(i, l); cunt++; } } } cout << cunt << endl; cunt = 0; } return 0; }
a.cc: In function 'int main()': a.cc:33:33: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 33 | scanf_s("%1d", &tmap[i][l]); | ^~~~~~~ | scanf
s938471633
p00067
C++
#include<map> #include<list> #include<stack> #include<queue> #include<cmath> #include<string> #include<stdio.h> #include<iostream> #include<algorithm> using namespace std; int tmap[12][12]; void Terrain(int i,int l){ if (i<0 || i>11 || l<0 || i>11 || tmap[i][l] == 0){ return; } tmap[i][l] = 0; Terrain(i + 1, l); Terrain(i - 1, l); Terrain(i, l + 1); Terrain(i, l - 1); } int main(){ int cunt = 0; while (1){ for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (scanf_s("%1d", &tmap[i][l]) == EOF) return 0; } } for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (tmap[i][l] == 1){ Terrain(i, l); cunt++; } } } cout << cunt << endl; cunt = 0; } return 0; }
a.cc: In function 'int main()': a.cc:33:37: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 33 | if (scanf_s("%1d", &tmap[i][l]) == EOF) return 0; | ^~~~~~~ | scanf
s076890504
p00067
C++
#include<map> #include<list> #include<stack> #include<queue> #include<cmath> #include<string> #include<stdio.h> #include<iostream> #include<algorithm> #include<conio.h> using namespace std; int tmap[12][12]; void Terrain(int i,int l){ if (i<0 || i>11 || l<0 || i>11 || tmap[i][l] == 0){ return; } tmap[i][l] = 0; Terrain(i + 1, l); Terrain(i - 1, l); Terrain(i, l + 1); Terrain(i, l - 1); } int a; int main(){ int cunt = 0; while (1){ for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ scanf_s("%1d", &tmap[i][l]) } } for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (tmap[i][l] == 1){ Terrain(i, l); cunt++; } } } cout << cunt << endl; cunt = 0; } return 0; }
a.cc:10:9: fatal error: conio.h: No such file or directory 10 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s803827414
p00067
C++
#include<map> #include<list> #include<stack> #include<queue> #include<cmath> #include<string> #include<stdio.h> #include<iostream> #include<algorithm> #include<conio.h> using namespace std; int tmap[12][12]; void Terrain(int i,int l){ if (i<0 || i>11 || l<0 || i>11 || tmap[i][l] == 0){ return; } tmap[i][l] = 0; Terrain(i + 1, l); Terrain(i - 1, l); Terrain(i, l + 1); Terrain(i, l - 1); } int a; int main(){ int cunt = 0; while (1){ for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ scanf("%1d", &tmap[i][l]) } } for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (tmap[i][l] == 1){ Terrain(i, l); cunt++; } } } cout << cunt << endl; cunt = 0; } return 0; }
a.cc:10:9: fatal error: conio.h: No such file or directory 10 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s294076259
p00067
C++
#include<map> #include<list> #include<stack> #include<queue> #include<cmath> #include<string> #include<stdio.h> #include<iostream> #include<algorithm> using namespace std; int tmap[12][12]; void Terrain(int i,int l){ if (i<0 || i>11 || l<0 || i>11 || tmap[i][l] == 0){ return; } tmap[i][l] = 0; Terrain(i + 1, l); Terrain(i - 1, l); Terrain(i, l + 1); Terrain(i, l - 1); } int a; int main(){ int cunt = 0; while (1){ for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ scanf("%1d", &tmap[i][l]) } } for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (tmap[i][l] == 1){ Terrain(i, l); cunt++; } } } cout << cunt << endl; cunt = 0; } return 0; }
a.cc: In function 'int main()': a.cc:33:58: error: expected ';' before '}' token 33 | scanf("%1d", &tmap[i][l]) | ^ | ; 34 | } | ~
s513769945
p00067
C++
#include<map> #include<list> #include<stack> #include<queue> #include<cmath> #include<string> #include<stdio.h> #include<iostream> #include<algorithm> #include<conio.h> using namespace std; int tmap[12][12]; void Terrain(int i,int l){ if (i<0 || i>11 || l<0 || i>11 || tmap[i][l] == 0){ return; } tmap[i][l] = 0; Terrain(i + 1, l); Terrain(i - 1, l); Terrain(i, l + 1); Terrain(i, l - 1); } int a; int main(){ int cunt = 0; while (1){ for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ scanf("%1d", &tmap[i][l]); } } for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (tmap[i][l] == 1){ Terrain(i, l); cunt++; } } } cout << cunt << endl; cunt = 0; } return 0; }
a.cc:10:9: fatal error: conio.h: No such file or directory 10 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s481668722
p00067
C++
#include<map> #include<list> #include<stack> #include<queue> #include<cmath> #include<string> #include<stdio.h> #include<iostream> #include<algorithm> #include<conio.h> using namespace std; char tmap[12][12]; void Terrain(int i,int l){ if (i<0 || i>11 || l<0 || i>11 || tmap[i][l] == '0'){ return; } tmap[i][l] = 0; Terrain(i + 1, l); Terrain(i - 1, l); Terrain(i, l + 1); Terrain(i, l - 1); } int a; int main(){ int cunt = 0; while (cin >> tmap[0]){ for (int i = 1; i < 12; i++) cin >> tmap[i]; for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (tmap[i][l] == '1'){ Terrain(i, l); cunt++; } } } cout << cunt << endl; cunt = 0; } return 0; }
a.cc:10:9: fatal error: conio.h: No such file or directory 10 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s350423054
p00067
C++
#include<map> #include<list> #include<stack> #include<queue> #include<cmath> #include<string> #include<stdio.h> #include<iostream> #include<algorithm> #include<conio.h> using namespace std; char tmap[12][12]; void Terrain(int i,int l){ if (i<0 || i>11 || l<0 || i>11 || tmap[i][l] == '0'){ return; } tmap[i][l] = '0'; Terrain(i + 1, l); Terrain(i - 1, l); Terrain(i, l + 1); Terrain(i, l - 1); } int main(){ int cunt = 0; while (cin >> tmap[0]){ for (int i = 1; i < 12; i++) cin >> tmap[i]; for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (tmap[i][l] == '1'){ Terrain(i, l); cunt++; } } } cout << cunt << endl; cunt = 0; } return 0; }
a.cc:10:9: fatal error: conio.h: No such file or directory 10 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s078896175
p00067
C++
#include<map> #include<list> #include<stack> #include<queue> #include<cmath> #include<string> #include<stdio.h> #include<iostream> #include<algorithm> #include<conio.h> using namespace std; char tmap[12][12]; int c; void Terrain(int i,int l){ tmap[i][l] = '0'; if (tmap[i + 1][l] == '1'){ Terrain(i + 1, l); } if (tmap[i - 1][l] == '1'){ Terrain(i - 1, l); } if (tmap[i][l + 1] == '1'){ Terrain(i, l + 1); } if (tmap[i][l - 1] == '1'){ Terrain(i, l - 1); } return; } int main(){ int cunt = 0; while (cin >> tmap[0]){ for (int i = 1; i < 12; i++) cin >> tmap[i]; for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (tmap[i][l] == '1'){ Terrain(i, l); cunt++; } } } cout << cunt << endl; cunt = 0; } return 0; }
a.cc:10:9: fatal error: conio.h: No such file or directory 10 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s040724647
p00067
C++
#include<map> #include<list> #include<stack> #include<queue> #include<cmath> #include<string> #include<stdio.h> #include<iostream> #include<algorithm> #include<conio.h> using namespace std; char tmap[12][12]; int c; void Terrain(int i,int l){ if (tmap[i][l] == '0'||i < 0 || i > 11 || l < 0 || l > 11) return; tmap[i][l] = '0'; Terrain(i + 1, l); Terrain(i - 1, l); Terrain(i, l + 1); Terrain(i, l - 1); return; } int main(){ int cunt = 0; while (cin >> tmap[0]){ for (int i = 1; i < 12; i++) cin >> tmap[i]; for (int i = 0; i < 12; i++){ for (int l = 0; l < 12; l++){ if (tmap[i][l] == '1'){ Terrain(i, l); cunt++; } } } cout << cunt << endl; cunt = 0; } return 0; }
a.cc:10:9: fatal error: conio.h: No such file or directory 10 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s451415472
p00067
C++
#include<stdio.h> char Island[12][12]; void CC(int,int); //void show(void); int main(void) { int c=0; while(1){ for(int i=0;i<12;i++){ if(scanf("%s",Island[i])==EOF) break; } for(int i=0;i<12;i++){ for(int j=0;j<12;j++){ if(Island[i][j] == '1'){ //printf("x:%d y:%d @\n",j,i); CC(i,j); c++; //show(); } } } printf("%d\n",c); return 0; } void CC(int y,int x) { if(y>=0 && x>=0){ //printf("delete x:%d y:%d\n",x,y); Island[y][x] = '0'; if(Island[y-1][x] == '1') CC(y-1,x); //??? if(Island[y+1][x] == '1') CC(y+1,x); //??? if(Island[y][x-1] == '1') CC(y,x-1); //??? if(Island[y][x+1] == '1') CC(y,x+1); //??? } }
a.cc: In function 'int main()': a.cc:28:1: error: a function-definition is not allowed here before '{' token 28 | { | ^ a.cc:37:2: error: expected '}' at end of input 37 | } | ^ a.cc:6:1: note: to match this '{' 6 | { | ^
s076953770
p00067
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; int maze[12][12]; static const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 }; void printTable(int a[12][12]) { for (int i = 0; i < 12; i++) { for (int j = 0; j < 12; j++) { cout << a[i][j]; } cout << endl; } } void dfs(int y, int x) { maze[y][x] = 0; for (int i = 0; i < 4; i++) { if (0 <= dx[i] + x && dx[i] + x < 12 && 0 <= dy[i] + y && dy[i] + y < 12 && maze[y + dy[i]][x + dx[i]] == 1) { dfs(y + dy[i], x + dx[i]); } } } int main() { string s; while (cin>>s) { memset(maze, 0, sizeof(maze)); if (s.size() == 0)break;//if(cin.eof())break; //1 line for (int i = 0; i < 12; i++) { maze[0][i] = s[i] - '0'; } //2-12 line for (int i = 1; i < 12; i++) { cin >> s; for (int j = 0; j < 12; j++) { maze[i][j] = s[j] - '0'; } } int ans = 0; //cout << "=======dfs???=======" << endl; //printTable(maze); //cout << "===================" << endl; //dfs for (int y = 0; y < 12; y++) { for (int x = 0; x < 12; x++) { if (maze[y][x] == 1) { dfs(y, x); ans++; } } } cout << ans << endl; //cout << "=======dfs???=======" << endl; //printTable(maze); //cout << "===================" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:32:17: error: 'memset' was not declared in this scope 32 | memset(maze, 0, sizeof(maze)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<algorithm> +++ |+#include <cstring> 4 | #include<string>
s972784947
p00067
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; int maze[12][12]; static const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 }; void printTable(int a[12][12]) { for (int i = 0; i < 12; i++) { for (int j = 0; j < 12; j++) { cout << a[i][j]; } cout << endl; } } void dfs(int y, int x) { maze[y][x] = 0; for (int i = 0; i < 4; i++) { if (0 <= dx[i] + x && dx[i] + x < 12 && 0 <= dy[i] + y && dy[i] + y < 12 && maze[y + dy[i]][x + dx[i]] == 1) { dfs(y + dy[i], x + dx[i]); } } } int main() { string s; while (cin>>s) { memset(maze, 0, sizeof(maze)); if (s.size() == 0)break;//if(cin.eof())break; //1 line for (int i = 0; i < 12; i++) { maze[0][i] = s[i] - '0'; } //2-12 line for (int i = 1; i < 12; i++) { cin >> s; for (int j = 0; j < 12; j++) { maze[i][j] = s[j] - '0'; } } int ans = 0; //cout << "=======dfs???=======" << endl; //printTable(maze); //cout << "===================" << endl; //dfs for (int y = 0; y < 12; y++) { for (int x = 0; x < 12; x++) { if (maze[y][x] == 1) { dfs(y, x); ans++; } } } cout << ans << endl; //cout << "=======dfs???=======" << endl; //printTable(maze); //cout << "===================" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:32:17: error: 'memset' was not declared in this scope 32 | memset(maze, 0, sizeof(maze)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<algorithm> +++ |+#include <cstring> 4 | #include<string>
s402521377
p00067
C++
#include <iostream> #include <queue> #include <vector> #include <map> #define COL 12 #define ROW 12 using namespace std; int dx[] = {1,-1,0,0}; int dy[] = {0,0,1,-1}; bool input(vector< vector<char> > &m); void delete_island(vector< vector< char > > &m, int x, int y); int main(){ vector< vector< char > > m(COL+2, vector<char>(ROW+2, '0')); while(input(m)){ int island = 0; for(int y = 0; y < m.size(); y++){ for(int x = 0; x < m[y].size(); x++){ if(m[y][x] == '1'){ delete_island(m,x,y); island++; } } } } cout << island << endl; } } bool input(vector< vector<char> > &m){ for(int y = 0; y < m.size(); y++){ for(int x = 0; x < m[y].size(); x++){ if(y == 0 || x == 0 || y == m.size()-1 || x == m.size()-1){ m[y][x] = '0'; }else{ if(!(cin >> m[y][x])) return false; } } } return true; } void delete_island(vector< vector< char > > &m, int x, int y){ queue< pair< int, int > > q; q.push(make_pair(x,y)); while(!(q.empty())){ pair<int, int> cur = q.front(); q.pop(); if(m[cur.second][cur.first] == '1'){ m[cur.second][cur.first] = '0'; for(int i = 0; i < 4; i++){ q.push(make_pair(cur.first+dx[i],cur.second+dy[i])); } } } }
a.cc: In function 'int main()': a.cc:31:13: error: 'island' was not declared in this scope; did you mean 'srand'? 31 | cout << island << endl; | ^~~~~~ | srand a.cc: At global scope: a.cc:33:1: error: expected declaration before '}' token 33 | } | ^
s199151051
p00067
C++
#include <iostream> using namespace std; const int N=12; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; char grid[12][12]; void dfs(char x,char y); int main(){ while(1){ int count=0; for(int y=0;y<N;y++){{ for(int x=0;x<N;x++){ cin>>grid[y]; } } } for(int y=0;y<N;y++){ for(int x=0;x<N;x++){ if(grid[y][x]=='1'){ count++; dfs(x,y); } } } cout<<count<<endl; } return 0; } void dfs(int x,int y){ grid[y][x]='0'; for(int i=0;i<4;i++){ int mx=x+dx[i]; int my=y+dy[i]; if(mx<0||my<0||N<=mx||N<=my)continue; if(grid[mx][my]=='0')continue; dfs(my,mx); } }
/usr/bin/ld: /tmp/ccJ6Ue54.o: in function `main': a.cc:(.text+0xb9): undefined reference to `dfs(char, char)' collect2: error: ld returned 1 exit status
s512777845
p00067
C++
#include<iostream> #include<vector> #include<cstdio> #include<algorithm> #include<queue> #define REP(i,n) for(int i=0;i<(n);i++) typedef vector<int> vec; typedef vector<vec> mat; typedef long long int ll; int dy[4] = { 1,0,-1,0 }, dx[4] = { 0,1,0,-1 }; static const int INF = 1 << 21; using namespace std; int N, M; char field[12][12]; void dfs(int x, int y) { int nx, ny; field[x][y] = 0; REP(i, 4) { nx = x + dx[i]; ny = y + dy[i]; if (0 <= nx&&nx < 12 && 0 <= ny&&ny < 12 && field[nx][ny] == 1)dfs(nx, ny); } } void solve() { int res; REP(i, 12) { REP(j, 12) { if (field[i][j] == 1) { dfs(i, j); res++; } } } cout << res << endl; } int main() { REP(i, 12) { REP(j, 12) { cin >> field[i][j]; } } solve(); return 0; }
a.cc:7:9: error: 'vector' does not name a type 7 | typedef vector<int> vec; | ^~~~~~ a.cc:8:9: error: 'vector' does not name a type 8 | typedef vector<vec> mat; | ^~~~~~
s535325978
p00067
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
s137704981
p00067
C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 #include<iostream> using namespace std; int island[14][14]; void field(int x,int y){ if(island[x][y] == 0) return; island[x][y] = 0; field(x+1,y); field(x-1,y); field(x,y+1); field(x,y-1); } int main(void){ int n; string s; while(cin>>s){ bool f = true; for(int i = 0 ; i < 12 ; i ++){ if(!f) cin>>s; for(int j = 0 ; j < 12 ; j ++){ island[i + 1][j + 1] = s[j]-'0'; } f = false; } int cnt = 0 ; for(int i = 1 ; i < 13 ; i ++){ for(int j = 1; j < 13 ; j ++){ if(island[i][j] == 1){ field(i,j); cnt ++; } } } cout<<cnt<<endl; getline(cin, s); } return 0; }
a.cc:2:1: error: expected unqualified-id before numeric constant 2 | 1 | ^ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:44: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared 140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared 142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:145:52: error: expected primary-expression before 'const' 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:147:54: error: expected primary-expression before 'const' 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive] 155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:156:70: error: expected primary-expression before 'const' 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive] 163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:164:72: error: expected primary-expression before 'const' 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared 171 | void operator delete(void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared 173 | void operator delete[](void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function 179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:179:51: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 179 | _GLIBCXX_NODI
s385030666
p00067
C++
#include <iostream> using namespace std; int dy[] = {1, 0, -1, 0}; int dx[] = {0, 1, 0, -1}; char field[12][12]; int W = 12; int H = 12; void DFS(int y, int x) { field[y][x] = '0'; for(int i = 0; i < 4; ++i) { int X = x + dx[i]; int Y = y + dy[i]; if((0 <= X && X < W && 0 <= Y && Y < H) && field[Y][X] == '1') { DFS(Y, X); } } } void solve() { char a; while(cin >> a) { int count = 0; memset(field, 0, sizeof(field)); field[0][0] = a; for(int i = 1; i < W; ++i) { cin >> field[0][i]; } for(int i = 1; i < H; ++i) { for(int j = 0; j < W; ++j) { cin >> field[i][j]; } } for(int i = 0; i < H; ++i) { for(int j = 0; j < W; ++j) { if(field[i][j] == '1') { DFS(i, j); count++; } } } cout << count << endl; } } int main() { solve(); return(0); }
a.cc: In function 'void solve()': a.cc:30:17: error: 'memset' was not declared in this scope 30 | memset(field, 0, sizeof(field)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 |
s439922083
p00067
C++
std::string m[12]; void d(int x,int y){ if(x>0&&m[y][x-1]-48)m[y][x-1]=48,d(x-1,y); if(x<11&&m[y][x+1]-48)m[y][x+1]=48,d(x+1,y); if(y>0&&m[y-1][x]-48)m[y-1][x]=48,d(x,y-1); if(y<11&&m[y+1][x]-48)m[y+1][x]=48,d(x,y+1); } main(){ while(1){ int y=12; for(;y;y--)std::cin>>m[y-1]; if(std::cin.eof())return 0; int r=0; for(;y<12;y++)for(int x=0;x<12;x++)if(m[y][x]-48)r++,m[y][x]=48,d(x,y); std::cout<<r<<'\n'; } }
a.cc:1:6: error: 'string' in namespace 'std' does not name a type 1 | std::string m[12]; | ^~~~~~ a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' +++ |+#include <string> 1 | std::string m[12]; a.cc: In function 'void d(int, int)': a.cc:3:17: error: 'm' was not declared in this scope 3 | if(x>0&&m[y][x-1]-48)m[y][x-1]=48,d(x-1,y); | ^ a.cc:4:18: error: 'm' was not declared in this scope 4 | if(x<11&&m[y][x+1]-48)m[y][x+1]=48,d(x+1,y); | ^ a.cc:5:17: error: 'm' was not declared in this scope 5 | if(y>0&&m[y-1][x]-48)m[y-1][x]=48,d(x,y-1); | ^ a.cc:6:18: error: 'm' was not declared in this scope 6 | if(y<11&&m[y+1][x]-48)m[y+1][x]=48,d(x,y+1); | ^ a.cc: At global scope: a.cc:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 8 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:11:33: error: 'cin' is not a member of 'std' 11 | for(;y;y--)std::cin>>m[y-1]; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | std::string m[12]; a.cc:11:38: error: 'm' was not declared in this scope 11 | for(;y;y--)std::cin>>m[y-1]; | ^ a.cc:12:25: error: 'cin' is not a member of 'std' 12 | if(std::cin.eof())return 0; | ^~~ a.cc:12:25: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:14:55: error: 'm' was not declared in this scope 14 | for(;y<12;y++)for(int x=0;x<12;x++)if(m[y][x]-48)r++,m[y][x]=48,d(x,y); | ^ a.cc:15:22: error: 'cout' is not a member of 'std' 15 | std::cout<<r<<'\n'; | ^~~~ a.cc:15:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s886462580
p00067
C++
#include <stdio.h> void dfs(int* data,int* label,int index) { int new[4][2]={{1,0},{0,1},{-1,0},{0,-1}}; int x,y; int nx,ny; int i; label[index]=1; x=index%12; y=index/12; for(i=0;i<4;i++) { nx=x+new[i][0]; ny=y+new[i][1]; if(nx<0 || nx>11 || ny<0 || ny>11) continue; if(label[nx+ny*12]==0 && data[nx+ny*12]==1) dfs(data,label,nx+ny*12); } } int main(void) { int data[200]; int count; int idx; int label[200]; char buf[50]; int i,j; while(1) { idx=0; for(i=0;i<12;i++) { if(fgets(buf,sizeof(buf),stdin)==NULL) break; for(j=0;j<12;j++) { data[idx]=buf[j]-'0'; idx++; } } /* for(i=0;i<12;i++) { for(j=0;j<12;j++) { printf("%d ",data[12*i+j]); } puts(""); } */ for(i=0;i<144;i++) label[i]=0; count=0; for(i=0;i<144;i++) { if(data[i]==1 && label[i]==0) { dfs(data,label,i); count++; } } /* for(i=0;i<144;i++) { if(i%12==0) puts(""); printf("%d",label[i]); } */ fgets(buf,sizeof(buf),stdin); printf("%d\n",count); } return 0; }
a.cc: In function 'void dfs(int*, int*, int)': a.cc:5:7: error: expected unqualified-id before 'new' 5 | int new[4][2]={{1,0},{0,1},{-1,0},{0,-1}}; | ^~~ a.cc:19:13: error: expected type-specifier before '[' token 19 | nx=x+new[i][0]; | ^ a.cc:20:13: error: expected type-specifier before '[' token 20 | ny=y+new[i][1]; | ^
s720419073
p00067
C++
#include <cstdio> void dfs(int x, int y); char data[16][16]; int main(void) { char c; while (1){ for (int i = 0; i < 12; i++){ cin >> data[i]; } if (cin.eof()) return (0); int res = 0; for (int i = 0; i < 12; i++){ for (int j = 0; j < 12; j++){ if (data[i][j] == '1'){ dfs(i, j); res++; } } } printf("%d\n", res); scanf("%c", &c); } return (0); } void dfs(int x, int y) { data[x][y] = '0'; if (data[x - 1][y] == '1' && 0 <= (x - 1)){ dfs(x - 1, y); } if (data[x + 1][y] == '1'){ dfs(x + 1, y); } if (data[x][y - 1] == '1' && 0 <= (y - 1)){ dfs(x, y - 1); } if (data[x][y + 1] == '1'){ dfs(x, y + 1); } return; }
a.cc: In function 'int main()': a.cc:13:25: error: 'cin' was not declared in this scope 13 | cin >> data[i]; | ^~~ a.cc:15:21: error: 'cin' was not declared in this scope 15 | if (cin.eof()) return (0); | ^~~
s470237156
p00067
C++
#include<iostream> #include<string> #include<cstring> using namespace std; int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1}, ret=0; bool checked[12][12], f[12][12]; void bfs(int x, int y){ checked[x][y] = true; for(int i=0;i<4;i++){ if((0<=x+dx[i]&&x+dx[i]<=11&&0<=y+dy[i]&&y+dy[i]<=11){ if(chked[x+dx[i]][y+dy[i]] == false && f[x+dx[i]][y+dy[i]] == 1){ bfs(x+dx[i], y+dy[i]); } } } int main(){ string str; while(getline(cin,str)){ memset(checked, 0, sizeof(checked)); ret = 0; if(str.empty()) continue; for(int i=0;i<12;i++){ for(int j=0;j<12;j++){ f[i][j] = str[j] - '0'; } getline(cin,str); } for(int i=0;i<12;i++){ for(int j=0;j<12;j++){ if(f[i][j] == 1 && chked[i][j] == false){ bfs(i,j); ret++; } } } cout << ret << endl; }
a.cc: In function 'void bfs(int, int)': a.cc:10:58: error: expected ')' before '{' token 10 | if((0<=x+dx[i]&&x+dx[i]<=11&&0<=y+dy[i]&&y+dy[i]<=11){ | ~ ^ | ) a.cc:15:1: error: expected primary-expression before '}' token 15 | } | ^ a.cc:16:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 16 | int main(){ | ^~ a.cc:16:9: note: remove parentheses to default-initialize a variable 16 | int main(){ | ^~ | -- a.cc:16:9: note: or replace parentheses with braces to value-initialize a variable a.cc:16:11: error: a function-definition is not allowed here before '{' token 16 | int main(){ | ^ a.cc:37:4: error: expected '}' at end of input 37 | } | ^ a.cc:7:23: note: to match this '{' 7 | void bfs(int x, int y){ | ^
s630117806
p00067
C++
#include<iostream> #include<string> #include<cstring> using namespace std; int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1}, ret=0; bool checked[12][12], f[12][12]; void bfs(int x, int y){ checked[x][y] = true; for(int i=0;i<4;i++){ if((0<=x+dx[i]&&x+dx[i]<=11&&0<=y+dy[i]&&y+dy[i]<=11){ if(chked[x+dx[i]][y+dy[i]] == false && f[x+dx[i]][y+dy[i]] == 1){ bfs(x+dx[i], y+dy[i]); } } } int main(){ string str; while(getline(cin,str)){ memset(checked, 0, sizeof(checked)); ret = 0; if(str.empty()) continue; for(int i=0;i<12;i++){ for(int j=0;j<12;j++){ f[i][j] = str[j] - '0'; } getline(cin,str); } for(int i=0;i<12;i++){ for(int j=0;j<12;j++){ if(f[i][j] == 1 && chked[i][j] == false){ bfs(i,j); ret++; } } } cout << ret << endl; }
a.cc: In function 'void bfs(int, int)': a.cc:10:58: error: expected ')' before '{' token 10 | if((0<=x+dx[i]&&x+dx[i]<=11&&0<=y+dy[i]&&y+dy[i]<=11){ | ~ ^ | ) a.cc:15:1: error: expected primary-expression before '}' token 15 | } | ^ a.cc:16:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 16 | int main(){ | ^~ a.cc:16:9: note: remove parentheses to default-initialize a variable 16 | int main(){ | ^~ | -- a.cc:16:9: note: or replace parentheses with braces to value-initialize a variable a.cc:16:11: error: a function-definition is not allowed here before '{' token 16 | int main(){ | ^ a.cc:37:4: error: expected '}' at end of input 37 | } | ^ a.cc:7:23: note: to match this '{' 7 | void bfs(int x, int y){ | ^
s787218952
p00067
C++
#include <iostream> #include <cstdlib> #include <algorithm> using namespace std; int field[12+2][12+2] ={0}; void island(int x,int y) { int dx[4] = {1,0,-1,0}; int dy[4] = {0,-1,0,1}; field[x][y] = 0; for(int i=0;i<4;i++) { if(field[x+dx[i]][y+dy[i]] == 1) { island(x+dx[i],y+dy[i]); } } } int main() { string str; int ans = 0; while(!cin.eof()) { for(int i=0;i<12;i++) { getline(cin,str); for(int j=0;j<12;j++) { field[i+1][j+1] = atoi(str.substr(j,1).c_str()); } } for(int i=0;i<12;i++) { for(int j=0;j<12;j++) { if(field[i+1][j+1] == 1) { island(i+1,j+1); ans++; } } } cout << ans << endl; ans = 0; // int field[12+2][12+2] ={0}; memset(field,0,sizeof(field)); getline(cin,str);//erase \n } return 0; }
a.cc: In function 'int main()': a.cc:42:5: error: 'memset' was not declared in this scope 42 | memset(field,0,sizeof(field)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | using namespace std;
s927288700
p00067
C++
#include <iostream> #include <cstdlib> #include <algorithm> #include <stdio.h> using namespace std; int field[12+2][12+2] ={0}; void island(int x,int y) { int dx[4] = {1,0,-1,0}; int dy[4] = {0,-1,0,1}; field[x][y] = 0; for(int i=0;i<4;i++) { if(field[x+dx[i]][y+dy[i]] == 1) { island(x+dx[i],y+dy[i]); } } } int main() { string str; int ans = 0; while(!cin.eof()) { for(int i=0;i<12;i++) { getline(cin,str); for(int j=0;j<12;j++) { field[i+1][j+1] = atoi(str.substr(j,1).c_str()); } } for(int i=0;i<12;i++) { for(int j=0;j<12;j++) { if(field[i+1][j+1] == 1) { island(i+1,j+1); ans++; } } } cout << ans << endl; ans = 0; // int field[12+2][12+2] ={0}; memset(field,0,sizeof(field)); getline(cin,str);//erase \n } return 0; }
a.cc: In function 'int main()': a.cc:43:5: error: 'memset' was not declared in this scope 43 | memset(field,0,sizeof(field)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | #include <stdio.h>
s129359830
p00067
C++
#include <cstdio> #include <queue> #include <algorithm> using namespace std; typedef pair<int,int> P; queue<P>que; #define mp make_pair #define f first #define s second char field[105][105]; int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1}; int n,m,ans=0; bool in(int c,int d){ if(c>=1 && c<=n){ if(d>=1 && d<=m){ return true; } } return false; } void dfs(int a,int b){ que.push(mp(a,b)); while(que.size()){ P p=que.front(); que.pop(); for(int i=0;i<4;i++){ if(field[p.f+dx[i]][p.s+dy[i]]=='W' && in(p.f+dx[i],p.s+dy[i])){ que.push(mp(p.f+dx[i],p.s+dy[i])); field[p.f+dx[i]][p.s+dy[i]]='.'; } } } } int main(){ int n; for(int i=1;;i++){ gets(field[i]); if(field[i][0]==' '){ n=i-1; break; } } int m=strlen(field[1]); for(int i=1;i<=n;i++){ for(int j=m;j>=1;j--){ field[i][j]=field[i][j-1]; } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(field[i][j]=='W'){ dfs(i,j); ans++; } } } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:36:17: error: 'gets' was not declared in this scope; did you mean 'getw'? 36 | gets(field[i]); | ^~~~ | getw a.cc:42:15: error: 'strlen' was not declared in this scope 42 | int m=strlen(field[1]); | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | using namespace std;
s585540009
p00067
C++
#include <cstdio> #include <string> using namespace std; int ild[12][12]; void erase_island(int i, int j, int (&ild)[12][12]) { ild[i][j] = -1; if(i - 1 >= 0){ if(ild[i - 1][j] == 1) erase_island(i - 1, j, ild); } if(i + 1 < 12){ if(ild[i + 1][j] == 1) erase_island(i + 1, j, ild); } if(j - 1 >= 0){ if(ild[i][j - 1] == 1) erase_island(i, j - 1, ild); } if(j + 1 < 12){ if(ild[i][j + 1] == 1) erase_island(i, j + 1, ild); } } int main() { string str; int cont = 0; int i, j, k = 0; while(1) { if(k > 19) break; for(i = 0; i < 12; i++){ cin >> str; if(str[0] == EOF) break; for(j = 0; j < 12; j++){ ild[i][j] = (str[j] == '1')? 1: 0; } } if(str[0] == EOF) break; for(i = 0; i < 12; i++){ for(j = 0; j < 12; j++){ if(ild[i][j] == 1){ cont++; erase_island(i, j, ild); } else if(ild[i][j] == 0) ild[i][j] == -1; } } cout << cont << endl; k++; } return 0; }
a.cc: In function 'int main()': a.cc:41:25: error: 'cin' was not declared in this scope 41 | cin >> str; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <string> +++ |+#include <iostream> 3 | a.cc:63:17: error: 'cout' was not declared in this scope 63 | cout << cont << endl; | ^~~~ a.cc:63:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:63:33: error: 'endl' was not declared in this scope 63 | cout << cont << endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <string> +++ |+#include <ostream> 3 |
s791269618
p00068
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.awt.geom.Point2D; import java.util.Arrays; import java.util.ArrayList; import java.util.Comparator; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; ArrayList<Point2D> array; while((line=br.readLine()!=null){ int n=Integer.parseInt(line); Point2D[] points=new Point2D[n]; for(int i=0;i<n;i++){ line=br.readLine(); String[] values=line.split(","); points[i]=new Point2D.Double(Double.parseDouble(values[0]),Double.parseDouble(values[1])); } Arrays.sort(points,new Comparator<Point2D>(){ public int compare(Point2D p1,Point2D p2){ return (p1.getY()>p2.getY())?1:(p1.getY()<p2.getY())?-1:(p1.getX()>p2.getX())?1:(p1.getX()<p2.getX())?-1:0; } }); array=new ArrayList<Point2D>(); Point2D start=points[0]; array.add(now); double px=start.getX(); double py=start.getY(); Point2D prev=start; while(true){ Point2D min=null; double minx=0; double miny=0; double maxcos=-1; for(Point2D p : points){ if(p==prev){ continue; } double nx=p.getX()-prev.getX(); double ny=p.getY()-prev.getY(); double cos=(px*nx+py*ny)/(Math.hypot(px,py)*Math.hypot(nx,ny)); if(cos>maxcos){ maxcos=cos; minx=nx; miny=ny; min=p; } } if(min==start){ break; } px=minx; py=miny; prev=min; array.add(min); } System.out.println(points.length()-array.size()); } } }
Main.java:14: error: ')' expected while((line=br.readLine()!=null){ ^ 1 error
s754087450
p00068
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.awt.geom.Point2D; import java.util.Arrays; import java.util.ArrayList; import java.util.Comparator; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; ArrayList<Point2D> array; while((line=br.readLine()!=null){ int n=Integer.parseInt(line); Point2D[] points=new Point2D[n]; for(int i=0;i<n;i++){ line=br.readLine(); String[] values=line.split(","); points[i]=new Point2D.Double(Double.parseDouble(values[0]),Double.parseDouble(values[1])); } Arrays.sort(points,new Comparator<Point2D>(){ public int compare(Point2D p1,Point2D p2){ return (p1.getY()>p2.getY())?1:(p1.getY()<p2.getY())?-1:(p1.getX()>p2.getX())?1:(p1.getX()<p2.getX())?-1:0; } }); array=new ArrayList<Point2D>(); Point2D start=points[0]; array.add(now); double px=start.getX(); double py=start.getY(); Point2D prev=start; while(true){ Point2D min=null; double minx=0; double miny=0; double maxcos=-1; for(Point2D p : points){ if(p==prev){ continue; } double nx=p.getX()-prev.getX(); double ny=p.getY()-prev.getY(); double cos=(px*nx+py*ny)/(Math.hypot(px,py)*Math.hypot(nx,ny)); if(cos>maxcos){ maxcos=cos; minx=nx; miny=ny; min=p; } } if(min==start){ break; } px=minx; py=miny; prev=min; array.add(min); } System.out.println(points.length()-array.size()); } } }
Main.java:14: error: ')' expected while((line=br.readLine()!=null){ ^ 1 error
s336061812
p00068
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.awt.geom.Point2D; import java.util.Arrays; import java.util.ArrayList; import java.util.Comparator; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; ArrayList<Point2D> array; while((line=br.readLine())!=null){ int n=Integer.parseInt(line); Point2D[] points=new Point2D[n]; for(int i=0;i<n;i++){ line=br.readLine(); String[] values=line.split(","); points[i]=new Point2D.Double(Double.parseDouble(values[0]),Double.parseDouble(values[1])); } Arrays.sort(points,new Comparator<Point2D>(){ public int compare(Point2D p1,Point2D p2){ return (p1.getY()>p2.getY())?1:(p1.getY()<p2.getY())?-1:(p1.getX()>p2.getX())?1:(p1.getX()<p2.getX())?-1:0; } }); array=new ArrayList<Point2D>(); Point2D start=points[0]; array.add(now); double px=start.getX(); double py=start.getY(); Point2D prev=start; while(true){ Point2D min=null; double minx=0; double miny=0; double maxcos=-1; for(Point2D p : points){ if(p==prev){ continue; } double nx=p.getX()-prev.getX(); double ny=p.getY()-prev.getY(); double cos=(px*nx+py*ny)/(Math.hypot(px,py)*Math.hypot(nx,ny)); if(cos>maxcos){ maxcos=cos; minx=nx; miny=ny; min=p; } } if(min==start){ break; } px=minx; py=miny; prev=min; array.add(min); } System.out.println(points.length()-array.size()); } } }
Main.java:29: error: cannot find symbol array.add(now); ^ symbol: variable now location: class Main Main.java:60: error: cannot find symbol System.out.println(points.length()-array.size()); ^ symbol: method length() location: variable points of type Point2D[] 2 errors
s968834208
p00068
Java
import java.io.InputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; public class Main{ static PrintWriter out; static InputReader ir; static void solve(){ while(true){ int n=ir.nextInt(); if(n==0) return; P[] ps=new P[n]; for(int i=0;i<n;i++){ ps[i]=new P(ir.nextDouble(),ir.nextDouble()); } P[] c=convexHull(ps); out.println(ps.length-c.length); System.gc(); } } public static P[] convexHull(P[] ps){ int n=ps.length; Arrays.sort(ps,new Comparator<P>(){ public int compare(P a,P b){ if(a.getX()!=b.getY()) return Double.compare(a.getX(),b.getX()); return Double.compare(a.getY(),b.getY()); } }); int p=0; P[] qs=new P[2*n]; for(int i=0;i<n;i++){ while(p>1&&(qs[p-1].sub(qs[p-2])).det(ps[i].sub(qs[p-1]))<=0) p--; qs[p++]=ps[i]; } for(int i=n-2,t=p;i>=0;i--){ while(p>t&&(qs[p-1].sub(qs[p-2])).det(ps[i].sub(qs[p-1]))<=0) p--; qs[p++]=ps[i]; } return Arrays.copyOf(qs,p-1); } static final double EPS=1e-10; public static accurateTotal(double a,double b){ if(Math.abs(a+b)<EPS*(Math.abs(a)+Math.abs(b))) return 0.0; return a+b; } static class P{ public double x,y; public P(double x,double y){ this.x=x; this.y=y; } public double getX(){ return this.x; } public double getY(){ return this.Y; } public P add(P v){ return new P(accurateTotal(this.x,v.x),accurateTotal(this.y,v.y)); } public P sub(P v){ return new P(accurateTotal(this.x,-v.x),accurateTotal(this.y,-v.y)); } public P mul(double k){ return new P(this.x*k,this.y*k); } public double dot(P v){ return accurateTotal(this.x*v.x,this.y*v.y); } public double det(P v){ return accurateTotal(this.x*v.y,-this.y*v.x); } } public static void main(String[] args) throws Exception{ ir=new InputReader(System.in); out=new PrintWriter(System.out); solve(); out.flush(); } static class InputReader { private InputStream in; private byte[] buffer=new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;} public boolean hasNextByte() { if(curbuf>=lenbuf){ curbuf= 0; try{ lenbuf=in.read(buffer); }catch(IOException e) { throw new InputMismatchException(); } if(lenbuf<=0) return false; } return true; } private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;} private boolean isSpaceChar(int c){return !(c>=33&&c<=126)||(c==',');} private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;} public boolean hasNext(){skip(); return hasNextByte();} public String next(){ if(!hasNext()) throw new NoSuchElementException(); StringBuilder sb=new StringBuilder(); int b=readByte(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString(); } public int nextInt() { if(!hasNext()) throw new NoSuchElementException(); int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } int res=0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public long nextLong() { if(!hasNext()) throw new NoSuchElementException(); int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } long res = 0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public double nextDouble(){return Double.parseDouble(next());} public BigInteger nextBigInteger(){return new BigInteger(next());} public int[] nextIntArray(int n){ int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); return a; } public long[] nextLongArray(int n){ long[] a=new long[n]; for(int i=0;i<n;i++) a[i]=nextLong(); return a; } public char[][] nextCharMap(int n,int m){ char[][] map=new char[n][m]; for(int i=0;i<n;i++) map[i]=next().toCharArray(); return map; } } }
Main.java:53: error: invalid method declaration; return type required public static accurateTotal(double a,double b){ ^ 1 error
s629583829
p00068
Java
import java.io.InputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; public class Main{ static PrintWriter out; static InputReader ir; static void solve(){ while(true){ int n=ir.nextInt(); if(n==0) return; P[] ps=new P[n]; for(int i=0;i<n;i++){ ps[i]=new P(ir.nextDouble(),ir.nextDouble()); } P[] c=convexHull(ps); out.println(ps.length-c.length); System.gc(); } } public static P[] convexHull(P[] ps){ int n=ps.length; Arrays.sort(ps,new Comparator<P>(){ public int compare(P a,P b){ if(a.getX()!=b.getY()) return Double.compare(a.getX(),b.getX()); return Double.compare(a.getY(),b.getY()); } }); int p=0; P[] qs=new P[2*n]; for(int i=0;i<n;i++){ while(p>1&&(qs[p-1].sub(qs[p-2])).det(ps[i].sub(qs[p-1]))<=0) p--; qs[p++]=ps[i]; } for(int i=n-2,t=p;i>=0;i--){ while(p>t&&(qs[p-1].sub(qs[p-2])).det(ps[i].sub(qs[p-1]))<=0) p--; qs[p++]=ps[i]; } return Arrays.copyOf(qs,p-1); } static final double EPS=1e-10; public static double accurateTotal(double a,double b){ if(Math.abs(a+b)<EPS*(Math.abs(a)+Math.abs(b))) return 0.0; return a+b; } static class P{ public double x,y; public P(double x,double y){ this.x=x; this.y=y; } public double getX(){ return this.x; } public double getY(){ return this.Y; } public P add(P v){ return new P(accurateTotal(this.x,v.x),accurateTotal(this.y,v.y)); } public P sub(P v){ return new P(accurateTotal(this.x,-v.x),accurateTotal(this.y,-v.y)); } public P mul(double k){ return new P(this.x*k,this.y*k); } public double dot(P v){ return accurateTotal(this.x*v.x,this.y*v.y); } public double det(P v){ return accurateTotal(this.x*v.y,-this.y*v.x); } } public static void main(String[] args) throws Exception{ ir=new InputReader(System.in); out=new PrintWriter(System.out); solve(); out.flush(); } static class InputReader { private InputStream in; private byte[] buffer=new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;} public boolean hasNextByte() { if(curbuf>=lenbuf){ curbuf= 0; try{ lenbuf=in.read(buffer); }catch(IOException e) { throw new InputMismatchException(); } if(lenbuf<=0) return false; } return true; } private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;} private boolean isSpaceChar(int c){return !(c>=33&&c<=126)||(c==',');} private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;} public boolean hasNext(){skip(); return hasNextByte();} public String next(){ if(!hasNext()) throw new NoSuchElementException(); StringBuilder sb=new StringBuilder(); int b=readByte(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString(); } public int nextInt() { if(!hasNext()) throw new NoSuchElementException(); int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } int res=0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public long nextLong() { if(!hasNext()) throw new NoSuchElementException(); int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } long res = 0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public double nextDouble(){return Double.parseDouble(next());} public BigInteger nextBigInteger(){return new BigInteger(next());} public int[] nextIntArray(int n){ int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); return a; } public long[] nextLongArray(int n){ long[] a=new long[n]; for(int i=0;i<n;i++) a[i]=nextLong(); return a; } public char[][] nextCharMap(int n,int m){ char[][] map=new char[n][m]; for(int i=0;i<n;i++) map[i]=next().toCharArray(); return map; } } }
Main.java:71: error: cannot find symbol return this.Y; ^ symbol: variable Y 1 error
s459733479
p00068
Java
import java.io.InputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; public class Main{ static PrintWriter out; static InputReader ir; static void solve(){ while(true){ int n=ir.nextInt(); if(n==0) return; P[] ps=new P[n]; for(int i=0;i<n;i++){ ps[i]=new P(ir.nextDouble(),ir.nextDouble()); } P[] c=convexHull(ps); out.println(ps.length-c.length); System.gc(); } } public static P[] convexHull(P[] ps){ int n=ps.length; Arrays.sort(ps,new Comparator<P>(){ public int compare(P a,P b){ if(a.getX()!=b.getY()) return Double.compare(a.getX(),b.getX()); return Double.compare(a.getY(),b.getY()); } }); int p=0; P[] qs=new P[2*n]; for(int i=0;i<n;i++){ while(p>1&&(qs[p-1].sub(qs[p-2])).det(ps[i].sub(qs[p-1]))<=0) p--; qs[p++]=ps[i]; } for(int i=n-2,t=p;i>=0;i--){ while(p>t&&(qs[p-1].sub(qs[p-2])).det(ps[i].sub(qs[p-1]))<=0) p--; qs[p++]=ps[i]; } return Arrays.copyOf(qs,p-1); } static final double EPS=1e-10; public static accurateTotal(double a,double b){ if(Math.abs(a+b)<EPS*(Math.abs(a)+Math.abs(b))) return 0.0; return a+b; } static class P{ public double x,y; public P(double x,double y){ this.x=x; this.y=y; } public double getX(){ return this.x; } public double getY(){ return this.y; } public P add(P v){ return new P(accurateTotal(this.x,v.x),accurateTotal(this.y,v.y)); } public P sub(P v){ return new P(accurateTotal(this.x,-v.x),accurateTotal(this.y,-v.y)); } public P mul(double k){ return new P(this.x*k,this.y*k); } public double dot(P v){ return accurateTotal(this.x*v.x,this.y*v.y); } public double det(P v){ return accurateTotal(this.x*v.y,-this.y*v.x); } } public static void main(String[] args) throws Exception{ ir=new InputReader(System.in); out=new PrintWriter(System.out); solve(); out.flush(); } static class InputReader { private InputStream in; private byte[] buffer=new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;} public boolean hasNextByte() { if(curbuf>=lenbuf){ curbuf= 0; try{ lenbuf=in.read(buffer); }catch(IOException e) { throw new InputMismatchException(); } if(lenbuf<=0) return false; } return true; } private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;} private boolean isSpaceChar(int c){return !(c>=33&&c<=126)||(c==',');} private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;} public boolean hasNext(){skip(); return hasNextByte();} public String next(){ if(!hasNext()) throw new NoSuchElementException(); StringBuilder sb=new StringBuilder(); int b=readByte(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString(); } public int nextInt() { if(!hasNext()) throw new NoSuchElementException(); int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } int res=0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public long nextLong() { if(!hasNext()) throw new NoSuchElementException(); int c=readByte(); while (isSpaceChar(c)) c=readByte(); boolean minus=false; if (c=='-') { minus=true; c=readByte(); } long res = 0; do{ if(c<'0'||c>'9') throw new InputMismatchException(); res=res*10+c-'0'; c=readByte(); }while(!isSpaceChar(c)); return (minus)?-res:res; } public double nextDouble(){return Double.parseDouble(next());} public BigInteger nextBigInteger(){return new BigInteger(next());} public int[] nextIntArray(int n){ int[] a=new int[n]; for(int i=0;i<n;i++) a[i]=nextInt(); return a; } public long[] nextLongArray(int n){ long[] a=new long[n]; for(int i=0;i<n;i++) a[i]=nextLong(); return a; } public char[][] nextCharMap(int n,int m){ char[][] map=new char[n][m]; for(int i=0;i<n;i++) map[i]=next().toCharArray(); return map; } } }
Main.java:53: error: invalid method declaration; return type required public static accurateTotal(double a,double b){ ^ 1 error
s972475266
p00068
C
typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);}
main.c:1:16: error: expected specifier-qualifier-list before 'doublex' 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^~~~~~~ main.c:1:45: warning: data definition has no type or storage class 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^ main.c:1:45: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] main.c:1:47: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^ main.c:1:49: error: type defaults to 'int' in declaration of 'v' [-Wimplicit-int] 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^ main.c:1:56: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int] 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^ main.c:1:58: error: return type defaults to 'int' [-Wimplicit-int] 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^ main.c: In function 'z': main.c:1:77: error: 'w' has no member named 'key' 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^~ main.c:1:84: error: 'w' has no member named 'key' 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^~ main.c:1:94: error: 'w' has no member named 'key' 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^~ main.c:1:101: error: 'w' has no member named 'key' 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^~ main.c: At top level: main.c:1:108: error: return type defaults to 'int' [-Wimplicit-int] 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^~~~~~~~~~~ main.c: In function 'doubleouter': main.c:1:108: error: type of 'q' defaults to 'int' [-Wimplicit-int] main.c:1:108: error: type of 'r' defaults to 'int' [-Wimplicit-int] main.c:1:108: error: type of 's' defaults to 'int' [-Wimplicit-int] main.c:1:138: error: 'w' has no member named 'x' 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^ main.c:1:146: error: 'w' has no member named 'y' 1 | typedef struct{doublex,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}doubleouter(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){doublek,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n
s629961828
p00068
C
typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);}
main.c:1:46: warning: data definition has no type or storage class 1 | typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^ main.c:1:46: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] main.c:1:48: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 1 | typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^ main.c:1:50: error: type defaults to 'int' in declaration of 'v' [-Wimplicit-int] 1 | typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^ main.c:1:57: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int] 1 | typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^ main.c:1:59: error: return type defaults to 'int' [-Wimplicit-int] 1 | typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^ main.c: In function 'outer': main.c:1:116: error: type of 'q' defaults to 'int' [-Wimplicit-int] 1 | typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^~~~~ main.c:1:116: error: type of 'r' defaults to 'int' [-Wimplicit-int] main.c:1:116: error: type of 's' defaults to 'int' [-Wimplicit-int] main.c: At top level: main.c:1:206: error: return type defaults to 'int' [-Wimplicit-int] 1 | typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^~~~ main.c: In function 'main': main.c:1:230: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} main.c:1:230: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^~~~~ main.c:1:230: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:503: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration] 1 | typedef struct{double x,y,key;}w;w p[101],bs;i,m,v[100],n;z(w*c,w*d){return c->key>d->key?-1:c->key<d->key;}double outer(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(){double k,t;for(;~scanf("%d",&n),n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;bs=p[m];p[m]=*p;*p=bs;p[100].x=bs.x;p[100].y=bs.y+1;for(i=1;i<n;i++){k=outer(0,i,100);t=(p[i].x-bs.x)*(p[i].x-bs.x)+(p[i].y-bs.y)*(p[i].y-bs.y);k*=k/t;if(bs.x>p[i].x)k=-k;p[i].key=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;outer(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}exit(0);} | ^~~~~ main.c:1:549: error: 'j' undeclared (first use in this function) 1 | typedef struct{double x,y,key;}w;w p[101]
s582603204
p00068
C
typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}}
main.c:1:43: warning: data definition has no type or storage class 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ main.c:1:43: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] main.c:1:45: error: type defaults to 'int' in declaration of 'v' [-Wimplicit-int] 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ main.c:1:52: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int] 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ main.c:1:54: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int] 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ main.c:1:56: error: type defaults to 'int' in declaration of 'r' [-Wimplicit-int] 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ main.c:1:58: error: return type defaults to 'int' [-Wimplicit-int] 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ main.c:1:159: error: return type defaults to 'int' [-Wimplicit-int] 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^~~~ main.c: In function 'main': main.c:1:159: error: type of 'i' defaults to 'int' [-Wimplicit-int] main.c:1:174: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} main.c:1:174: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^~~~~ main.c:1:174: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:316: error: implicit declaration of function 'hypot' [-Wimplicit-function-declaration] 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^~~~~ main.c:1:1: note: include '<math.h>' or provide a declaration of 'hypot' +++ |+#include <math.h> 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} main.c:1:316: warning: incompatible implicit declaration of built-in function 'hypot' [-Wbuiltin-declaration-mismatch] 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^~~~~ main.c:1:316: note: include '<math.h>' or provide a declaration of 'hypot' main.c:1:345: error: implicit declaration of function 'qsort' [-Wimplicit-function-declaration] 1 | typedef struct{double x,y,k;}w;w p[100],b;m,v[100],n,j,r;z(w*c,w*d){r=c->k>d->k?-1:1;}double o(w q,w r,w s){return q.x*(r.y-s.y)+r.x*(s.y-q.y)+s.x*(q.y-r.y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;for(i=1;i<n;i++)p[i].k=(p[i].x-b.x)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,24,z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(w[v[j-1]],w[v[j]],w[i])<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} |
s196643979
p00068
C
#include <stdio.h> #include <string.h> #include <math.h> struct POINT{ double x,y; }; double area(double a,double b,double c){ double s; s = (a+b+c)/2.0; return sqrt(s*(s-a)*(s-b)*(s-c)); } int main(){ int h,i,j,k,l,n,cnt; int flag[100]; double len[6],s[4]; POINT p[4]; POINT pin[100]; while(1){ scanf("%d",&n); if(!n){ break; } for(i = 0;i < n;i++){ scanf("%lf,%lf",&pin[i].x,&pin[i].y); } memset(flag,0,sizeof(flag)); for(i = 0;i < n;i++){ if(flag[i]){ continue; } p[0] = pin[i]; for(j = 0;j < n;j++){ if(i == j || flag[j]){ continue; } p[1] = pin[j]; for(k = 0;k < n;k++){ if(i == k || j == k || flag[k]){ continue; } p[2] = pin[k]; for(h = 0;h < 3;h++){ len[h] = sqrt(pow(p[(h+1)%3].x-p[h].x,2)+pow(p[(h+1)%3].y-p[h].y,2)); } s[3] = area(len[0],len[1],len[2]); for(l = 0;l < n;l++){ if(i == l || j == l || k == l || flag[l]){ continue; } p[3] = pin[l]; for(h = 0;h < 3;h++){ len[3+h] = sqrt(pow(p[3].x-p[h].x,2)+pow(p[3].y-p[h].y,2)); } for(h = 0;h < 3;h++){ s[h] = area(len[h],len[3+h],len[(h+1)%3+3]); } if(fabs(s[3]-s[0]-s[1]-s[2])/(s[0]+s[1]+s[2]) < 1e-5){ flag[l] = 1; } } } } } cnt = 0; for(i = 0;i < n;i++){ if(flag[i]){ cnt++; } } printf("%d\n",cnt); } return 0; }
main.c: In function 'main': main.c:21:9: error: unknown type name 'POINT'; use 'struct' keyword to refer to the type 21 | POINT p[4]; | ^~~~~ | struct main.c:22:9: error: unknown type name 'POINT'; use 'struct' keyword to refer to the type 22 | POINT pin[100]; | ^~~~~ | struct main.c:30:48: error: request for member 'x' in something not a structure or union 30 | scanf("%lf,%lf",&pin[i].x,&pin[i].y); | ^ main.c:30:58: error: request for member 'y' in something not a structure or union 30 | scanf("%lf,%lf",&pin[i].x,&pin[i].y); | ^ main.c:51:85: error: request for member 'x' in something not a structure or union 51 | len[h] = sqrt(pow(p[(h+1)%3].x-p[h].x,2)+pow(p[(h+1)%3].y-p[h].y,2)); | ^ main.c:51:92: error: request for member 'x' in something not a structure or union 51 | len[h] = sqrt(pow(p[(h+1)%3].x-p[h].x,2)+pow(p[(h+1)%3].y-p[h].y,2)); | ^ main.c:51:112: error: request for member 'y' in something not a structure or union 51 | len[h] = sqrt(pow(p[(h+1)%3].x-p[h].x,2)+pow(p[(h+1)%3].y-p[h].y,2)); | ^ main.c:51:119: error: request for member 'y' in something not a structure or union 51 | len[h] = sqrt(pow(p[(h+1)%3].x-p[h].x,2)+pow(p[(h+1)%3].y-p[h].y,2)); | ^ main.c:60:81: error: request for member 'x' in something not a structure or union 60 | len[3+h] = sqrt(pow(p[3].x-p[h].x,2)+pow(p[3].y-p[h].y,2)); | ^ main.c:60:88: error: request for member 'x' in something not a structure or union 60 | len[3+h] = sqrt(pow(p[3].x-p[h].x,2)+pow(p[3].y-p[h].y,2)); | ^ main.c:60:102: error: request for member 'y' in something not a structure or union 60 | len[3+h] = sqrt(pow(p[3].x-p[h].x,2)+pow(p[3].y-p[h].y,2)); | ^ main.c:60:109: error: request for member 'y' in something not a structure or union 60 | len[3+h] = sqrt(pow(p[3].x-p[h].x,2)+pow(p[3].y-p[h].y,2)); | ^
s527200284
p00068
C++
#include<cstdio> #include<algorithm> #include<vector> #include<string> #include<iostream> #include<queue> #include<map> #include<set> #include<complex> #include<stack> #include<cmath> using namespace std; #define reps(i,f,n) for(int i=f;i<int(n);i++) #define rep(i,n) reps(i,0,n) #define X real() #define Y imag() typedef complex<double> P; bool operator<(const P &a, const P &b){return a.X==b.X ? a.Y<b.Y : a.X<b.X;} double cross(P a,P b){return a.X*b.Y-a.Y*b.X;} bool ccw(P a,P b,P c){return cross(b-a,c-a)>=0;} vector<P> convex_VP(vector<P> p){ sort(p.begin(),p.end()); vector<P> ret(p.size()*2); int k=0; for(int i=0;i<p.size();i++){ while(k>1 && !ccw(ret[k-2],ret[k-1],p[i]))k--; ret[k]=p[i];k++; } int t=k; for(int i=p.size()-2;i>=0;i--){ while(k>t && !ccw(ret[k-2],ret[k-1],p[i]))k--; ret[k]=p[i];k++; } return vector<P>(ret.begin(), ret.begin()+k-1); } int main(){ while(1){ int n; cin>>n; if(n==0)break; vector<P> p; rep(i,n){ double a,b; scanf("%lf,%lf",&a,&b); p.push_back(P(a,b)); } vector<P> convex = convex_VP(p); rep(i,convex.size()){ printf("%lf %lf\n",convex[i].X,convex[i].Y); } cout<<(int)p.size()-(int)convex.size()<<endl; } }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]': /usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1777 | if (__comp(__i, __first)) | ~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:30:6: required from here 30 | sort(p.begin(),p.end()); | ~~~~^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>') 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)' 1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)' 1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/vector:66, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h:2089:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2089 | operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2089:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::vector<_Tp, _Alloc>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/vector:87: /usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::tuple<_UTypes ...>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from a.cc:4: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:
s881597423
p00068
C++
#include <iostream> #include <string> #include <sstream> #include <algorithm> #include <vector> #include <utility> #include <cstdio> #include <cstring> #include <cmath> #include <map> #include <set> #include <stack> #include <queue> using namespace std; #define pb(n) push_back(n) #define mp(n,m) make_pair(n,m) #define fi first #define se second #define all(r) (r).begin(),(r).end() #define REP(i,s,e) for(int i=(s); i<(e); i++) #define rep(i,n) REP(i,0,n) #define REPE(i,s,e) for(int i=s; i>e; i--) #define repe(i,n) REPE(i,n,-1) typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<vi> vii; const int IMAX=((1<<30)-1)*2+1; const int INF=100000000; const double EPS=1e-10; //int mod=1000000007 //??????????±??????? // ??????????????????????¶???????????????? double add(double a,double b){ if(abs(a + b) < EPS * (abs(a) + abs(b))) return 0; return a + b; } // ????¬?????????????????§??????? struct P { double x,y; P(){} P(double x,double y) : x(x), y(y){ } P operator + (P p){ return P(add(x, p.x), add(y, p.y)); } P operator - (P p){ return P(add(x, -p.x), add(y, -p.y)); } P operator * (double d){ return P(x * d, y * d); } double dot(P p){ // ?????? return add(x * p.x, y * p.y); } double det(P p){ // ?????? return add(x * p.y, -y * p.x); } }; // ???????????§?????? bool cmp_x(const P& p, const P& q){ if(p.x != q.x) return p.x <q.x; return p.y<q.y; } // ??????????±??????? vector<P> convex_hull(P* ps, int n){ sort(ps, ps + n, cmp_x); int k = 0; //?????????????????° vector<P> qs(n * 2); //?§???????????????? // ?????´??????????????? for(int i = 0; i < n; i++){ while(k > 1 && (qs[k - 1] - qs[ k - 2]).det(ps[i] - qs[k - 1]) <= 0) k--; qs[k++] = ps[i]; } // ?????´??????????????? for(int i = n - 2, t = k; i >= 0; i--){ while(k > t && (qs[k - 1] - qs[k - 2]).det(ps[i] - qs[k - 1]) <=0 ) k--; qs[k++] = ps[i]; } qs.resize(k - 1); return qs; } int MAX_N =100; P ps[MAX_N]; //vector<P> ps(MAX_N); int main(){ int n; while(cin>>n && n>0){ rep(i,n) cin>>ps[i].x>>ps[i].y; cout<<n-convex_hull(ps, n).size()<<endl; } }
a.cc:100:6: error: size of array 'ps' is not an integral constant-expression 100 | P ps[MAX_N]; | ^~~~~
s928900775
p00068
C++
#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i ) #define EACH( v, c ) for ( auto &v : c ) #define ALL( c ) (c).begin(), (c).end() struct Point { double x, y; Point() : x( 0 ), y( 0 ) { return; } Point( double x, double y ) : x( x ), y( y ) { return; } Point operator + ( const Point &a ) const { return Point( x + a.x, y + a.y ); } Point operator - ( const Point &a ) const { return Point( x - a.x, y - a.y ); } Point operator * ( const double &a ) const { return Point( x * a, y * a ); } Point operator / ( const double &a ) const { return Point( x / a, y / a ); } bool operator < ( const Point &a ) const { return x == a.x ? y < a.y : x < a.x; } }; // ?????? double cross( const Point &a, const Point &b ) { return a.x * b.y - a.y * b.x; } // Graham Scan vector< Point > getConvex( vector< Point > ps ) { const int N = ps.size(); sort( ALL( ps ) ); int k = 0; vector< Point > convex( N * 2 ); for ( int i = 0; i < N; i++ ) { while ( 2 <= k && cross( convex[ k - 1 ] - convex[ k - 2 ], ps[i] - convex[ k - 1 ] ) <= 0 ) { k--; } convex[ k++ ] = ps[i]; } for ( int i = N - 2, t = k; 0 <= i; i-- ) { while ( t < k && cross( convex[ k - 1 ] - convex[ k - 2 ], ps[i] - convex[ k - 1 ] ) <= 0 ) { k--; } convex[ k++ ] = ps[i]; } convex.resize( k - 1 ); return convex; } int main() { cin.tie( 0 ); ios::sync_with_stdio( false ); while ( true ) { int n; cin >> n; if ( !n ) { break; } vector< Point > ps( n ); EACH( p, ps ) { char d; cin >> p.x >> d >> p.y; } vector< Point > convex = getConvex( ps ); cout << n - convex.size() << endl; } return 0; }
a.cc:53:1: error: 'vector' does not name a type 53 | vector< Point > getConvex( vector< Point > ps ) | ^~~~~~ a.cc: In function 'int main()': a.cc:89:9: error: 'cin' was not declared in this scope 89 | cin.tie( 0 ); | ^~~ a.cc:90:9: error: 'ios' has not been declared 90 | ios::sync_with_stdio( false ); | ^~~ a.cc:102:17: error: 'vector' was not declared in this scope 102 | vector< Point > ps( n ); | ^~~~~~ a.cc:102:31: error: expected primary-expression before '>' token 102 | vector< Point > ps( n ); | ^ a.cc:102:33: error: 'ps' was not declared in this scope 102 | vector< Point > ps( n ); | ^~ a.cc:111:31: error: expected primary-expression before '>' token 111 | vector< Point > convex = getConvex( ps ); | ^ a.cc:111:33: error: 'convex' was not declared in this scope 111 | vector< Point > convex = getConvex( ps ); | ^~~~~~ a.cc:111:42: error: 'getConvex' was not declared in this scope 111 | vector< Point > convex = getConvex( ps ); | ^~~~~~~~~ a.cc:113:17: error: 'cout' was not declared in this scope 113 | cout << n - convex.size() << endl; | ^~~~ a.cc:113:46: error: 'endl' was not declared in this scope 113 | cout << n - convex.size() << endl; | ^~~~
s467611006
p00068
C++
#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i ) #define EACH( v, c ) for ( auto &v : c ) #define ALL( c ) (c).begin(), (c).end() struct Point { double x, y; Point() : x( 0 ), y( 0 ) { return; } Point( double x, double y ) : x( x ), y( y ) { return; } Point operator + ( const Point &a ) const { return Point( x + a.x, y + a.y ); } Point operator - ( const Point &a ) const { return Point( x - a.x, y - a.y ); } Point operator * ( const double &a ) const { return Point( x * a, y * a ); } Point operator / ( const double &a ) const { return Point( x / a, y / a ); } bool operator < ( const Point &a ) const { return x == a.x ? y < a.y : x < a.x; } }; // ?????? double cross( const Point &a, const Point &b ) { return a.x * b.y - a.y * b.x; } // Graham Scan vector< Point > getConvex( vector< Point > ps ) { const int N = ps.size(); sort( ALL( ps ) ); int k = 0; vector< Point > convex( N * 2 ); for ( int i = 0; i < N; i++ ) { while ( 2 <= k && cross( convex[ k - 1 ] - convex[ k - 2 ], ps[i] - convex[ k - 1 ] ) <= 0 ) { k--; } convex[ k++ ] = ps[i]; } for ( int i = N - 2, t = k; 0 <= i; i-- ) { while ( t < k && cross( convex[ k - 1 ] - convex[ k - 2 ], ps[i] - convex[ k - 1 ] ) <= 0 ) { k--; } convex[ k++ ] = ps[i]; } convex.resize( k - 1 ); return convex; } int main() { cin.tie( 0 ); ios::sync_with_stdio( false ); while ( true ) { int n; cin >> n; if ( !n ) { break; } vector< Point > ps( n ); EACH( p, ps ) { char d; cin >> p.x >> d >> p.y; } vector< Point > convex = getConvex( ps ); cout << n - convex.size() << endl; } return 0; }
a.cc:53:1: error: 'vector' does not name a type 53 | vector< Point > getConvex( vector< Point > ps ) | ^~~~~~ a.cc: In function 'int main()': a.cc:89:9: error: 'cin' was not declared in this scope 89 | cin.tie( 0 ); | ^~~ a.cc:90:9: error: 'ios' has not been declared 90 | ios::sync_with_stdio( false ); | ^~~ a.cc:102:17: error: 'vector' was not declared in this scope 102 | vector< Point > ps( n ); | ^~~~~~ a.cc:102:31: error: expected primary-expression before '>' token 102 | vector< Point > ps( n ); | ^ a.cc:102:33: error: 'ps' was not declared in this scope 102 | vector< Point > ps( n ); | ^~ a.cc:111:31: error: expected primary-expression before '>' token 111 | vector< Point > convex = getConvex( ps ); | ^ a.cc:111:33: error: 'convex' was not declared in this scope 111 | vector< Point > convex = getConvex( ps ); | ^~~~~~ a.cc:111:42: error: 'getConvex' was not declared in this scope 111 | vector< Point > convex = getConvex( ps ); | ^~~~~~~~~ a.cc:113:17: error: 'cout' was not declared in this scope 113 | cout << n - convex.size() << endl; | ^~~~ a.cc:113:46: error: 'endl' was not declared in this scope 113 | cout << n - convex.size() << endl; | ^~~~
s698968220
p00068
C++
#include<iostream> #include<fstream> #include<sstream> #include<string> #include<cstdio> #include<cstdlib> #include<cstring> #include<ctime> #include<stack> #include<queue> #include<set> #include<map> #include<vector> #include<list> #include<algorithm> #include<utility> #include<complex> #define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i ) #define EACH( v, c ) for ( auto &v : c ) #define ALL( c ) (c).begin(), (c).end() struct Point { double x, y; Point() : x( 0 ), y( 0 ) { return; } Point( double x, double y ) : x( x ), y( y ) { return; } Point operator + ( const Point &a ) const { return Point( x + a.x, y + a.y ); } Point operator - ( const Point &a ) const { return Point( x - a.x, y - a.y ); } Point operator * ( const double &a ) const { return Point( x * a, y * a ); } Point operator / ( const double &a ) const { return Point( x / a, y / a ); } bool operator < ( const Point &a ) const { return x == a.x ? y < a.y : x < a.x; } }; // ?????? double cross( const Point &a, const Point &b ) { return a.x * b.y - a.y * b.x; } // Graham Scan vector< Point > getConvex( vector< Point > ps ) { const int N = ps.size(); sort( ALL( ps ) ); int k = 0; vector< Point > convex( N * 2 ); for ( int i = 0; i < N; i++ ) { while ( 2 <= k && cross( convex[ k - 1 ] - convex[ k - 2 ], ps[i] - convex[ k - 1 ] ) <= 0 ) { k--; } convex[ k++ ] = ps[i]; } for ( int i = N - 2, t = k; 0 <= i; i-- ) { while ( t < k && cross( convex[ k - 1 ] - convex[ k - 2 ], ps[i] - convex[ k - 1 ] ) <= 0 ) { k--; } convex[ k++ ] = ps[i]; } convex.resize( k - 1 ); return convex; } int main() { cin.tie( 0 ); ios::sync_with_stdio( false ); while ( true ) { int n; cin >> n; if ( !n ) { break; } vector< Point > ps( n ); EACH( p, ps ) { char d; cin >> p.x >> d >> p.y; } vector< Point > convex = getConvex( ps ); cout << n - convex.size() << endl; } return 0; }
a.cc:70:1: error: 'vector' does not name a type 70 | vector< Point > getConvex( vector< Point > ps ) | ^~~~~~ a.cc: In function 'int main()': a.cc:106:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 106 | cin.tie( 0 ); | ^~~ | 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:107:9: error: 'ios' has not been declared 107 | ios::sync_with_stdio( false ); | ^~~ a.cc:119:17: error: 'vector' was not declared in this scope 119 | vector< Point > ps( n ); | ^~~~~~ a.cc:119:17: note: suggested alternatives: In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/queue:63, from a.cc:10: /usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector' 428 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ /usr/include/c++/14/vector:93:13: note: 'std::pmr::vector' 93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>; | ^~~~~~ a.cc:119:31: error: expected primary-expression before '>' token 119 | vector< Point > ps( n ); | ^ a.cc:119:33: error: 'ps' was not declared in this scope 119 | vector< Point > ps( n ); | ^~ a.cc:128:31: error: expected primary-expression before '>' token 128 | vector< Point > convex = getConvex( ps ); | ^ a.cc:128:33: error: 'convex' was not declared in this scope 128 | vector< Point > convex = getConvex( ps ); | ^~~~~~ a.cc:128:42: error: 'getConvex' was not declared in this scope 128 | vector< Point > convex = getConvex( ps ); | ^~~~~~~~~ a.cc:130:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 130 | cout << n - convex.size() << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:130:46: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 130 | cout << n - convex.size() << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s288266111
p00068
C++
#include <iostream> #include <stdio.h> #include <string> #include <sstream> #include <fstream> #include <iterator> #include <stdlib.h> #include <map> #include <queue> #include <vector> #include <functional> #include <set> #include <list> using namespace std; // vector cout template<typename _Ty> ostream& operator << (ostream& os, const vector<_Ty>& v) { os << "{"; for (size_t i = 0; i < v.size(); i++) { if (i != 0) os << ", "; os << v[i]; } os << "}"; return os; } //point class Point { public: double x; double y; Point() { x = 0; y = 0; } Point(int x, int y) { this->x = x; this->y = y; } bool operator<(const Point& a) const { if (x == a.x) return y < a.y; else return x < a.x; } }; //point cout ostream& operator << (ostream& os, const Point& p) { return os << "(" << p.x << ", " << p.y << ")"; } void rec(list<Point*>& Hull, list<Point*>& Points, Point* p1, Point* p2, int sgn) { double MaxDistance = 0; Point* pMaxDistance = NULL; list<Point*>::iterator it; //iterator //sgn?????????????????¨????????? list<Point*> sgnPoints; //sgn ????????????????????§??´??? p1-p2 ??????????????¢?????§??????????±??????? for (it = Points.begin(); it != Points.end(); it++) // list???????°??????§ { Point* p = *it; double d = (p2->x - p1->x)*(p->y - p1->y) - (p2->y - p1->y)*(p->x - p1->x); //0 ????????´???????????£?????? sgn ??????????????¨ double reg = sgn * d; //??´????????§????????°?????? if (abs(reg) < 1e-8) { Points.erase(it); continue; } //??£?????????????????????????????¢????????? if (reg > 0) { sgnPoints.push_back(*it); if (abs(d) > MaxDistance) { MaxDistance = abs(d); pMaxDistance = p; } } } //?????¨??????????????°?????? if (pMaxDistance == NULL) return; //p0 ?????????????????? Point* p0 = pMaxDistance; Hull.push_back(p0); Points.remove(p0); sgnPoints.remove(p0); //????§???¢ p0, p1, p2 ?????¨????????¨?????????????????? for (it = sgnPoints.begin(); it != sgnPoints.end(); it++) { Point* pl = *it; Point* p[3] = { p0, p1, p2 }; //cross product double cp[3]; for (int i = 0; i < 3; i++) { cp[i] = (p[(i + 1) % 3]->x - p[i]->x)*(pl->y - p[i]->y) - (p[(i + 1) % 3]->y - p[i]->y)*(pl->x - p[i]->x); } //?????¨??????????????? if ((cp[0] < 0 && cp[1] < 0 && cp[2] < 0) || (cp[0] > 0 && cp[1] > 0 && cp[2] > 0)) { //?????? Points.remove(*it); } } //??´??? (p0, p1) ???????????? p2 ????¬???? double sp2 = (p1->x - p0->x)*(p2->y - p0->y) - (p1->y - p0->y)*(p2->x - p0->x); if (sp2 < 0) rec(Hull, Points, p0, p1, 1); else rec(Hull, Points, p0, p1, -1); //??´??? (p0, p2) ???????????? p1 ????¬???? double sp1 = (p2->x - p0->x)*(p1->y - p0->y) - (p2->y - p0->y)*(p1->x - p0->x); if (sp1 < 0) rec(Hull, Points, p0, p2, 1); else rec(Hull, Points, p0, p2, -1); return; } int convexhull(vector<Point>& vPoints) { //sort sort(vPoints.begin(), vPoints.end()); //list ??? vPoints ??????????´???????????????????????´? list<Point*> lPoints; for (int i = 0; i < vPoints.size(); i++) { lPoints.push_back(&vPoints[i]); } //??????????§????????????????????????? list<Point*> Hull; //x??§?¨?????°????????????§????????????????????? Hull.push_back(lPoints.front()); Hull.push_back(lPoints.back()); //p1, p2 Point* p1 = lPoints.front(); Point* p2 = lPoints.back(); //?????? lPoints.pop_front(); lPoints.pop_back(); //?¬??????£???????????¢?´¢ rec(Hull, lPoints, p1, p2, 1); //?¬??????????????????¢?´¢ rec(Hull, lPoints, p1, p2, -1); return vPoints.size() - Hull.size(); } int main() { while (1) { int n; vector<Point> Points; cin >> n; if (n == 0) break; for (int i = 0; i < n; i++) { Point p; string input; cin >> input; stringstream ss(input); ss >> p.x; ss.ignore(); ss >> p.y; Points.push_back(p); } cout << convexhull(Points) << endl; } return 0; }
a.cc: In function 'int convexhull(std::vector<Point>&)': a.cc:135:9: error: 'sort' was not declared in this scope; did you mean 'short'? 135 | sort(vPoints.begin(), vPoints.end()); | ^~~~ | short
s341952023
p00068
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; const double PI = 3.14159; int main() { while (true) { int n; cin >> n; if (n==0) break; vector<double> x; x.reserve(100); vector<double> y; y.reserve(100); double tmp_x, tmp_y; char dummy; for (int i=0; i<n; i++) { cin >> tmp_x >> dummy >> tmp_y; x.push_back(tmp_x); y.push_back(tmp_y); } double min_y = y[0]; int min_y_index = 0; for (int i=1; i<n; i++) { if (min_y > y[i]) { min_y = y[i]; min_y_index = i; } } int curr_index = min_y_index; int circumference_points = 0; double curr_deg = 0.0; do { double min_deg = PI; double min_deg_index; double tmp_deg; for (int i=0; i<n; i++) { if (i == curr_index) continue; tmp_deg = atan2( y[i] - y[curr_index], x[i] - x[curr_index] ); tmp_deg -= curr_deg;cout << min_deg_index << " " << tmp_deg += (tmp_deg < 0) ? 2*PI : 0; if ( min_deg > tmp_deg ) { min_deg = tmp_deg; min_deg_index = i; } } curr_deg += min_deg; curr_index = min_deg_index; circumference_points++; // cout << min_deg_index << " " << curr_deg * 180 / PI << endl; } while (curr_index != min_y_index); cout << n - circumference_points << endl; } return 0; }
a.cc: In function 'int main()': a.cc:42:41: error: no match for 'operator+=' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and 'double') 41 | tmp_deg -= curr_deg;cout << min_deg_index << " " << | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | tmp_deg += (tmp_deg < 0) ? 2*PI : 0; | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
s131310661
p00068
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; const double PI = 3.14159; int main() { while (true) { int n; cin >> n; if (n==0) break; vector<double> x; x.reserve(100); vector<double> y; y.reserve(100); double tmp_x, tmp_y; char dummy; for (int i=0; i<n; i++) { cin >> tmp_x >> dummy >> tmp_y; x.push_back(tmp_x); y.push_back(tmp_y); } double min_y = y[0]; int min_y_index = 0; for (int i=1; i<n; i++) { if (min_y > y[i]) { min_y = y[i]; min_y_index = i; } } int curr_index = min_y_index; int circumference_points = 0; double curr_deg = 0.0; do { double min_deg = PI; double min_deg_index; double tmp_deg; for (int i=0; i<n; i++) { if (i == curr_index) continue; tmp_deg = atan2( y[i] - y[curr_index], x[i] - x[curr_index] ); tmp_deg -= curr_deg;cout << min_deg_index << " " << if (tmp_deg < 0) tmp_deg += 2*PI; if (min_deg > tmp_deg) { min_deg = tmp_deg; min_deg_index = i; } } curr_deg += min_deg; curr_index = min_deg_index; circumference_points++; // cout << min_deg_index << " " << curr_deg * 180 / PI << endl; } while (curr_index != min_y_index); cout << n - circumference_points << endl; } return 0; }
a.cc: In function 'int main()': a.cc:42:33: error: expected primary-expression before 'if' 42 | if (tmp_deg < 0) tmp_deg += 2*PI; | ^~
s690099590
p00068
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; const double PI = 3.14159; int main() { while (true) { int n; cin >> n; if (n==0) break; vector<double> x; x.reserve(100); vector<double> y; y.reserve(100); double tmp_x, tmp_y; char dummy; for (int i=0; i<n; i++) { cin >> tmp_x >> dummy >> tmp_y; x.push_back(tmp_x); y.push_back(tmp_y); } double min_y = y[0]; int min_y_index = 0; for (int i=1; i<n; i++) { if (min_y > y[i]) { min_y = y[i]; min_y_index = i; } } int curr_index = min_y_index; int circumference_points = 0; double curr_deg = 0.0; do { double min_deg = PI; double min_deg_index; double tmp_deg; for (int i=0; i<n; i++) { if (i == curr_index) continue; tmp_deg = atan2( y[i] - y[curr_index], x[i] - x[curr_index] ); tmp_deg -= curr_deg;cout << min_deg_index << " " <<; if (tmp_deg < 0) tmp_deg += 2*PI; if (min_deg > tmp_deg) { min_deg = tmp_deg; min_deg_index = i; } } curr_deg += min_deg; curr_index = min_deg_index; circumference_points++; // cout << min_deg_index << " " << curr_deg * 180 / PI << endl; } while (curr_index != min_y_index); cout << n - circumference_points << endl; } return 0; }
a.cc: In function 'int main()': a.cc:41:84: error: expected primary-expression before ';' token 41 | tmp_deg -= curr_deg;cout << min_deg_index << " " <<; | ^
s392250980
p00068
C++
#define _USE_MATH_DEFINES #include <algorithm> #include <array> #include <climits> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <ctime> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <type_traits> #include <utility> #include <vector> using int32 = std::int_fast32_t; using int64 = std::int_fast64_t; using uint32 = std::uint_fast32_t; using uint64 = std::uint_fast64_t; using intl32 = std::int_least32_t; using intl64 = std::int_least64_t; using uintl32 = std::uint_least32_t; using uintl64 = std::uint_least64_t; static constexpr long double PI = 3.1415926535897932; struct angle { long double r; angle() :r(0) {} angle(long double r_) :r(arr(std::fmod(r_, 2.0 * PI) + 2.0 * PI)) {} static long double arr(const long double &o) { return o < 2.0 * PI - eps ? o : o - 2.0 * PI; } static angle make(const long double &o) { angle ret;ret.r = o;return ret; } const angle operator+(const angle &o)const { return make(arr(r + o.r)); } const angle operator-(const angle &o)const { return make(arr(r - o.r + 2.0 * PI)); } const angle operator*(const long double &o)const { return angle(r * o); } const angle operator/(const long double &o)const { return angle(r / o); } angle &operator+=(const angle &o) { return *this = *this + o; } angle &operator-=(const angle &o) { return *this = *this - o; } angle &operator*=(const long double &o) { return *this = *this * o; } angle &operator/=(const long double &o) { return *this = *this / o; } const angle operator~()const { return make(arr(3.0 * PI - r)); } const angle operator-()const { return make(arr(2.0 * PI - r)); } const bool operator==(const angle &o)const { return std::abs(r - o.r) <= eps; } const bool operator!=(const angle &o)const { return std::abs(r - o.r) > eps; } const bool operator< (const angle &o)const { return r < o.r; } const bool operator<=(const angle &o)const { return r <= o.r; } const bool operator> (const angle &o)const { return r > o.r; } const bool operator>=(const angle &o)const { return r >= o.r; } explicit operator bool()const { return r > eps; } explicit operator long double()const { return r; } const long double sin()const { return std::sin(r); } const long double cos()const { return std::cos(r); } const long double degree()const { return r*(180.0 / PI); } const long double ratio()const { return r / (2.0 * PI); } private: static constexpr long double eps = 0.000000001; }; angle operator"" _deg(long double x) { return angle(x*(PI / 180.0)); } angle operator"" _rat(long double x) { return angle(x * 2.0 * PI); } angle operator"" _rad(long double x) { return angle(x); } struct pvec { static constexpr long double eps = 0.0000000001; long double x, y; pvec() :x(0), y(0) {} pvec(long double x_, long double y_) :x(x_), y(y_) {} pvec(long double abs_, angle r) :x(abs_*r.cos()), y(abs_*r.sin()) {} const pvec operator+(const pvec &o)const { return pvec(x + o.x, y + o.y); } const pvec operator-(const pvec &o)const { return pvec(x - o.x, y - o.y); } const pvec operator*(const pvec &o)const { return pvec(x*o.x - y*o.y, x*o.y + y*o.x); } const pvec operator/(const pvec &o)const { return pvec(x*o.x + y*o.y, y*o.x - x*o.y) / abs2(); } const pvec operator*(const long double &o)const { return pvec(x * o, y * o); } const pvec operator/(const long double &o)const { return pvec(x / o, y / o); } pvec &operator+=(const pvec &o) { return *this = *this + o; } pvec &operator-=(const pvec &o) { return *this = *this - o; } pvec &operator*=(const pvec &o) { return *this = *this * o; } pvec &operator/=(const pvec &o) { return *this = *this / o; } pvec &operator*=(const long double &o) { return *this = *this * o; } pvec &operator/=(const long double &o) { return *this = *this / o; } const pvec operator+()const { return *this; } const pvec operator-()const { return pvec(-x, -y); } const pvec operator~()const { return pvec(x, -y); } explicit operator bool()const { return std::abs(x) > eps || std::abs(y) > eps; } const bool operator==(const pvec &o)const { return std::abs(x - o.x) <= eps&&std::abs(y - o.y) <= eps; } const bool operator!=(const pvec &o)const { return std::abs(x - o.x) > eps || std::abs(y - o.y) > eps; } const long double abs()const { return mysqrt(abs2()); } const long double abs2()const { return x*x + y*y; } const angle arg()const { if (x > eps) return angle(std::atan(y / x)); if (x < eps) return angle(std::atan(y / x) + PI); return angle(); } static const long double dot(const pvec &l, const pvec &r) { return l.x*r.x + l.y*r.y; } static const long double cross(const pvec &l, const pvec &r) { return l.x*r.y - l.y*r.x; } static const bool C_x(const pvec &l, const pvec &r) { if (l.x != r.x) return l.x < r.x; return l.y < r.y; } friend std::istream &operator>>(std::istream &is, pvec &o) { long double x_, y_;is >> x_ >> y_;o = pvec(x_, y_);return (is); } private: static const long double mysqrt(const long double &x) { long double h = 0.5*x; std::uint_fast64_t t = 0x5FE6EB50C7B537AAl - (*(std::uint_fast64_t*)&x >> 1); long double r = *(long double*)&t; r *= 1.5 - h*r*r; r *= 1.5 - h*r*r; r *= 1.5 - h*r*r; return r*x; } }; std::vector<pvec> convex_hull(std::vector<pvec> &points) { static constexpr long double eps = 0; std::sort(points.begin(), points.end(),pvec::C_x); uint32 k = 0; const uint32 n = points.size(); std::vector<pvec> ret(n * 2); for (uint32 i = 0;i < n;++i) { while (k > 1 && pvec::cross(ret[k - 1] - ret[k - 2], points[i] - ret[k - 1]) < -eps)--k; ret[k++] = points[i]; } for (uint32 i = n - 2, t = k;~i;--i) { while (k > t && pvec::cross(ret[k - 1] - ret[k - 2], points[i] - ret[k - 1]) < -eps)--k; ret[k++] = points[i]; } ret.resize(k - 1); return ret; } int main(void) { //std::ios::sync_with_stdio(false); //std::cin.tie(0); uint32 n; while (1) { std::cin >> n; if (!n) break; std::vector<pvec> p(n); for (uint32 i = 0;i < n;++i) { scanf_s("%lf,%lf", &p[i].x, &p[i].y); } p = convex_hull(p); std::cout << n - p.size() << "\n"; } return 0; }
a.cc: In function 'int main()': a.cc:151:25: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 151 | scanf_s("%lf,%lf", &p[i].x, &p[i].y); | ^~~~~~~ | scanf
s946303691
p00068
C++
#include<iostream> #include<cfloat> #include<cassert> #include<cmath> #include<vector> using namespace std; #define EPS (1e-8) #define equals(a, b) (fabs((a) - (b)) < EPS ) #define dle(a, b) (equals(a, b) || a < b ) static const double PI = acos(-1); class Point{ public: double x, y; Point ( double x = 0, double y = 0): x(x), y(y){} Point operator + ( Point p ){ return Point(x + p.x, y + p.y); } Point operator - ( Point p ){ return Point(x - p.x, y - p.y); } Point operator * ( double a ){ return Point(x*a, y*a); } Point operator / ( double a ){ return Point(x/a, y/a); } double abs() { return sqrt(norm());} double norm() { return x*x + y*y; } bool operator < ( const Point &p ) const { return x != p.x ? x < p.x : y < p.y; } bool operator == ( const Point &p ) const { return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS; } }; typedef Point Vector; class Segment{ public: Point p1, p2; Segment(Point s = Point(), Point t = Point()): p1(s), p2(t){} }; typedef Segment Line; typedef vector<Point> Polygon; double norm( Vector a ){ return a.x*a.x + a.y*a.y; } double abs( Vector a ){ return sqrt(norm(a)); } Point polar( double a, double r ){ return Point(cos(r)*a, sin(r)*a);} double getDistance( Vector a, Vector b ){ return abs(a - b); } double dot( Vector a, Vector b ){ return a.x*b.x + a.y*b.y; } double cross( Vector a, Vector b ){ return a.x*b.y - a.y*b.x; } static const int COUNTER_CLOCKWISE = 1; static const int CLOCKWISE = -1; static const int ONLINE_BACK = 2; static const int ONLINE_FRONT = -2; static const int ON_SEGMENT = 0; // EPS can be 0 // need to check for 920, 833, 866 int ccw( Point p0, Point p1, Point p2 ){ Vector a = p1 - p0; Vector b = p2 - p0; if ( cross(a, b) > EPS ) return COUNTER_CLOCKWISE; if ( cross(a, b) < -EPS ) return CLOCKWISE; if ( dot(a, b) < -EPS ) return ONLINE_BACK; if ( norm(a) < norm(b) ) return ONLINE_FRONT; return ON_SEGMENT; } // intersect Segment p1-p2 and Segment p3-p4 ? bool isIntersect(Point p1, Point p2, Point p3, Point p4){ return ( ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0 ); } // intersect Segment s1 and Segment s2 ? // verified by 920, 833, 866, uoa2062 bool isIntersect(Segment s1, Segment s2){ return isIntersect(s1.p1, s1.p2, s2.p1, s2.p2); } Polygon andrewScan( Polygon s ){ Polygon u, l; if ( s.size() < 3 ) return s; sort(s.begin(), s.end()); u.push_back(s[0]); u.push_back(s[1]); l.push_back(s[s.size()-1]); l.push_back(s[s.size()-2]); int n; for ( int i = 2; i < s.size(); i++ ){ for ( int n = u.size(); n >= 2 && ccw(u[n-2], u[n-1], s[i]) != CLOCKWISE; n--){ u.pop_back(); } u.push_back(s[i]); } for ( int i = s.size()-3; i >= 0; i-- ){ for ( int n = l.size(); n >= 2 && ccw(l[n-2], l[n-1], s[i]) != CLOCKWISE; n--){ l.pop_back(); } l.push_back(s[i]); } reverse(l.begin(), l.end()); for ( int i = u.size()-2; i >= 1; i-- ) l.push_back(u[i]); return l; } main(){ int n; char ch; double x, y; while( cin >> n && n ){ Polygon P, C; for ( int i = 0; i < n; i++ ){ cin >> x >>ch>> y; P.push_back(Point(x, y)); } C = andrewScan(P); cout << P.size() - C.size() << endl; } }
a.cc: In function 'Polygon andrewScan(Polygon)': a.cc:91:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 91 | sort(s.begin(), s.end()); | ^~~~ | sqrt a.cc:110:5: error: 'reverse' was not declared in this scope 110 | reverse(l.begin(), l.end()); | ^~~~~~~ a.cc: At global scope: a.cc:115:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 115 | main(){ | ^~~~
s441897769
p00068
C++
typedef struct{double x,y,k;}w;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){double k,t;for(;~scanf("%d",&n),j=n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++){k=o(0,i,100);t=(p[i].x-b.x)*(p[i].x-b.x)+(p[i].y-b.y)*(p[i].y-b.y);k*=k/t;if(b.x>p[i].x)k=-k;p[i].k=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}}
a.cc:1:43: error: 'm' does not name a type 1 | typedef struct{double x,y,k;}w;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){double k,t;for(;~scanf("%d",&n),j=n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++){k=o(0,i,100);t=(p[i].x-b.x)*(p[i].x-b.x)+(p[i].y-b.y)*(p[i].y-b.y);k*=k/t;if(b.x>p[i].x)k=-k;p[i].k=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:56: error: ISO C++ forbids declaration of 'z' with no type [-fpermissive] 1 | typedef struct{double x,y,k;}w;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){double k,t;for(;~scanf("%d",&n),j=n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++){k=o(0,i,100);t=(p[i].x-b.x)*(p[i].x-b.x)+(p[i].y-b.y)*(p[i].y-b.y);k*=k/t;if(b.x>p[i].x)k=-k;p[i].k=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:107: error: 'q' was not declared in this scope 1 | typedef struct{double x,y,k;}w;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){double k,t;for(;~scanf("%d",&n),j=n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++){k=o(0,i,100);t=(p[i].x-b.x)*(p[i].x-b.x)+(p[i].y-b.y)*(p[i].y-b.y);k*=k/t;if(b.x>p[i].x)k=-k;p[i].k=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:109: error: 'r' was not declared in this scope 1 | typedef struct{double x,y,k;}w;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){double k,t;for(;~scanf("%d",&n),j=n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++){k=o(0,i,100);t=(p[i].x-b.x)*(p[i].x-b.x)+(p[i].y-b.y)*(p[i].y-b.y);k*=k/t;if(b.x>p[i].x)k=-k;p[i].k=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:111: error: 's' was not declared in this scope 1 | typedef struct{double x,y,k;}w;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){double k,t;for(;~scanf("%d",&n),j=n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++){k=o(0,i,100);t=(p[i].x-b.x)*(p[i].x-b.x)+(p[i].y-b.y)*(p[i].y-b.y);k*=k/t;if(b.x>p[i].x)k=-k;p[i].k=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:112: error: expression list treated as compound expression in initializer [-fpermissive] 1 | typedef struct{double x,y,k;}w;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){double k,t;for(;~scanf("%d",&n),j=n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++){k=o(0,i,100);t=(p[i].x-b.x)*(p[i].x-b.x)+(p[i].y-b.y)*(p[i].y-b.y);k*=k/t;if(b.x>p[i].x)k=-k;p[i].k=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:195: error: expected constructor, destructor, or type conversion before '(' token 1 | typedef struct{double x,y,k;}w;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){double k,t;for(;~scanf("%d",&n),j=n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++){k=o(0,i,100);t=(p[i].x-b.x)*(p[i].x-b.x)+(p[i].y-b.y)*(p[i].y-b.y);k*=k/t;if(b.x>p[i].x)k=-k;p[i].k=k;}qsort(p+1,n-1,sizeof(w),z);v[0]=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^
s167252386
p00068
C++
typedef struct{double x,y,k;}w;double k,t;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++)p[i].k=o(0,i,100)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,sizeof(w),z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}}
a.cc:1:54: error: 'm' does not name a type 1 | typedef struct{double x,y,k;}w;double k,t;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++)p[i].k=o(0,i,100)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,sizeof(w),z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:67: error: ISO C++ forbids declaration of 'z' with no type [-fpermissive] 1 | typedef struct{double x,y,k;}w;double k,t;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++)p[i].k=o(0,i,100)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,sizeof(w),z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:118: error: 'q' was not declared in this scope 1 | typedef struct{double x,y,k;}w;double k,t;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++)p[i].k=o(0,i,100)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,sizeof(w),z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:120: error: 'r' was not declared in this scope 1 | typedef struct{double x,y,k;}w;double k,t;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++)p[i].k=o(0,i,100)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,sizeof(w),z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:122: error: 's' was not declared in this scope 1 | typedef struct{double x,y,k;}w;double k,t;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++)p[i].k=o(0,i,100)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,sizeof(w),z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:123: error: expression list treated as compound expression in initializer [-fpermissive] 1 | typedef struct{double x,y,k;}w;double k,t;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++)p[i].k=o(0,i,100)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,sizeof(w),z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^ a.cc:1:206: error: expected constructor, destructor, or type conversion before '(' token 1 | typedef struct{double x,y,k;}w;double k,t;w p[101],b;m,v[100],n,j;z(w*c,w*d){return c->k>d->k?-1:c->k<d->k;}double o(q,r,s){return p[q].x*(p[r].y-p[s].y)+p[r].x*(p[s].y-p[q].y)+p[s].x*(p[q].y-p[r].y);}main(i){for(;j=scanf("%d",&n)+~n;){for(m=i=0;i<n;i++)scanf("%lf,%lf",&p[i].x,&p[i].y),p[m].y>p[i].y?m=i:0;b=p[m];p[m]=*p;*p=b;p[100].x=b.x;p[100].y=b.y+1;for(i=1;i<n;i++)p[i].k=o(0,i,100)/hypot(p[i].x-b.x,p[i].y-b.y);qsort(p+1,n-1,sizeof(w),z);*v=0;v[1]=1;v[2]=j=2;for(i=3;i<n;i++){for(;o(v[j-1],v[j],i)<=0;j--);v[++j]=i;}printf("%d\n",n+~j);}} | ^
s321053304
p00068
C++
#include <iostream> #include <cstdio> #include <cmath> #include <vector> using namespace std; const double EPS = 1e-10; class Point{ public: double x,y; Point (double x = 0,double y = 0): x(x),y(y){} Point operator + (Point &p){ return Point(x+p.x,y+p.y);} Point operator - (Point &p){ return Point(x-p.x,y-p.y);} Point operator * (double k){ return Point(x*k,y*k);} bool operator < (const Point &p)const { if(x == p.x) return y < p.y; else return x < p.x; } }; typedef Point Vector; double cross(Vector a, Vector b){ return a.x * b.y - a.y * b.x;} int Convex_Hull(vector<Point> v){ vector<Point> c; //convex sort(v.begin(),v.end()); c.assign(v.begin(),v.begin()+2); for(int i=2;i<v.size();i++){ Vector a = c[c.size()-1] - c[c.size()-2]; Vector b = v[i] - c[c.size()-2]; while(cross(a,b) > EPS){ c.pop_back(); if(c.size() < 2) break; a = c[c.size()-1] - c[c.size()-2]; b = v[i] - c[c.size()-2]; } c.push_back(v[i]); } int n = c.size(); c.push_back(v[v.size()-2]); for(int i=v.size()-3;i>=0;i--){ Vector a = c[c.size()-1] - c[c.size()-2]; Vector b = v[i] - c[c.size()-2]; while(cross(a,b) > EPS){ c.pop_back(); if(c.size() < n + 1) break; a = c[c.size()-1] - c[c.size()-2]; b = v[i] - c[c.size()-2]; } c.push_back(v[i]); } c.pop_back(); return c.size(); } int main(){ int n; while(cin >> n && n){ vector<Point> v(n); for(int i=0;i<n;i++) scanf("%lf,%lf",&v[i].x,&v[i].y); cout << n - Convex_Hull(v) << endl; } return 0; }
a.cc: In function 'int Convex_Hull(std::vector<Point>)': a.cc:28:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 28 | sort(v.begin(),v.end()); | ^~~~ | sqrt
s923036861
p00068
C++
#include<iostream> #include<cmath> #include<cstdio> #include<vector> using namespace std; double EPS = 1e-10; double add(double a,double b){ if(abs(a+b)<EPS*(abs(a)+abs(b)))return 0; return a+b; } struct P{ double x,y; P() {} P(double x,double y):x(x),y(y){ } P operator + (P p){ return P(add(x,p.x),add(y,p.y)); } P operator - (P p){ return P(add(x,-p.x),add(y,-p.y)); } P operator * (double d){ return P(x*d,y*d); } double dot(P p){ return add(x*p.x,y*p.y); } double det(P p){ return add(x*p.y, -y*p.x); } }; bool cmp_x(const P& p, const P& q){ if(p.x != q.x)return p.x<q.x; return p.y < q.y; } vector<P>convex_hull(P* ps, int n){ sort(ps,ps+n,cmp_x); int k=0; vector<P>qs(n*2); for(int i=0;i<n;i++){ while(k>1&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)k--; qs[k++]=ps[i]; } for(int i=n-2,t=k;i>=0;i--){ while(k>t&&(qs[k-1]-qs[k-2]).det(ps[i]-qs[k-1])<=0)k--; qs[k++]=ps[i]; } qs.resize(k-1); return qs; } int main(void){ int n; double x,y; P p[100]; while(cin >> n,n){ for(int i=0;i<n;i++) scanf("%lf,%lf",&p[i].x,&p[i].y); vector<P>d=convex_hull(p,n); cout << n-d.size() << endl; } return 0; }
a.cc: In function 'std::vector<P> convex_hull(P*, int)': a.cc:43:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 43 | sort(ps,ps+n,cmp_x); | ^~~~ | sqrt
s628607011
p00068
C++
#include <vector> #include <algorithm> #include <cmath> using namespace std; main(){ int n,i,start,M; double x,y,dX,dY,dx,dy,dot,n1,n2,co,m; for(;scanf("%d",&n),n;){ vector<pair<pair<double,double>,int> >v; for(i=0;i<n;i++)scanf("%lf,%lf",&x,&y),v.push_back(make_pair(make_pair(x,y),i)); pair<pair<double,double>,int>p=*min_element(v.begin(),v.end()); dX=0,dY=-1; start=p.second; vector<int>V; for(;;){ m=-1,M=0; for(i=0;i<n;i++){ if(i==p.second)continue; dx=v[i].first.first-p.first.first,dy=v[i].first.second-p.first.second; dot=dX*dx+dY*dy; n1=hypot(dX,dY),n2=hypot(dx,dy); co=dot/n1/n2; //printf("%f\n",co); if(m<co)m=co,M=i; } if(M==start)break; V.push_back(M); //printf("---%d %d\n",M,start); dX=v[M].first.first-p.first.first,dY=v[M].first.second-p.first.second; p=v[M]; } printf("%d\n",n-V.size()-1); } }
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:8:14: error: 'scanf' was not declared in this scope 8 | for(;scanf("%d",&n),n;){ | ^~~~~ a.cc:32:17: error: 'printf' was not declared in this scope 32 | printf("%d\n",n-V.size()-1); | ^~~~~~ a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 3 | #include <cmath> +++ |+#include <cstdio> 4 | using namespace std;
s502181602
p00068
C++
#include <vector> #include <algorithm> #include <cstdio> #include <cmath> using namespace std; main(){ int n,i,start,M; double x,y,dX,dY,dx,dy,dot,n1,n2,co,m; for(;scanf("%d",&n),n;){ vector<pair<pair<double,double>,int> >v; for(i=0;i<n;i++)scanf("%lf,%lf",&x,&y),v.push_back(make_pair(make_pair(x,y),i)); pair<pair<double,double>,int>p=*min_element(v.begin(),v.end()); dX=0,dY=-1; start=p.second; vector<int>V; for(M=-1;M!=start;){ m=-1,n1=hypot(dX,dY) for(i=0;i<n;i++){ if(i==p.second)continue; dx=v[i].first.first-p.first.first,dy=v[i].first.second-p.first.second; dot=dX*dx+dY*dy; n2=hypot(dx,dy),co=dot/n1/n2; if(m<co)m=co,M=i; } V.push_back(M); dX=v[M].first.first-p.first.first,dY=v[M].first.second-p.first.second; p=v[M]; } printf("%d\n",n-V.size()); } }
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:17:45: error: expected ';' before 'for' 17 | m=-1,n1=hypot(dX,dY) | ^ | ; 18 | for(i=0;i<n;i++){ | ~~~ a.cc:18:40: error: expected ';' before ')' token 18 | for(i=0;i<n;i++){ | ^ | ;
s725795456
p00068
C++
#include <iostream> #include <iomanip> #include <sstream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <climits> #include <cfloat> #include <string> #include <vector> #include <stack> #include <queue> #include <set> #include <map> #include <bitset> #include <algorithm> #include <functional> #include <utility> #include <numeric> using namespace std; #define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i ) #define EACH( v, c ) for ( auto &v : c ) #define ALL( c ) (c).begin(), (c).end() struct Point { double x, y; Point() : x( 0 ), y( 0 ) { return; } Point( double x, double y ) : x( x ), y( y ) { return; } Point operator + ( const Point &a ) const { return Point( x + a.x, y + a.y ); } Point operator - ( const Point &a ) const { return Point( x - a.x, y - a.y ); } Point operator * ( const double &a ) const { return Point( x * a, y * a ); } Point operator / ( const double &a ) const { return Point( x / a, y / a ); } bool operator < ( const Point &a ) const { return x == a.x ? y < a.y : x < a.x; } }; // 外積 double cross( const Point &a, const Point &b ) { return a.x * b.y - a.y * b.x; } // グラハムスキャン vector< Point > getConvex( vector< Point > ps ) { const int N = ps.size(); sort( ALL( ps ) ); int k = 0; vector< Point > convex( N * 2 ); for ( int i = 0; i < N; i++ ) { while ( 2 <= k && cross( convex[ k - 1 ] - convex[ k - 2 ], ps[i] - convex[ k - 1 ] ) <= EPS ) { k--; } convex[ k++ ] = ps[i]; } for ( int i = N - 2, t = k; 0 <= i; i-- ) { while ( t < k && cross( convex[ k - 1 ] - convex[ k - 2 ], ps[i] - convex[ k - 1 ] ) <= EPS ) { k--; } convex[ k++ ] = ps[i]; } convex.resize( k - 1 ); return convex; } int main() { cin.tie( 0 ); ios::sync_with_stdio( false ); while ( true ) { int n; cin >> n; if ( !n ) { break; } vector< Point > ps( n ); EACH( p, ps ) { char d; cin >> p.x >> d >> p.y; } vector< Point > convex = getConvex( ps ); cout << n - convex.size() << endl; } return 0; }
a.cc: In function 'std::vector<Point> getConvex(std::vector<Point>)': a.cc:87:106: error: 'EPS' was not declared in this scope 87 | while ( 2 <= k && cross( convex[ k - 1 ] - convex[ k - 2 ], ps[i] - convex[ k - 1 ] ) <= EPS ) | ^~~ a.cc:97:105: error: 'EPS' was not declared in this scope 97 | while ( t < k && cross( convex[ k - 1 ] - convex[ k - 2 ], ps[i] - convex[ k - 1 ] ) <= EPS ) | ^~~
s438668029
p00068
C++
#include<iostream> #include<complex> #include<cstdio> using namespace std; typedef complex<double> p; double det(p a,p b) { return a.real()*b.imag()-a.imag()*b.real(); } bool comp(p a,p b) { if(a.real()!=b.real()) return a.real()<b.real(); return a.imag()<b.imag(); } int main() { int n; while(cin>>n,n) { p ps[n]; for(int i = 0; i < n; ++i) { scanf("%lf,%lf",&ps[i].real(),&ps[i].imag()); } sort(ps,ps+n,comp); int k=0; p qs[n*2]; for(int i = 0; i < n; ++i) { while(k>1&&det(qs[k-1]-qs[k-2],ps[i]-qs[k-1])<=0) --k; qs[k++]=ps[i]; } for(int i = n-2, t=k; i >= 0; --i) { while(k>t&&det(qs[k-1]-qs[k-2],ps[i]-qs[k-1])<=0) --k; qs[k++]=ps[i]; } cout<<n-k+1<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:26:52: error: lvalue required as unary '&' operand 26 | scanf("%lf,%lf",&ps[i].real(),&ps[i].imag()); | ~~~~~~~~~~^~ a.cc:26:66: error: lvalue required as unary '&' operand 26 | scanf("%lf,%lf",&ps[i].real(),&ps[i].imag()); | ~~~~~~~~~~^~ a.cc:29:17: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 29 | sort(ps,ps+n,comp); | ^~~~ | sqrt
s409017715
p00068
C++
#include<iostream> #include<algorithm> #include<queue> #include<map> #include<string.h> #include<math.h> #include<functional> using namespace std; int main(){ int count = 0; pair<double, double> xy[100]; while(cin>>count){ if(count==0)break; for(int i=0; i<count; i++)scanf("%lf,%lf",&xy[i].first,&xy[i].second); sort(xy,xy+count); int now = 0; int end = count; while(now<end-1){ double max = INTMAX_MIN; int max_n = now; for(int i=now+1; i<end; i++){ double temp; double x = xy[i].first-xy[now].first; double y = xy[i].second-xy[now].second; if(x==0){ if(y>0)temp=INTMAX_MAX; else temp= INTMAX_MIN+1; }else{ temp = y/x; } if(temp>max){ max = temp; max_n = i; } } now = max_n; count--; } now = 0; while(now<end-1){ double min = INTMAX_MAX; int min_n = now; for(int i=now+1; i<end; i++){ double temp; double x = xy[i].first-xy[now].first; double y = xy[i].second-xy[now].second; if(x==0){ if(y>0)temp=INTMAX_MAX-1; else temp= INTMAX_MIN; }else{ temp = y/x; } if(temp<min){ min = temp; min_n = i; } } now = min_n; count--; } cout<<count<<endl; } }
a.cc: In function 'int main()': a.cc:26:26: error: 'INTMAX_MIN' was not declared in this scope 26 | double max = INTMAX_MIN; | ^~~~~~~~~~ a.cc:33:33: error: 'INTMAX_MAX' was not declared in this scope; did you mean 'TMP_MAX'? 33 | if(y>0)temp=INTMAX_MAX; | ^~~~~~~~~~ | TMP_MAX a.cc:48:26: error: 'INTMAX_MAX' was not declared in this scope; did you mean 'TMP_MAX'? 48 | double min = INTMAX_MAX; | ^~~~~~~~~~ | TMP_MAX a.cc:56:32: error: 'INTMAX_MIN' was not declared in this scope 56 | else temp= INTMAX_MIN; | ^~~~~~~~~~
s483237941
p00068
C++
#include <map> #include <set> #include <list> #include <cmath> #include <queue> #include <stack> #include <cstdio> #include <string> #include <vector> #include <complex> #include <cstring> #include <numeric> #include <sstream> #include <iostream> #include <algorithm> #include <functional> #define mp make_pair #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,n) for(int i=0;i<(n);i++) #define repi(i,a,b) for(int i = (a); i < (b); i++) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<vb> vvb; typedef vector<vi> vvi; typedef pair<int,int> pii; const int INF=1<<29; const double EPS=1e-9; const int dx[]={1,0,-1,0},dy[]={0,-1,0,1}; typedef complex<double> P; typedef vector<P> G; // 内積 (dot product) : a・b = |a||b|cosΘ double dot(P a, P b) { return (a.real() * b.real() + a.imag() * b.imag()); } // 外積 (cross product) : a×b = |a||b|sinΘ double cross(P a, P b) { return (a.real() * b.imag() - a.imag() * b.real()); } /*Graham Scan*/ //凸多角形を求める G getConvex(G ps){ const int N =ps.size(); sort(ps.begin(),ps.end()); int k = 0; vector<P> convex(N*2); for(int i =0;i < N;i++){ while(2 <=k&&cross(convex[k-1]-convex[k-2],ps[i]-convex[k-1])<=0){ k--; } convex[k++]=ps[i]; } for(int i =N-2,t = k;i >=0;i--){ while(t <k&& cross(convex[k-1]-convex[k-2],ps[i]-convex[k-1])<=0){ k--; } convex[k++]=ps[i]; } return convex; } int main(){ int n; while(cin>>n,n){ G g; for(int i =0; i<n;i++){ double x,y; char c; cin>>x>>c>>y; g.push_back(P(x,y)); } G convex =getConvex(g); cout <<n-convex.size()<<endl; } return 0; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/bits/stl_tree.h:63, from /usr/include/c++/14/map:62, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]': /usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1777 | if (__comp(__i, __first)) | ~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:56:6: required from here 56 | sort(ps.begin(),ps.end()); | ~~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>') 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)' 1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)' 1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_map.h:63, from /usr/include/c++/14/map:63: /usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_Args1 ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::tuple<_Args1 ...>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_map.h:1550:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)' 1550 | operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_map.h:1550:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::map<_Key, _Tp, _Compare, _Allocator>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/map:64: /usr/include/c++/14/bits/stl_multimap.h:1172:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const multimap<_Key, _Tp, _Compare, _Allocator>&, const multimap<_Key, _Tp, _Compare, _Allocator>&)' 1172 | operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_multimap.h:1172:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::multimap<_Key, _Tp, _Compare, _Allocator>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/set:63, from a.cc:2: /usr/include/c++/14/bits/stl_set.h:1025:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator<(const set<_Key, _Compare, _Allocator>&, const set<_Key, _Compare, _Allocator>&)' 1025 | operator<(const set<_Key, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_set.h:1025:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::set<_Key, _Compare, _Allocator>' 45 | { return *__it1 < *__it2; } | ~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/set:64: /usr/include/c++/14/bits/stl_multiset.h:1011:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator<(const multiset<_Key, _Compare, _Allocator>&, const multiset<_Key, _Compare, _Allocator>&)' 1011 | operator<(const multiset<_Key, _Compare, _Alloc>& __x, | ^~~~~~~~ /usr/includ
s187447306
p00069
Java
import java.io.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; char[][] map; while(!(line=br.readLine()).equals("0")){ if(line.isEmpty()){ continue; } int n=Integer.parseInt(line); int m=Integer.parseInt(br.readLine()): int g=Integer.parseInt(br.readLine()): int d=Integer.parseInt(br.readLine()): map=new char[d][n+1]; for(int i=0;i<d;i++){ line="0"+br.readLine()+"0"; for(int j=0;j<=n;j++){ map[i][j]=line.charAt(j); } } System.out.println(solve(m,g,map)); } } private static boolean canReachGoal(int m,int g,char[][] map){ int now=m; for(int i=0;i<map.length;i++){ if(char[i][now-1]=='1'){ now--; } else if(char[i][now]=='1'){ now++; } } return g==now; } private static String solve(int m,int g,char[][] map){ if(canReachGoal(m,g,map)){ return "0"; } for(int i=0;i<map.length;i++){ for(int j=1;j<map[0].length;j++){ if(map[i][j-1]=='0'&&map[i][j]=='0'&&map[i][j+1]=='0'){ map[i][j]='1'; if(canReachGoal(m,g,map)){ return String.valueOf(i+1)+" "+String.valueOf(j); } map[i][j]='0'; } } } return "1"; } }
Main.java:13: error: ';' expected int m=Integer.parseInt(br.readLine()): ^ Main.java:14: error: ';' expected int g=Integer.parseInt(br.readLine()): ^ Main.java:15: error: ';' expected int d=Integer.parseInt(br.readLine()): ^ Main.java:30: error: ']' expected if(char[i][now-1]=='1'){ ^ Main.java:30: error: ';' expected if(char[i][now-1]=='1'){ ^ Main.java:30: error: not a statement if(char[i][now-1]=='1'){ ^ Main.java:30: error: ';' expected if(char[i][now-1]=='1'){ ^ Main.java:33: error: ']' expected else if(char[i][now]=='1'){ ^ Main.java:33: error: ';' expected else if(char[i][now]=='1'){ ^ Main.java:33: error: 'else' without 'if' else if(char[i][now]=='1'){ ^ Main.java:33: error: not a statement else if(char[i][now]=='1'){ ^ Main.java:33: error: ';' expected else if(char[i][now]=='1'){ ^ 12 errors
s056038467
p00069
C++
#define _USE_MATH_DEFINES #include <iostream> #include <iomanip> #include <utility> #include <algorithm> #include <vector> #include <cmath> #define int long long #define rep(i,n) for(int i=0;i<n;i++) #define Rep(i,a,b) for(int i=a;i<b;i++) #define REP(i,a,b) for(int i=a;i<=b;i++) #define rev(i,n) for(int i=n-1;i>=0;i--) #define vi vector<int> #define vvi vector<vi> #define pb push_back #define pi pair<int,int> #define vp vector<pair<int,int>> #define mp make_pair #define all(v) (v).begin(),(v).end() #define fi first #define se second #define MEMSET(a) memset(a,0,sizeof(a)) #define inf (1ll<<60) #define Yes(f) cout<<(f?"Yes":"No")<<endl #define yes(f) cout<<(f?"yes":"no")<<endl #define YES(f) cout<<(f?"YES":"NO")<<endl using namespace std; const int mod=1e9+7; void run(); void init() { ios::sync_with_stdio(false); cin.tie(0); cout<<fixed<<setprecision(12); } signed main(){ init(); run(); return 0; } int n,d,m,g; int a[30][10]; bool solve(){ int x=m-1; rep(i,d){ if(x>0&&a[i][x-1])x--; else if(x<n-1&&a[i][x])x++; } return x==g-1; } void run(){ while(cin>>n,n){ cin>>m>>g>>d; MEMSET(a); char c; rep(i,d){ rep(j,n-1){ cin>>c; a[i][j]=c-'0'; } } if(solve()){ cout<<0<<endl; continue; } rep(i,d){ rep(j,n-1){ if(a[i][j])continue; if(j>0&&a[i][j-1])continue; if(j<n-1&&a[i][j+1])continue; a[i][j]=1; if(solve()){ cout<<(i+1)<<" "<<(j+1)<<endl; goto BR; } a[i][j]=0; } } cout<<1<<endl; BR:; } }
a.cc: In function 'void run()': a.cc:22:19: error: 'memset' was not declared in this scope 22 | #define MEMSET(a) memset(a,0,sizeof(a)) | ^~~~~~ a.cc:61:5: note: in expansion of macro 'MEMSET' 61 | MEMSET(a); | ^~~~~~ a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 7 | #include <cmath> +++ |+#include <cstring> 8 | #define int long long
s682866850
p00069
C++
#include<iostream> #include<vector> #include<cmath> using namespace std; vector<vector<int> >vec; vector<int>v; int n,m,l,d,cur,dep,mi,de; char b; void go(){ cur=m,dep=0; while(dep<d){ for(int i=0;i<vec[dep].size();i++){ if(vec[dep][i]==cur){ cur=vec[dep][i]+1; break; } if(vec[dep][i]+1==cur){ cur=vec[dep][i]; break; } } dep++; } } int main(){ while(cin>>n,n){ vec.clear(); cin>>m>>l>>d; for(int i=0;i<d;i++){ vec.push_back(v); for(int j=1;j<n;j++){ cin>>b; if(b=='1') vec[i].push_back(j); } } go(); if(cur==l){ cout<<0<<endl; goto ne; } mi=99,de=0; for(int i=1;i<n;i++){ for(int j=0;j<d;j++){ if(find(vec[j].begin(),vec[j].end(),i-1)!=vec[j].end())continue; if(find(vec[j].begin(),vec[j].end(),i)!=vec[j].end())continue; if(find(vec[j].begin(),vec[j].end(),i+1)!=vec[j].end())continue; vec[j].push_back(i); go(); if(cur==l){ if(abs(cur-m)<abs(mi-m)){ mi=i; de=j; } } vec[j].pop_back(); } } if(mi!=99)cout<<de<<" "<<mi<<endl; else cout<<1<<endl; ne:; } }
a.cc: In function 'int main()': a.cc:48:24: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int)' 48 | if(find(vec[j].begin(),vec[j].end(),i-1)!=vec[j].end())continue; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:48:24: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>' 48 | if(find(vec[j].begin(),vec[j].end(),i-1)!=vec[j].end())continue; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:49:24: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)' 49 | if(find(vec[j].begin(),vec[j].end(),i)!=vec[j].end())continue; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:49:24: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>' 49 | if(find(vec[j].begin(),vec[j].end(),i)!=vec[j].end())continue; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:50:24: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int)' 50 | if(find(vec[j].begin(),vec[j].end(),i+1)!=vec[j].end())continue; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)' 435 | find(istreambuf_iterator<_CharT> __first, | ^~~~ /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed: a.cc:50:24: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>' 50 | if(find(vec[j].begin(),vec[j].end(),i+1)!=vec[j].end())continue; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s261360836
p00069
C++
loop do n = gets.to_i break if n==0 m = gets.to_i g = gets.to_i d = gets.to_i b = d.times.map{gets.chomp.chars.map(&:to_i)} map = Array.new(d+1){Array.new(n,0)} n.times do |i| map[0][i] = i+1 end d.times do |j| n.times do |i| if i<n && b[j][i] == 1 map[j+1][i] = map[j][i+1] elsif i>0 && b[j][i-1] == 1 map[j+1][i] = map[j][i-1] else map[j+1][i] = map[j][i] end end end puts map.map{|x| x*' '}*"\n" if map[d][g-1] == m puts 0 elsif k = map[d][g-1] (d-1).times do |j| i = map[j].find_index(m) if i<n && b[j][i] == 0 && (i<=0 || b[j][i-1] == 0) && (i>=n-2 || b[j][i+1] == 0) if map[j][i+1] == k puts [j+1, i+1].join(' ') exit() end elsif i>0 && b[j][i-1] == 0 && (i>=n || b[j][i] == 0) && (i<2 || b[j][i-2] == 0) if map[j][i-1] == k puts [j+1, i].join(' ') exit() end end end puts '1' end end
a.cc:1:1: error: 'loop' does not name a type 1 | loop do | ^~~~ a.cc:9:3: error: 'map' does not name a type 9 | map = Array.new(d+1){Array.new(n,0)} | ^~~ a.cc:10:3: error: 'n' does not name a type 10 | n.times do |i| | ^ a.cc:26:27: error: expected unqualified-id before string constant 26 | puts map.map{|x| x*' '}*"\n" | ^~~~
s647145773
p00069
C++
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main{ static boolean node[][]; static int root[][]; public static void main(String[] args)throws IOException{ InputStreamReader isr = new InputStreamReader(System.in); BufferedReader reader = new BufferedReader(isr); Main app = new Main(); String string; int n, m, d, ans, tmp; while(!(string = reader.readLine()).equals("0")){ n = Integer.valueOf(string); m = Integer.valueOf(reader.readLine()) - 1; ans = Integer.valueOf(reader.readLine()) - 1; d = Integer.valueOf(reader.readLine()); node = new boolean[n][n]; root = new int[2][d]; tmp = m; for(int i = 0; i < d; i++){ char ch[] = reader.readLine().toCharArray(); for(int j = 0; j < n - 1; j++){ if(ch[j] == '1'){ root[0][i] = j; node[j][j + 1] = true; node[j + 1][j] = true; } } if(tmp + 1 < n && node[tmp][tmp + 1]) tmp++; else if(tmp - 1 >= 0 && node[tmp][tmp - 1]) tmp--; root[1][i] = tmp; } if(ans == app.doing(0, m)){ System.out.println(0); continue; }else{ boolean judge = false; for(int i = 0; i < d - 1; i++){ if(root[1][i] - 1 >= 0){ if(ans == app.doing(i, root[1][i] - 1)){ System.out.println(i + 1 + " " + (root[1][i] + 1)); judge = true; break; } }else if(root[1][i] + 1 < n){ if(ans == app.doing(i, root[1][i] + 1)){ System.out.println(i + 1 + " " + (root[1][i] + 1)); judge = true; break; } } } if(judge) continue; } System.out.println(1); } reader.close(); } public int doing(int n, int ing){ int len = node.length; for(int i = n + 1; i < len; i++){ if(ing + 1 < len && node[ing][ing + 1]) ing++; else if(ing - 1 >= 0 && node[ing][ing - 1]) ing--; } return ing; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.BufferedReader; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.io.IOException; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.io.InputStreamReader; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: expected unqualified-id before 'public' 5 | public class Main{ | ^~~~~~
s330900708
p00069
C++
#include<iostream> using namespace std;int n,m,g,d,l[10],f,i,j,y,x;string p[30];int c(){for(y=n;y-->0;)l[y]=y+1;for(;++y<d;)for(x=n-1;x-->0;)if(p[y][x]^48)swap(l[x],l[x+1]);return l[g-1]==m;}Main(){for(;cin>>n>>m>>g>>d;f-1?puts(f?"0":"1"):printf("%d %d\n",i,j)){for(i=0;i<d;)cin>>p[i++];f=c()*2;for(i=0;!f & i<d;i++)for(j=0;!f & j<n-1;j++)if(p[i][j]-49&p[i][j-1]-49&p[i][j+1]-49){p[i][j]++,f=c(),p[i][j]--;};}}
a.cc:2:173: error: ISO C++ forbids declaration of 'Main' with no type [-fpermissive] 2 | using namespace std;int n,m,g,d,l[10],f,i,j,y,x;string p[30];int c(){for(y=n;y-->0;)l[y]=y+1;for(;++y<d;)for(x=n-1;x-->0;)if(p[y][x]^48)swap(l[x],l[x+1]);return l[g-1]==m;}Main(){for(;cin>>n>>m>>g>>d;f-1?puts(f?"0":"1"):printf("%d %d\n",i,j)){for(i=0;i<d;)cin>>p[i++];f=c()*2;for(i=0;!f & i<d;i++)for(j=0;!f & j<n-1;j++)if(p[i][j]-49&p[i][j-1]-49&p[i][j+1]-49){p[i][j]++,f=c(),p[i][j]--;};}} | ^~~~ a.cc: In function 'int Main()': a.cc:2:391: warning: no return statement in function returning non-void [-Wreturn-type] 2 | using namespace std;int n,m,g,d,l[10],f,i,j,y,x;string p[30];int c(){for(y=n;y-->0;)l[y]=y+1;for(;++y<d;)for(x=n-1;x-->0;)if(p[y][x]^48)swap(l[x],l[x+1]);return l[g-1]==m;}Main(){for(;cin>>n>>m>>g>>d;f-1?puts(f?"0":"1"):printf("%d %d\n",i,j)){for(i=0;i<d;)cin>>p[i++];f=c()*2;for(i=0;!f & i<d;i++)for(j=0;!f & j<n-1;j++)if(p[i][j]-49&p[i][j-1]-49&p[i][j+1]-49){p[i][j]++,f=c(),p[i][j]--;};}} | ^