QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#758223 | #5417. Chat Program | Mitsubachi | WA | 32ms | 5452kb | C++14 | 2.1kb | 2024-11-17 16:51:50 | 2024-11-17 16:51:55 |
Judging History
answer
// g++-13 1.cpp -std=c++17 -O2 -I .
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds;
// #include <atcoder/segtree>
// using namespace atcoder;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vst = vector<string>;
using vvst = vector<vst>;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define pq_big(T) priority_queue<T,vector<T>,less<T>>
#define pq_small(T) priority_queue<T,vector<T>,greater<T>>
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)
#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())
random_device seed;
mt19937_64 randint(seed());
ll grr(ll mi, ll ma) { // [mi, ma)
return mi + randint() % (ma - mi);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,m,k;
ll c,d;
cin>>n>>k>>m>>c>>d;
vll a(n);
rep(i,0,n)cin>>a[i];
ll ok=0,ng=2e9;
while(ng-ok>1){
ll check=(ok+ng)/2;
int init=0;
vi im(n+1,0);
rep(i,0,n){
if(a[i]>=check){
init++;
continue;
}
if(a[i]+c+d*(m-1)<check){
continue;
}
ll id=0;
if(d>0){
id=(check-a[i]-c+d-1)/d;
if(id>=m)continue;
if(id<0)id=0;
}
int s_left=i-m+1,s_right=i-id;
s_left=max(s_left,0);
s_right=min(s_right,n-1);
if(s_left>s_right)continue;
im[s_left]++;
im[s_right+1]--;
}
rep(i,0,n){
im[i+1]+=im[i];
}
int mx=init;
rep(i,0,n+1){
mx=max(mx,init+im[i]);
}
if(mx>=k){
ok=check;
}
else{
ng=check;
}
}
cout<<ok<<endl;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3752kb
input:
6 4 3 1 2 1 1 4 5 1 4
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
7 3 2 4 0 1 9 1 9 8 1 0
output:
9
result:
ok 1 number(s): "9"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
8 3 5 0 0 2 0 2 2 1 2 1 8
output:
2
result:
ok 1 number(s): "2"
Test #4:
score: 0
Accepted
time: 25ms
memory: 5452kb
input:
200000 200000 100000 0 1000000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: -100
Wrong Answer
time: 32ms
memory: 5396kb
input:
200000 1 100000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000...
output:
1999999999
result:
wrong answer 1st numbers differ - expected: '100001000000000', found: '1999999999'