Submission #755704

# Submission time Handle Problem Language Result Execution time Memory
755704 2023-06-10T15:13:08 Z Rafi22 Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
//#include "vision.h"


using namespace std;

#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;

int it;
bool mem[100007];

const int N=207;

int orX[N];
int pX[N];
int orY[N];
int pY[N];


vector<int>add(vector<int>V,int k)
{
    vector<int>res;
    res.pb(add_xor({V[0],k}));
    int w=add_and({V[0],k});
    for(int i=1;i<=8;i++)
    {
        res.pb(add_xor({V[i],w}));
        w=add_and({V[i],w});
    }
    return res;
}

void construct_network(int n,int m,int k)
{
    it=n*m-1;
    int N=add_not(0);
    for(int i=0;i<n;i++)
    {
        vector<int>V;
        for(int j=0;j<m;j++) V.pb(i*m+j);
        orX[i]=add_xor(V);
    }
    //for(int i=0;i<n;i++) cout<<mem[orX[i]]<<" ";
  //  cout<<endl;
    pX[0]=add_and({0,N});
    for(int i=1;i<=n;i++) pX[i]=add_xor({pX[i-1],orX[i-1]});
    for(int j=0;j<m;j++)
    {
        vector<int>V;
        for(int i=0;i<n;i++) V.pb(i*m+j);
        orY[j]=add_xor(V);
    }
   // for(int j=0;j<m;j++) cout<<mem[orY[j]]<<" ";
  //  cout<<endl;
    pY[0]=add_and({0,N});
    for(int j=1;j<=m;j++) pY[j]=add_xor({pY[j-1],orY[j-1]});
    vector<int>ans;
    for(int i=0;i<=8;i++) ans.pb(add_and({0,N}));
    for(int i=1;i<=n;i++) ans=add(ans,pX[i]);
    for(int j=1;j<=m;j++) ans=add(ans,pY[j]);
    int Z=add_and({0,N});
    int O=add_not(Z);
    vector<int>wyn;
    for(int i=0;i<=8;i++)
    {
        if(k&(1<<i)) wyn.pb(add_xor({Z,ans[i]}));
        else wyn.pb(add_xor({O,ans[i]}));
    }
    add_and(wyn);
   // cout<<mem[add_and(wyn)]<<endl;
}

/*
int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>mem[i*m+j];
        }
    }
    construct_network(n,m,k);
    return 0;
}*/

Compilation message

vision.cpp: In function 'std::vector<int> add(std::vector<int>, int)':
vision.cpp:32:12: error: 'add_xor' was not declared in this scope
   32 |     res.pb(add_xor({V[0],k}));
      |            ^~~~~~~
vision.cpp:33:11: error: 'add_and' was not declared in this scope
   33 |     int w=add_and({V[0],k});
      |           ^~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:45:11: error: 'add_not' was not declared in this scope
   45 |     int N=add_not(0);
      |           ^~~~~~~
vision.cpp:50:16: error: 'add_xor' was not declared in this scope
   50 |         orX[i]=add_xor(V);
      |                ^~~~~~~
vision.cpp:54:11: error: 'add_and' was not declared in this scope
   54 |     pX[0]=add_and({0,N});
      |           ^~~~~~~
vision.cpp:55:33: error: 'add_xor' was not declared in this scope
   55 |     for(int i=1;i<=n;i++) pX[i]=add_xor({pX[i-1],orX[i-1]});
      |                                 ^~~~~~~
vision.cpp:60:16: error: 'add_xor' was not declared in this scope
   60 |         orY[j]=add_xor(V);
      |                ^~~~~~~
vision.cpp:65:33: error: 'add_xor' was not declared in this scope
   65 |     for(int j=1;j<=m;j++) pY[j]=add_xor({pY[j-1],orY[j-1]});
      |                                 ^~~~~~~
vision.cpp:75:29: error: 'add_xor' was not declared in this scope
   75 |         if(k&(1<<i)) wyn.pb(add_xor({Z,ans[i]}));
      |                             ^~~~~~~
vision.cpp:76:21: error: 'add_xor' was not declared in this scope
   76 |         else wyn.pb(add_xor({O,ans[i]}));
      |                     ^~~~~~~