dinhquang070811

dinhquang070811

@dinhquang070811
Hiệu năng
58,66 #40
Đã giải
25
Các kỳ thi đang tham gia
0/ 4
Đóng góp
0
🌹
Rose
54#1089
🌻
Sunflower
68#33
§ giới thiệu

Thông tin

#include<bits/stdc++.h>\ using namespace std;\ const int nmax=1e5+5;\ int c[nmax],t[nmax],n,Tmin;\ typedef pair<int,int> II;\ II A[nmax];\ priority_queue<int,vector<int>,greater<int> >q;\ int kiemtra(int x)\ {\ while(!q.empty()) q.pop();\ for(int i=1;i<=n;i++)\ {\ A[i].first=max(1,c[i]-x/t[i]);\ A[i].second=min(n,c[i]+x/t[i]);\ }\ sort(A+1,A+n+1);\ int j=1;\ for(int i=1;i<=n;i++)\ {\ while(j<=n&&amp;A[j].first<=i) q.push(A[j++].second);\ if(q.empty()||q.top()<i) return 0;\ q.pop();\ }\ return 1;\ }\ int main()\ {\ freopen("DIEUDONG.INP","r",stdin);\ freopen("DIEUDONG.OUT","w",stdout);\ cin>>n;\ for(int i=1;i<=n;i++) {cin>>c[i]>>t[i];}\ int l=0,r=10e8,m;\ while(l<=r)\ {\ m=(l+r)/2;\ if(kiemtra(m)){Tmin=m;r=m-1;}\ else l=m+1;\ }\ cout<<Tmin;\ return 0;\ }

§ gần đây

Hoạt động gần đây

Hoạt động

gnatmake 12.2.0 a68g 3.1.2 nasm 2.16.1 as_x64 2.47 awk 1.3.4 gcc 16.2.0 dotnet 10.0.402 g++ 16.2.0 g++-themis 16.2.0 g++17 16.2.0 g++20 16.2.0 g++23 16.2.0 clang++ 22.1.8 dmd 2.113.0 dart 3.13.6 gforth 0.7.3 gfortran 15.3.0 go 1.27.3 groovyc 5.1.3 javac 26.0.2.1 node 26.12.1 julia 1.13.2 kotlinc 2.4.21 lean 4.35.0 sbcl 2.2.9 lua 5.5.1 nim 2.2.12 fpc 3.2.2 fpc-themis 3.2.2 perl 5.42.3 php 8.5.12 pike 8.0 swipl 9.0.4 pypy3 7.3.23 python3 3.15.1 racket 8.7 ruby 4.0.8 rustc 1.99.1 csc 5.3.0 ctoj-scratch 0.0.1 sed 4.9 swiftc 6.4.1 tclsh 8.6 bun 1.4.4 deno 2.9.8 v 0.5.2 zig 0.17.0