Submission
Status:
[PP][PP][PPP][PPP][PPP][PPPPP][PPPPPPP][PPPP][PPPP][PPPPP]
Subtask/Task Score:
{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}
Score: 100
User: sulinx
Problemset: ช่องบนไม้
Language: cpp
Time: 0.014 second
Submitted On: 2025-09-25 17:22:44
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int N, W, L, tmpn, tmp;
cin >> N >> W >> L;
vector<int> hole(W + 1, 0);
for (int i = 0; i < N; i++) {
cin >> tmpn;
vector<int> mark(W + 1, 0);
for (int j = 0; j < tmpn; j++) {
cin >> tmp;
// consider shifts from -L to L
for (int k = -L; k <= L; k++) {
int pos = tmp + k;
if (pos >= 1 && pos <= W) {
mark[pos] = 1;
}
}
}
for (int x = 1; x <= W; x++) {
if (mark[x]) hole[x]++;
}
}
for (int i = 1; i <= W; i++) {
if (hole[i] == N) {
cout << 1;
return 0;
}
}
cout << 0;
}