# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
729491 | 2023-04-24T08:12:52 Z | Baytoro | Measures (CEOI22_measures) | C++17 | 1500 ms | 5348 KB |
#include <bits/stdc++.h> using namespace std; #define ios ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); #define pb push_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fr first #define sc second #define endl '\n' #define ll long long #define int long long void fopn(string name){ freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } const ll INF=1e18,mod=1e9+9,N=2e5+5; int d; int calc(vector<int> vec){ sort(all(vec)); int n=vec.size(); int l=-1,r=2e9; while(r-l>1){ int md=(l+r)/2; vector<int> a=vec; for(int i=0;i<n;i++){ if(!i){ a[i]-=md; continue; } int x=abs((a[i-1]+d)-a[i]); //cout<<x<<endl; if(x>md){ if(a[i]-md<a[i-1]+d) a[i]+=md; else a[i]-=md; } else{ if(a[i]-x<a[i-1]+d) a[i]+=x; else a[i]-=x; } /*cout<<md<<endl; for(auto it: a) cout<<it<<' '; cout<<endl;*/ } bool check=1; for(int i=1;i<n && check;i++) check&=(a[i]-a[i-1]>=d); if(check) r=md; else l=md; } return r; } vector<int> vec; void solve(){ int n,m;cin>>n>>m>>d; vec.resize(n); for(int i=0;i<n;i++){ cin>>vec[i]; } sort(all(vec)); int ans=0; for(int i=0;i<m;i++){ int x;cin>>x; auto it=lower_bound(all(vec),x); vec.insert(it,x); int cur=0; for(int i=(int)vec.size()-2;i>=0;i--){ int D=d-(vec[i+1]-vec[i]); cur=max(cur+D,0ll); ans=max(ans,cur); } cout<<ans/2; if(ans%2) cout<<".5"; cout<<' '; } } main(){ //fopn("friendcross"); ios; int T=1; //cin>>T; for(int i=1;i<=T;i++){ //cout<<"Case #"<<i<<": "; solve(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 328 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 328 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 328 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 40 ms | 5320 KB | Output is correct |
10 | Correct | 34 ms | 5324 KB | Output is correct |
11 | Correct | 26 ms | 5316 KB | Output is correct |
12 | Correct | 45 ms | 5348 KB | Output is correct |
13 | Correct | 25 ms | 4824 KB | Output is correct |
14 | Correct | 33 ms | 5324 KB | Output is correct |
15 | Correct | 34 ms | 4672 KB | Output is correct |
16 | Correct | 26 ms | 5336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1561 ms | 2064 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1561 ms | 2064 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |