답안 #152045

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152045 2019-09-06T07:05:10 Z beso123 Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
void construct_network(int H, int W, int K){
    h=H;
    w=W;
int ind=0,x,y,x2,y2;
for(int k=1;k<=H;k++){
        vector <int> v;
for(int i=1;i<=W;i++){
   int j=to(k,i);
   v.push_back(j);
}
int i=add_or(v);
if(i==1)
if(x==0){
    x=k;
else x2=k;
ind++
}

}
if(ind==1)
    x2=x;
    ind=0;
for(int k=1;k<=W;k++){
        vector <int> v;
for(int i=1;i<=H;i++){
   int j=to(i,k);
   v.push_back(j);
}
int i=add_or(v);
if(i==1)
if(y==0){
    y=k;
else y2=k;
ind++
}

}
if(ind==1)
    y2=y;
  int p=abs(x-x1)+abs(y-y1);
  if(p==k){
        vector <int> sab;
  sab.push_back(to(x,x1))l
    add_and(sab);
  }
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:5:5: error: 'h' was not declared in this scope
     h=H;
     ^
vision.cpp:6:5: error: 'w' was not declared in this scope
     w=W;
     ^
vision.cpp:11:10: error: 'to' was not declared in this scope
    int j=to(k,i);
          ^~
vision.cpp:11:10: note: suggested alternative: 'tm'
    int j=to(k,i);
          ^~
          tm
vision.cpp:18:1: error: expected '}' before 'else'
 else x2=k;
 ^~~~
vision.cpp:15:3: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
 if(i==1)
   ^
vision.cpp:20:1: error: expected ';' before '}' token
 }
 ^
vision.cpp:7:13: warning: unused variable 'y' [-Wunused-variable]
 int ind=0,x,y,x2,y2;
             ^
vision.cpp:7:18: warning: unused variable 'y2' [-Wunused-variable]
 int ind=0,x,y,x2,y2;
                  ^~
vision.cpp: At global scope:
vision.cpp:23:1: error: expected unqualified-id before 'if'
 if(ind==1)
 ^~
vision.cpp:25:5: error: 'ind' does not name a type; did you mean 'int'?
     ind=0;
     ^~~
     int
vision.cpp:26:1: error: expected unqualified-id before 'for'
 for(int k=1;k<=W;k++){
 ^~~
vision.cpp:26:13: error: 'k' does not name a type
 for(int k=1;k<=W;k++){
             ^
vision.cpp:26:18: error: 'k' does not name a type
 for(int k=1;k<=W;k++){
                  ^
vision.cpp:41:1: error: expected unqualified-id before 'if'
 if(ind==1)
 ^~
vision.cpp:43:13: error: 'x' was not declared in this scope
   int p=abs(x-x1)+abs(y-y1);
             ^
vision.cpp:43:15: error: 'x1' was not declared in this scope
   int p=abs(x-x1)+abs(y-y1);
               ^~
vision.cpp:43:15: note: suggested alternative: 'y1'
   int p=abs(x-x1)+abs(y-y1);
               ^~
               y1
vision.cpp:43:23: error: 'y' was not declared in this scope
   int p=abs(x-x1)+abs(y-y1);
                       ^
vision.cpp:44:3: error: expected unqualified-id before 'if'
   if(p==k){
   ^~
vision.cpp:49:1: error: expected declaration before '}' token
 }
 ^