Submission

Status:

[PPPPPPPPPPPPPPPPPPPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: FakeAnutin

Problemset: วันว่างๆ

Language: cpp

Time: 0.025 second

Submitted On: 2026-11-23 18:34:17

#include <bits/stdc++.h>
using namespace std;
int arr[1005];
int main(){
	int st=99999;
	int mx=0;
	int n; cin>>n;
	for(int i=1;i<=n;i++){
		int k; cin>>k;
		for(int i=1;i<=k;i++){
			int s; int e;
			cin>>s>>e;
			st = min(st,s);
			mx = max(mx,e);
			for(int j=s;j<e;j++){
				arr[j] = 1;
			}
		}
	}
	int t=0;
	for(int j=st;j<mx;j++){
		if(arr[j] == 0 && arr[j-1] == 1){
			cout<<j<<" ";
			t=1;
		}
		if(arr[j] == 0 && arr[j+1] == 1){
			cout<<j+1<<" ";
			t=1;
		}
	}
	if(t == 0){
		cout<<"-1";
	}
	
}