이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
int ac[N];
int pos;
int loc[10]; //location of bits
int cell(int i, int j, int m){
return i * m + j;
}
// int add_xor(vector <int> b){
// ac[pos] = 0;
// for (auto x : b) ac[pos] ^= ac[x];
// return pos++;
// }
// int add_and(vector <int> b){
// ac[pos] = 1;
// for (auto x : b) ac[pos] &= ac[x];
// return pos++;
// }
// int add_or(vector <int> b){
// ac[pos] = 0;
// for (auto x : b) ac[pos] |= ac[x];
// return pos++;
// }
// int add_not(int b){
// ac[pos] = 1 - ac[b];
// return pos++;
// }
void add(int x){
for (int i = 0; i < 10; i++){
int y = add_and({x, loc[i]});
loc[i] = add_xor({x, loc[i]});
x = y;
}
}
void construct_network(int n, int m, int k) {
// std::vector<int> Ns;
// Ns = {0, 1};
// int a = add_and(Ns);
// Ns = {0, a};
// int b = add_or(Ns);
// Ns = {0, 1, b};
// int c = add_xor(Ns);
// add_not(c);
vector <int> r;
vector <int> a;
for (int i = 0; i < n; i++){
a.clear();
for (int j = 0; j < m; j++) a.push_back(cell(i, j, m));
int x = add_xor(a);
r.push_back(x);
/// cout << i << " " << x << " " << ac[x] << "\n";
}
a.clear();
for (auto &x : r){
a.push_back(x);
x = add_xor(a);
/// cout << x << " " << ac[x] << "\n";
}
vector <int> c;
for (int j = 0; j < m; j++){
a.clear();
for (int i = 0; i < n; i++) a.push_back(cell(i, j, m));
int x = add_xor(a);
c.push_back(x);
// cout << j << " " << x << " " << ac[x] << "\n";
}
a.clear();
for (auto &x : c){
a.push_back(x);
x = add_xor(a);
}
for (int i = 0; i < 10; i++){
loc[i] = add_or({c.back()});
}
for (auto x : r){
add(x);
}
for (auto x : c){
add(x);
}
int ansloc = add_not(c.back());
for (int i = 0; i < 10; i++){
if (k >> i & 1){
ansloc = add_and({ansloc, loc[i]});
} else {
loc[i] = add_not(loc[i]);
ansloc = add_and({ansloc, loc[i]});
}
}
}
// int main(){
// int h, w, k;
// cin >> h >> w >> k;
// pos = h * w;
// for (int i = 0; i < h * w; i++) cin >> ac[i];
// construct_network(h, w, k);
// cout << ac[pos - 1] << "\n";
// return 0;
// }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |