Submission #316540

# Submission time Handle Problem Language Result Execution time Memory
316540 2020-10-26T15:24:13 Z talant117408 Vision Program (IOI19_vision) C++17
0 / 100
22 ms 2812 KB
#include "vision.h"
#ifdef EVAL
#else
#include "grader.cpp" 
#endif
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
 
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) int((v).size())
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define OK cout << "OK" << endl;

void construct_network(int n, int m, int dist) {
	vector <int> ldiagOne(403), rdiagOne(403), ldiagTwo(403), rdiagTwo(403);
    vector <vector <int>> ldiagEl(403), rdiagEl(403);
    int i, j;
    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            rdiagEl[i+j].pb(i*m+j);
            ldiagEl[i-j+m-1].pb(i*m+j);
        }
    }
    for(i = 0; i < n+m-1; i++){
        vector <int> v1, v2;
        
        v1.pb(add_or(rdiagEl[i]));
        v1.pb(add_xor(rdiagEl[i]));
        rdiagOne[i] = add_and(v1);
        
        v2.pb(add_or(ldiagEl[i]));
        v2.pb(add_xor(ldiagEl[i]));
        ldiagOne[i] = add_and(v2);
        
        v1.clear(); v2.clear();
        
        v1.pb(add_or(rdiagEl[i]));
        v1.pb(add_not(add_xor(rdiagEl[i])));
        rdiagTwo[i] = add_and(v1);
        
        v2.pb(add_or(ldiagEl[i]));
        v2.pb(add_not(add_xor(ldiagEl[i])));
        ldiagTwo[i] = add_and(v2);
    }
    
    vector <int> blocks_dist_plus_oneL, blocks_dist_plus_oneR, blocks_distL, blocks_distR;
    vector <int> blocks_dist_plus_oneAll, blocks_distAll;
    vector <int> ans;
    
    for(i = 0; i+dist <= n+m-1; i++){
        vector <int> vor, vxor, vans;
        
        for(j = i; j <= min(n+m-2, i+dist); j++){
            vor.pb(rdiagOne[j]);
            vxor.pb(rdiagOne[j]);
        }
        vans.pb(add_or(vor));
        vans.pb(add_not(add_xor(vxor)));
        blocks_dist_plus_oneR.pb(add_and(vans));
        
        vor.clear(); vxor.clear(); vans.clear();
        
        for(j = i; j <= min(n+m-2, i+dist); j++){
            vor.pb(rdiagTwo[j]);
            vxor.pb(rdiagTwo[j]);
        }
        vans.pb(add_or(vor));
        vans.pb(add_xor(vxor));
        blocks_dist_plus_oneR.pb(add_and(vans));
        
        vor.clear(); vxor.clear(); vans.clear();
        
        for(j = i; j <= min(n+m-2, i+dist); j++){
            vor.pb(ldiagOne[j]);
            vxor.pb(ldiagOne[j]);
        }
        vans.pb(add_or(vor));
        vans.pb(add_not(add_xor(vxor)));
        blocks_dist_plus_oneL.pb(add_and(vans));
        
        vor.clear(); vxor.clear(); vans.clear();
        
        for(j = i; j <= min(n+m-2, i+dist); j++){
            vor.pb(ldiagTwo[j]);
            vxor.pb(ldiagTwo[j]);
        }
        vans.pb(add_or(vor));
        vans.pb(add_xor(vxor));
        blocks_dist_plus_oneL.pb(add_and(vans));
    }
    
    for(i = 0; i+dist < n+m-1; i++){
        vector <int> vor, vxor, vans;
        
        for(j = i; j < i+dist; j++){
            vor.pb(rdiagOne[j]);
            vxor.pb(rdiagOne[j]);
        }
        vans.pb(add_or(vor));
        vans.pb(add_not(add_xor(vxor)));
        blocks_distR.pb(add_and(vans));
        
        vor.clear(); vxor.clear(); vans.clear();
        
        for(j = i; j < i+dist; j++){
            vor.pb(rdiagTwo[j]);
            vxor.pb(rdiagTwo[j]);
        }
        vans.pb(add_or(vor));
        vans.pb(add_xor(vxor));
        blocks_distR.pb(add_and(vans));
        
        vor.clear(); vxor.clear(); vans.clear();
        
        for(j = i; j < i+dist; j++){
            vor.pb(ldiagOne[j]);
            vxor.pb(ldiagOne[j]);
        }
        vans.pb(add_or(vor));
        vans.pb(add_not(add_xor(vxor)));
        blocks_distL.pb(add_and(vans));
        
        vor.clear(); vxor.clear(); vans.clear();
        
        for(j = i; j < i+dist; j++){
            vor.pb(ldiagTwo[j]);
            vxor.pb(ldiagTwo[j]);
        }
        vans.pb(add_or(vor));
        vans.pb(add_xor(vxor));
        blocks_distL.pb(add_and(vans));
    }
    
    blocks_dist_plus_oneAll.pb(add_or(blocks_dist_plus_oneR));
    blocks_dist_plus_oneAll.pb(add_or(blocks_dist_plus_oneL));
    blocks_distAll.pb(add_or(blocks_distR));
    blocks_distAll.pb(add_or(blocks_distL));
    ans.pb(add_and(blocks_dist_plus_oneAll));
    ans.pb(add_not(add_and(blocks_distAll)));
    add_and(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1148 KB Output is correct
2 Incorrect 22 ms 2172 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB on inputs (0, 0), (1, 0), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 2812 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -