Submission

Status:
[PP][PP][PP-][P-S][PP-][P-SSS][PPPP-SS][PPP-][P-SS][PP-SS]

Score: 20

User: mister_o_hater_no1

Problemset: ช่องบนไม้

Language: cpp

Time: 0.033 second

Submitted On: 2025-04-19 12:43:28

#include <bits/stdc++.h>
using namespace std;

int main(){
	int n, w, l, k;cin>> n>>w >>l;
	vector<int> lh(w+ 5, 0);
	for(int i= 1; i< n; ++i){
		cin>>k;
		int h;
		for(int j= 1; j< k; ++j){
			cin>> h;
			for(int g= h- l; g<= h+ l; ++g){
				if(g> 0 && g<= w){
					++lh[g];
				}
			}
		}
	}
//	for(int c : lh){
//		cout<< c<< " ";
//	}
//	cout<< endl;
	for(int i= 1; i<= w; ++i){
		if(lh[i]== n){
			cout<< "1";
			return 0;
		}
	}
	cout<< "0";
		
	return 0;
}