Submission #37755

#TimeUsernameProblemLanguageResultExecution timeMemory
37755MatheusLealV구경하기 (JOI13_watching)C++14
0 / 100
0 ms2196 KiB
#include <bits/stdc++.h> #define N 2050 #define f first #define s second using namespace std; typedef pair<int, int> pii; int n, p, q, v[N], barrier[N], ans; vector<pii> lista; vector<int> piores; int32_t main() { ios::sync_with_stdio(false); cin.tie(0); cin>>n>>p>>q; for(int i = 1; i <= n; i++) cin>>v[i]; if(p + q >= n) { cout<<"1\n"; return 0; } sort(v + 1, v + n + 1); for(int i = 1; i < n; i++) lista.push_back(pii(v[i + 1] - v[i], i)); sort(lista.rbegin(), lista.rend()); cout<<"\n"; for(int i = 1; i <= n; i++) cout<<v[i]<<"\n"; for(int i = 0; i < p + q - 1; i++) { int idx = lista[i].s; barrier[idx] = 1; cout<<"BARREIRA "<<idx<<"\n"; } for(int i = 1; i <= n; i ++) { int fim = v[i], ini = v[i]; while(true) { fim = v[i]; i++; if(i > n || barrier[i - 1] ) break; } piores.push_back(fim - ini + 1); i--; } sort(piores.rbegin(), piores.rend()); int dois_w = (piores[0] + 1)/2, w = piores[q]; cout<<max(dois_w, w)<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...