답안 #238421

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
238421 2020-06-11T07:40:27 Z Ruxandra985 Vision Program (IOI19_vision) C++14
0 / 100
14 ms 5888 KB
#include <bits/stdc++.h>
#include <cassert>
#include <string>
#include "vision.h"


using namespace std;

/// ---------------------------------------------------------------------------------

int res[1000010] , f[210][210];
int sau_pr[510] , sau_sec[510] , xor_pr[510] , xor_sec[510];

int convert (int x , int y , int n , int m){

    return (x - 1) * m + y - 1;

}

int in_matrix (int i , int j , int n , int m){

    return (i > 0 && j > 0 && i <= n && j <= m);

}


void construct_network(int n, int m, int k) {

    int i , j , dif , dif2 , sum , sum2 , princ , sec , rez1 , rez2 , cod_diag , p1 , p2;
    vector <int> v , w , x;
    for (dif = 1 - m ; dif <= n - 1 ; dif++){

        for (i = 1 ; i <= n ; i++){

            /// i - j = dif
            j = i - dif;

            if (in_matrix(i , j , n , m)){ /// e o pozitie valida de pe diagonala asta

                v.push_back(convert(i , j , n , m));

            }


        }


        /// in v ai elem de pe diag
        cod_diag = dif - (1 - m);
        sau_pr[cod_diag] = add_or(v);
        xor_pr[cod_diag] = add_xor(v);

    }
    w.clear();
    for (dif = 1 - m ; dif <= n - 1 ; dif++){
        v.clear();
        x.clear();

        for (dif2 = dif ; dif2 <= n - 1 && dif2 <= dif + k ; dif2++){

            /// vad intervalul dif , dif2
            v.push_back(sau_pr[dif2]);
            x.push_back(xor_pr[dif2]);
        }


        p1 = add_or(v);
        p2 = add_xor(x);

        v.clear();
        v.push_back(p1);
        v.push_back(p2);

        w.push_back(add_xor(v));

    }

    princ = add_or(w);

    /// pe princ trb sa fie 1
    /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    for (sum = n + m ; sum >= 2 ; sum--){

        for (i = 1 ; i <= n ; i++){

            /// i + j = sum
            j = - (i - sum);

            if (in_matrix(i , j , n , m)){ /// e o pozitie valida de pe diagonala asta

                v.push_back(convert(i , j , n , m));

            }


        }

        /// in v ai elem de pe diag
        cod_diag = sum;
        sau_sec[cod_diag] = add_or(v);
        xor_sec[cod_diag] = add_xor(v);

    }

    w.clear();
    for (sum = n + m ; sum >= 2 ; sum--){
        v.clear();
        x.clear();

        for (sum2 = sum ; sum2 >= 2 && sum - sum2 <= k ; sum2--){

            /// vad intervalul sum , sum2
            v.push_back(sau_sec[sum2]);
            x.push_back(xor_sec[sum2]);
        }

        p1 = add_or(v);
        p2 = add_xor(x);

        v.clear();
        v.push_back(p1);
        v.push_back(p2);

        w.push_back(add_xor(v));

    }

    sec = add_or(w);

    v.clear();
    v.push_back(princ);
    v.push_back(sec);

    rez1 = add_and(v);
    if (k == 1)
        return;

    /// ----------------------------------------------------------------------------


    for (dif = 1 - m ; dif <= n - 1 ; dif++){

        for (i = 1 ; i <= n ; i++){

            /// i - j = dif
            j = i - dif;

            if (in_matrix(i , j , n , m)){ /// e o pozitie valida de pe diagonala asta

                v.push_back(convert(i , j , n , m));

            }


        }

        /// in v ai elem de pe diag
        cod_diag = dif - (1 - m);
        sau_pr[cod_diag] = add_or(v);
        xor_pr[cod_diag] = add_xor(v);

    }
    w.clear();
    for (dif = 1 - m ; dif <= n - 1 ; dif++){
        v.clear();
        x.clear();

        for (dif2 = dif ; dif2 <= n - 1 && dif2 < dif + k ; dif2++){

            /// vad intervalul dif , dif2
            v.push_back(sau_pr[dif2]);
            x.push_back(xor_pr[dif2]);
        }

        p1 = add_or(v);
        p2 = add_xor(x);

        v.clear();
        v.push_back(p1);
        v.push_back(p2);

        w.push_back(add_xor(v));

    }

    princ = add_or(w);
    /// pe princ trb sa fie 1
    /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    for (sum = n + m ; sum >= 2 ; sum--){

        for (i = 1 ; i <= n ; i++){

            /// i + j = sum
            j = - (i - sum);

            if (in_matrix(i , j , n , m)){ /// e o pozitie valida de pe diagonala asta

                v.push_back(convert(i , j , n , m));

            }


        }

        /// in v ai elem de pe diag
        cod_diag = sum;
        sau_sec[cod_diag] = add_or(v);
        xor_sec[cod_diag] = add_xor(v);

    }
    w.clear();
    for (sum = n + m ; sum >= 2 ; sum--){
        v.clear();
        x.clear();

        for (sum2 = sum ; sum2 >= 2 && sum - sum2 < k ; sum2--){

            /// vad intervalul sum , sum2
            v.push_back(sau_sec[sum2]);
            x.push_back(xor_sec[sum2]);
        }

        p1 = add_or(v);
        p2 = add_xor(x);

        v.clear();
        v.push_back(p1);
        v.push_back(p2);

        w.push_back(add_xor(v));

    }



    sec = add_or(w);

    v.clear();
    v.push_back(princ);
    v.push_back(sec);

    rez2 = add_and(v);


    rez2 = not(rez2);

    v.clear();
    v.push_back(rez1);
    v.push_back(rez2);
    add_and(v);


}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 14 ms 1024 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 5888 KB WA in grader: Too many inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 384 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -