Submission

Status:
[PP][PP][PPP][PPP][PPP][PPPPP][PPPPPPP][PPPP][PPPP][PPPPP]

Score: 100

User: hmmm

Problemset: ช่องบนไม้

Language: cpp

Time: 0.010 second

Submitted On: 2025-04-18 15:32:36

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
bool a[10][N];

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
  int n,m,l;
  cin >> n>> m >> l;
  for(int i=1;i<=n;i++){
    int x;
    cin >> x;
    for(int j=1;j<=x;j++){
      int t;
      cin >> t;
      for(int k=max(1,t-l);k<=min(t+l,m);k++){
        a[i][k]=true;
      }
    }
  }
  for(int i=1;i<=m;i++){
    bool chk=true;
    for(int j=1;j<=n;j++){
      if(a[j][i]==false){
        chk=false;
        break;
      }
    }
    if(chk){
      cout << "1";
      return 0;
    }
  }
  cout << "0";
}