Submission #424763

#TimeUsernameProblemLanguageResultExecution timeMemory
424763TryMaxVision Program (IOI19_vision)C++17
8 / 100
6 ms460 KiB
#include "vision.h"
#include <bits/stdc++.h>
#ifdef LOCAL
    #include "grader.cpp"
#endif // LOCAL

#define pb push_back

using namespace std;

const int N = 1e5 + 10;

int n, m, k;

int dist(int x, int y, int x1, int y1){
    return abs(x - x1) + abs(y - y1);
}

int pos(int x, int y){
    return x * m + y;
}

void construct_network(int N, int M, int K){
    n = N;
    m = M;
    k = K;
    int last = 0;
	for(int i = 0; i < n; ++i)
        for(int j = 0; j < m; ++j){
            vector<int> q;
            for(int i1 = i; i1 < n; ++i1)
                for(int j1 = 0; j1 < m; ++j1)
                    if(dist(i, j, i1, j1) == k)
                        q.pb(pos(i1, j1));
            if(!q.empty()){
                int t = add_or(q);
                q.clear();
                q.pb(pos(i, j));
                q.pb(t);
                last = add_and(q);
            }
            break;
        }
    vector<int> q;
    for(int i = n * m + 1; i <= last; i += 2)
        q.pb(i);
    add_or(q);
}
/*
2 3 3
0 0 0 1
0 0 0 2
0 0 1 0
0 0 1 1
0 0 1 2
0 1 0 2
0 1 1 0
0 1 1 1
0 1 1 2
0 2 1 0
0 2 1 1
0 2 1 2
1 0 1 1
1 0 1 2
1 1 1 2
-1
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...