https://i2.wp.com/eblogarithm.com/wp-content/uploads/2017/07/Codeforces-Round-412-rated-Div-2-base-on-VK-Cup-2017-Round-3-problem-D-Dynamic-Problem-Scoring-Solution-In-CC.png?fit=640%2C360

Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3), problem: (D) Dynamic Problem Scoring Solution In C/C++

#include<bits/stdc++.h>
using namespace std;
int a[150][150];
int cnt[10];
int n;
int getsc(int id, bool f, int s) {
if(a[f][id]==-1) return 0;
int sum;
if(a[0][id] == -1 || a[1][id] == -1 || a[0][id]<a[1][id]) sum = cnt[id];
else sum = cnt[id]+s;
int sc = 500;
for(int i = 2; i <= 32; i*=2) {
if(sum*i > n+s)
break;
else sc += 500;
}
return sc*(250.0 – a[f][id])/250.0;
}
int main() {
cin >> n;
for(int i = 0; i < n; ++i)
for(int j = 0; j < 5; ++j) {
cin >> a[i][j];
if(a[i][j]!= -1)
cnt[j]++;
}
for(int i = 0; i < 50000; ++i) {
int a1=0, a2=0;
for(int j = 0; j < 5; ++j)
a1 += getsc(j, 0, i);
for(int j = 0; j < 5; ++j)
a2 += getsc(j, 1, i);
if(a1 > a2) {
cout << i << endl;
return 0;
}
}
cout << “-1” <<endl;
return 0;
}

(Visited 15 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: