Submission #979035

# Submission time Handle Problem Language Result Execution time Memory
979035 2024-05-10T06:48:47 Z simuyu Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
//#include "vision.h"
#include <bits/stdc++.h>
using namespace std;


void construct_network(int H, int W, int K) {
	//vector<int> Ns;
	//Ns = {0, 1};
	//int a = add_and(Ns);




	// st1 or maybe 2??
	vector<int> st2ONs, st2INs;
	if (max(H,W) <= 30) {
        for (int mh=0; mh<H; mh++) {
            for (int mw=0; mw<W; mw++) {
                // middle is mh, mw
                // note that this is only true if (mh*W + mw) is true yea.

                // try four sides surround with K.
                st2INs.clear(); // jic

                for (int i=0; i<=K; i++) {
                    // try adding from all 4 directions
                    if ( ((0 <= mh-i) && (mh-i < H)) && ((0 <= mw-(K-i)) && (mw-(K-i) < W)) ) st2INs.push_back( (mh-i)*W + (mw-(K-i)) );
                    if ((K-i) != 0)
                        if ( ((0 <= mh-i) && (mh-i < H)) && ((0 <= mw+(K-i)) && (mw+(K-i) < W)) ) st2INs.push_back( (mh-i)*W + (mw+(K-i)) );

                    if (i!=0) {
                        if ( ((0 <= mh+i) && (mh+i < H)) && ((0 <= mw-(K-i)) && (mw-(K-i) < W)) ) st2INs.push_back( (mh+i)*W + (mw-(K-i)) );

                        if ((K-i) != 0)
                            if ( ((0 <= mh+i) && (mh+i < H)) && ((0 <= mw+(K-i)) && (mw+(K-i) < W)) ) st2INs.push_back( (mh+i)*W + (mw+(K-i)) );
                    }
                }

                if (st2INs.size() == 0) continue;

                int mor = add_or(st2INs); // either of them are yes
                int can = add_and( {mor, (mh*W + mw)} ); // and the initial condition was true also
                st2ONs.push_back(can);

                /*cout << '(' << mh << ',' << mw << "): ";
                for (int i=0; i<st2INs.size(); i++) {
                    cout << '(' << st2INs[i]/W << ',' << st2INs[i]%W << ") ";
                }
                cout << endl;*/
            }
        }
        int st2 = add_or(st2ONs); // if any of those cases were fulfilled
	} else {
        // st6
        vector<int> st6Ns;
        for (int i=0; i<=K; i++) {
            // i is row, K-i is column.
            if ((i>=H) || (K-i >= W)) continue; // if invalid index
            //cout << "(" << i << "," << K-i << ")" << endl;
            st6Ns.push_back( i*W + (K-i) );
        }
        int st6 = add_or(st6Ns);
        st6Ns.clear();
	}


}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:41:27: error: 'add_or' was not declared in this scope
   41 |                 int mor = add_or(st2INs); // either of them are yes
      |                           ^~~~~~
vision.cpp:42:27: error: 'add_and' was not declared in this scope
   42 |                 int can = add_and( {mor, (mh*W + mw)} ); // and the initial condition was true also
      |                           ^~~~~~~
vision.cpp:52:19: error: 'add_or' was not declared in this scope
   52 |         int st2 = add_or(st2ONs); // if any of those cases were fulfilled
      |                   ^~~~~~
vision.cpp:52:13: warning: unused variable 'st2' [-Wunused-variable]
   52 |         int st2 = add_or(st2ONs); // if any of those cases were fulfilled
      |             ^~~
vision.cpp:62:19: error: 'add_or' was not declared in this scope
   62 |         int st6 = add_or(st6Ns);
      |                   ^~~~~~
vision.cpp:62:13: warning: unused variable 'st6' [-Wunused-variable]
   62 |         int st6 = add_or(st6Ns);
      |             ^~~