QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#200697#5044. HappinessxwbWA 237ms3592kbC++203.5kb2023-10-04 18:32:302023-10-04 18:32:30

Judging History

你现在查看的是最新测评结果

  • [2023-10-04 18:32:30]
  • 评测
  • 测评结果:WA
  • 用时:237ms
  • 内存:3592kb
  • [2023-10-04 18:32:30]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int N=305;
struct ai{
    int pine,cnt ;
    vector<int> v ;
}q[N];
struct bi{
    int f ;
    int x , y ;
}t[11];
int last=-1,first=301;
int f[11]={301};
int a[15];
bool cmp(ai a,ai b)
{
    if(a.cnt == b.cnt)
        if(a.pine==b.pine){
            return a.v<b.v;
        }
        else return a.pine<b.pine;
    else return a.cnt > b.cnt ;
}
void solve(){
	int n;
	cin>>n;
    string s;
    getline(cin,s) ;
    for(int i=1;i<=n;i++)
    {
        getline(cin , s) ;
        int cnt=0,pine=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++;
                for(int kk=j;kk<k;kk++)z=z*10+s[kk]-'0';
                if(k < s.size() && s[k] == ' ')
                {
                    cnt++,pine +=z;
                    q[i].v.push_back(z);
                    f[p]=min(f[p],z) ;
                    first=min(first,z) ;
                    last=max(last,z) ; 
                }
                else
                {
                    pine+=z*20 ;
                }

                j = k - 1 ;
            }
        }
        q[i].cnt=cnt,q[i].cnt=cnt;
        sort(q[i].v.begin(),q[i].v.end());
    }
    getline(cin , s) ;
    int 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 ++ ;
            for(int kk=j;kk<k;kk++)z=z*10+s[kk]-'0';
            if(k < s.size() && s[k] == ' ')
            {
                t[p].x=z;
            }
            else
            {
                t[p].y=z ;
            }
            j = k - 1 ;
        }
    }
    sort(q + 1 , q + 1 + n - 1 , cmp) ;
    for(int i=1;i<=10;i++) a[i] = i ;
    int happy=0;
    do
    {
        vector<int>v;
        int fa=0,guoti=0,time=0;
        int th=0;
        bool ok=0,okk=0;
        for(int i=1;i<=10;i++)
        {
            bi j = t[a[i]] ;
            if(j.f){
                if(time+j.x>300)
                {
                    break ;
                }
                time+=j.x;
                v.push_back(time);
                if(time<=first)ok=1;
                if(time >= last) okk = 1 ;
                if(time<=f[a[i]])th+=800;
                guoti++;
                fa+=j.y*20;
                fa+=time;
            }
        }
        sort(v.begin(),v.end());
        if(ok)th+=700;
        int l = 1 , r = n ;
        ai t={fa,guoti,v};
        while(l < r)
        {
            int mid = l +r >> 1 ;
            if(cmp(q[mid],t))l=mid+1; 
            else r = mid  ;
        }
        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';
	return;
}
int main(){
	ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
	int t=1;
	while(t--){
		solve();
	}
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 237ms
memory: 3592kb

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:

500

result:

wrong answer 1st numbers differ - expected: '1800', found: '500'