# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
723443 | anton | Measures (CEOI22_measures) | C++17 | 1553 ms | 10628 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
mt19937 rng(42);
#define int long long
int score(multiset<int>& s, int d){
vector<int> v;
for(auto e: s){
v.push_back(e);
}
int score = 0;
for(int i = 0; i<v.size(); i++){
for(int j = i+1; j<v.size(); j++){
score = max(score, (j-i)*d - (v[j]-v[i]));
}
}
return score;
}
int my_score(multiset<int>& s, int d){
int delta = 0;
int score = 0;
int rank = 0;
for(auto e: s){
if(delta + rank*d < e){
delta = e -rank*d;
}
//cout<<"delta "<<delta<<endl;
score = max(score, rank*d + delta - e);
rank++;
}
return score;
}
void test(){
multiset<int> s;
int d= rng();
for(int i = 0; i<100; i++){
s.insert(rng()%1000 + 1000LL*1000LL*1000LL*1000LL*1000LL);
}
int s1 = my_score(s, d);
int s2 = score(s, d);
if(s1!=s2){
cout<<"example: "<<d<<endl;
/*for(auto e: s){
cout<<e<<endl;
}
cout<<s1<<" "<<s2<<endl;*/
}
}
signed main(){
/*srand(time(NULL));
for(int i = 0; i<100*1000; i++){
test();
}*/
int n, m, d;
cin>>n>>m>>d;
multiset<int> s;
int a;
for(int i = 0; i<n; i++){
cin>>a;
s.insert(a);
}
int b;
for(int i = 0; i<m; i++){
cin>>b;
s.insert(b);
int s1 = my_score(s, d);
cout<<s1/2;
if(s1%2==1){
cout<<".5";
}
if(i<m-1){
cout<<" ";
}
}
cout<<endl;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |