This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "nonogram.h"
using namespace std;
#define Fi first
#define Se second
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<(n);i++)
typedef tuple<int, int, int> t3;
typedef tuple<int, int, int, int> t4;
std::vector<std::vector<int>> SolveNonogram(int N, int M, std::vector<std::vector<int>> Rclue, std::vector<std::vector<int>> Cclue) {
vector <vector <int> > ans;
ans.resize(N); rep(i, N) ans[i].resize(M);
rep(i, N) rep(j, M) if((i+j)%2 == 0) ans[i][j] = 1;
for(int i=0;i<N;i++) if(i % 2 == 0) {
for(int j=0, k=0;j<M;j++) {
if(k == szz(Rclue[i])) continue;
if((i+j) % 2 == 0) Rclue[i][k]--;
else {
if(Rclue[i][k] == 0) ++k;
else Rclue[i][k]--, ans[i][j] = 1;
}
}
}
for(int i=0;i<M;i++) if(i % 2 == 0) {
for(int j=0, k=0;j<N;j++) {
if(k == szz(Cclue[i])) continue;
if((i+j) % 2 == 0) Cclue[i][k]--;
else {
if(Cclue[i][k] == 0) ++k;
else Cclue[i][k]--, ans[j][i] = 1;
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |