Submission #425182

#TimeUsernameProblemLanguageResultExecution timeMemory
425182daanolavVision Program (IOI19_vision)C++14
Compilation error
0 ms0 KiB
#include "vision.h" using namespace std; typedef vector<int> vi; int x,y,k,xOffset,yOffset,a,b,c; void construct_network(int H, int W, int _K) { std::vector<int> Ns; vi kSizeIndexes[W][H]; vi kPlusOneSizeIndexes[W][H]; k = (_K + 1) / 2; for(x = 0; x < W; ++x) { for(y = 0; y < H; ++y) { for(xOffset = -k - 1; xOffset <= k + 1; ++xOffset) { if(x + xOffset < 0 || x + xOffset >= W) { continue; } for(yOffset = -k - 1; yOffset <= k + 1; ++yOffset) { if(y + yOffset < 0 || y + yOffset >= H) { continue; } if(abs(xOffset) + abs(yOffset) <= k) { kSizeIndexes[x][y].push_back((y + yOffset) * W + x + xOffset); } if(min(abs(xOffset - 1),abs(xOffset)) + abs(yOffset) <= k || (xOffset == 0 && yOffset == k + 1)) { kPlusOneSizeIndexes[x][y].push_back((y + yOffset) * W + x + xOffset); cerr << x << " " << y << " has " << (x + xOffset) << " " << (y + yOffset) << endl; } } } } } vi shouldAllBeOn; vi shouldBeOn; if(k == _K * 2) { for(x = 0; x < W; ++x) { for(y = 0; y < H; ++y) { a = add_or(kSizeIndexes[x][y]); b = add_not(a); c = add_xor(kSizeIndexes[x][y]); Ns = {b,c}; shouldAllBeOn.push_back(add_or(Ns)); a = add_or(kPlusOneSizeIndexes[x][y]); b = add_xor(kPlusOneSizeIndexes[x][y]); c = add_not(b); Ns = {b,c}; shouldBeOn.push_back(add_and(Ns)); } } } else { for(x = 0; x < W; ++x) { for(y = 0; y < H; ++y) { a = add_or(kPlusOneSizeIndexes[x][y]); b = add_not(a); c = add_xor(kPlusOneSizeIndexes[x][y]); Ns = {b,c}; shouldAllBeOn.push_back(add_or(Ns)); a = add_or(kSizeIndexes[x][y]); b = add_xor(kSizeIndexes[x][y]); c = add_not(b); Ns = {b,c}; shouldBeOn.push_back(add_and(Ns)); } } } a = add_and(shouldAllBeOn); b = add_or(shouldBeOn); Ns = {a,b}; add_and(Ns); return; }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:35:25: error: 'cerr' was not declared in this scope
   35 |                         cerr << x << " " << y << " has " << (x + xOffset) << " " << (y + yOffset) << endl;
      |                         ^~~~
vision.cpp:2:1: note: 'std::cerr' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    1 | #include "vision.h"
  +++ |+#include <iostream>
    2 | 
vision.cpp:35:102: error: 'endl' was not declared in this scope
   35 |                         cerr << x << " " << y << " has " << (x + xOffset) << " " << (y + yOffset) << endl;
      |                                                                                                      ^~~~
vision.cpp:2:1: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'?
    1 | #include "vision.h"
  +++ |+#include <ostream>
    2 |