QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#200720 | #5044. Happiness | xwb | WA | 132ms | 6976kb | C++17 | 4.4kb | 2023-10-04 19:00:09 | 2023-10-04 19:00:10 |
Judging History
answer
#include<bits/stdc++.h>
#define fer(i,a,b) for(int i = a ; i <= b ; i ++)
using namespace std;
const int N = 1e5 + 10 ;
int n ;
struct ai{
int s , cnt ;
vector<int> v ;
}q[N] ;
int f[N] , ff = 1e9 , fv = 0 ;
int a[N] ;
struct bi{
int f ;
int x , y ;
}t[15];
bool cmp(ai a, ai b)
{
if(a.cnt == b.cnt)
if(a.s==b.s){
return a.v<b.v;
}
else return a.s<b.s;
return a.cnt > b.cnt ;
}
void get()
{
string s ;
getline(cin , s) ;
int cc = 0 , ss = 0 , p = 1 ;
for(int j = 0 ; j < s.size() ; j ++)
{
if(s[j] == ',')
{
p ++ ;
}
else if(s[j] == '-')
{
t[p].f = 0 ;
}
else if(s[j] == ' ')
{
}
else
{
t[p].f = 1 ;
int z = 0 , k = j + 1 ;
while(k < s.size() && s[k] >= '0' && s[k] <= '9')
{
k ++ ;
}
fer(a , j , k - 1)
{
z = z * 10 + s[a] - '0' ;
}
if(k < s.size() && s[k] == ' ')
{
t[p].x = z ;
}
else
{
t[p].y = z ;
}
j = k - 1 ;
}
}
}
void solve()
{
cin >> n ;
fer(i,1,10) f[i] = 1e9 ;
string s ;
getline(cin , s) ;
fer(i,1,n-1)
{
getline(cin , s) ;
int cc = 0 , ss = 0 , p = 1 ;
for(int j = 0 ; j < s.size() ; j ++)
{
if(s[j] == ',')
{
p ++ ;
}
else if(s[j] == '-')
{
}
else if(s[j] == ' ')
{
}
else
{
int z = 0 , k = j + 1 ;
while(k < s.size() && s[k] >= '0' && s[k] <= '9')
{
k ++ ;
}
fer(a , j , k - 1)
{
z = z * 10 + s[a] - '0' ;
}
if(k < s.size() && s[k] == ' ')
{
cc ++ , ss += z ;
q[i].v.push_back(z);
f[p] = min(f[p] , z) ;
ff = min(ff , z) ;
fv = max(fv , z) ;
}
else
{
ss += z * 20 ;
}
j = k - 1 ;
}
}
sort(q[i].v.begin(),q[i].v.end(),[&](int _,int __){
return _>__;
});
q[i].s = ss , q[i].cnt = cc ;
}
sort(q + 1 , q + 1 + n - 1 , cmp) ;
for(int i=1;i<n;i++){
cout<<q[i].cnt<<" "<<q[i].s<<endl;
for(auto j:q[i].v)cout<<j<<" ";
cout<<endl;
}
fer(i,1,10) a[i] = i ;
get() ;
int happy=0;
do
{
vector<int>v;
int fa=0,guoti=0,time=0;
int th=0;
bool ok=0,okk=0;
fer(i,1,10)
{
bi j = t[a[i]] ;
if(j.f){
time+=j.x;
if(time>300)
{
time -= j.x ;
break ;
}
v.push_back(time);
if(time<=ff)ok=1;
if(time >= fv) okk = 1 ;
if(time<=f[a[i]])th+=800;
guoti++;
fa+=j.y*20;
fa+=time;
}
}
sort(v.begin(),v.end(),[&](int _,int __){
return _>__;
});
if(ok)th+=700;
int l = 1 , r = n ;
while(l < r)
{
int mid = l +r >> 1 ;
if( guoti > q[mid].cnt || (guoti == q[mid].cnt
&& fa < q[mid].s ) || ( guoti == q[mid].cnt && fa == q[mid].s && v <= q[mid].v )
) r = mid ;
else l = mid+1 ;
}
th+=5000/r;
if(r<=n/10){
th+=1200;
}
else if(r<=n/10*3){
th+=800;
}
else if(r<=n/10*6){
th+=400;
}
if(okk==1)th+=500;
happy=max(happy,th);
} while (next_permutation(a + 1 , a + 1 + 10));
cout<<happy<<'\n';
}
signed main() {
ios::sync_with_stdio(0), cin.tie(0);
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 132ms
memory: 6976kb
input:
10 233 1,-,-,7 7,257 4,173 5,117 1,-,-,85 3 -,231 0,167 0,257 7,-,-,122 4,283 0,215 4,- 41 1,-,290 8,-,-,-,-,246 7,120 3,184 9 142 8,243 7,69 0,-,41 9,-,279 1,264 4,-,74 9 53 8,-,187 9,60 1,48 8,99 10,-,-,55 7,259 5 250 0,-,-,-,166 0,16 3,-,82 4,73 0,184 3 -,-,-,-,105 3,-,-,-,152 4,- -,84 5,98 8,-,1...
output:
7 1574 241 120 109 98 94 84 28 7 1721 259 187 99 60 55 53 48 7 1872 279 264 243 142 74 69 41 6 971 250 184 166 82 73 16 6 1292 257 233 173 117 85 7 6 1575 283 257 231 215 167 122 5 1441 290 246 184 120 41 3 984 280 246 58 2 397 152 105 1800
result:
wrong answer 1st numbers differ - expected: '1800', found: '7'