模拟: { Author:wzx961008 Problem:UVa 11926-Multitasking Verdict:Accepted Language:PASCAL Run Time:0.084s Submission Date:2011-03-23 16:32:05 } const maxnum=1000000; var ok1,ok2:array[0..1000000]of boolean; n,m,T,i,l,r,tasknum:longint; tt,ttt:boolean; begin while true do begin readln(n,m); if (n=0)and(m=0) then break; fillchar(ok1,sizeof(ok1),false); fillchar(ok2,sizeof(ok2),false); ttt:=false; for i:=1 to n do begin readln(l,r); if not ok1[l] then ok1[l]:=true else begin ttt:=true; break end; if not ok2[r] then ok2[r]:=true else begin ttt:=true; break end; end; if ttt then begin writeln('CONFLICT'); continue end; for i:=1 to m do begin readln(l,r,T); repeat if not ok1[l] then ok1[l]:=true else begin ttt:=true; break end; if not ok2[r] then ok2[r]:=true else begin ttt:=true; break end; inc(l,T); inc(r,T); until r>maxnum; if ttt then break; end; if ttt then begin writeln('CONFLICT'); continue end; i:=0; tt:=false; tasknum:=0; while i<maxnum do begin inc(i); if ok1[i] then inc(tasknum); if ok2[i] then dec(tasknum); if tasknum>1 then begin writeln('CONFLICT'); tt:=true; break end; end; if not tt then writeln('NO CONFLICT'); end; end.