QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#168757#5044. Happinessabsinthe#WA 485ms3612kbC++204.2kb2023-09-08 21:15:412023-09-08 21:15:42

Judging History

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

  • [2023-09-08 21:15:42]
  • 评测
  • 测评结果:WA
  • 用时:485ms
  • 内存:3612kb
  • [2023-09-08 21:15:41]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long

vector<string> split(string s, char delim) {
    vector<string> ret;
    string cur;
    for (auto i : s) {
        if (i == delim) {
            ret.push_back(cur);
            cur = "";
            continue;
        }
        cur += i;
    }
    ret.push_back(cur);
    return ret;
}

void test() {
    string inp;
    getline(cin, inp);
     int fs =-1;
    int lastSubmisson = -1;
    vector<int> firstSubmission(10, -1);

    int n = stoi(inp);
    vector<pair<pair<int, int>, vector<int>>> teams;
    vector<pair<int, int>> bob(10);
    for (int i = 0; i < n; i++) {
        vector<int> times;
        int penalty = 0;
        getline(cin, inp);
        vector<string> ret = split(inp, ',');
        assert(ret.size() == 10);
        int iter = 0;
        int cnt = 0;
        for (int i = 0; i < 10; i++) bob[i] = {-1, -1};
        for (auto pp : ret) {
            if (pp == "-"){
                continue;
            }
            cnt += 1;
            vector<string> ab = split(pp, ' ');
            assert(ab.size() == 2);
            int a = stoi(ab[0]);
            int b = stoi(ab[1]);
            times.emplace_back(a);
            if (i + 1 < n) if (firstSubmission[iter] == -1 || firstSubmission[iter] > a) {
                firstSubmission[iter] = a;
            }
            if (i + 1 < n) if(fs==-1||fs>a)fs=a;
            if (i +1 < n) lastSubmisson = max(lastSubmisson, a);
            bob[iter] = {a, b};
            penalty += a;
            penalty += b * 20;
            iter += 1;
        }
        sort(begin(times), end(times));
        reverse(begin(times), end(times));
        teams.push_back({{-cnt, penalty}, times});
    }
    teams.pop_back();
    sort(begin(teams), end(teams));
    vector<int> order(10);
    iota(begin(order), end(order), 0);
    int ans = 0;
    do {
        int cnt = 0;
        int curTime = 0;
        int penalty = 0;
        vector<int> times;
        int myFirst = -1;
        int myLast = -1;
        int happy   = 0;
        for (auto i : order) {
            if (bob[i].first == -1) continue;
            if (curTime + bob[i].first > 300) continue;
            cnt += 1;
            curTime += bob[i].first;
            penalty += curTime;
            penalty += bob[i].second * 20;
            times.emplace_back(curTime);
            myLast = curTime;
            if (firstSubmission[i] == -1 || curTime <= firstSubmission[i]) {
                happy += 800;
            }
            if (myFirst == -1){
                myFirst = curTime;
            }
        }
        if(myFirst!=-1)if (fs==-1||myFirst <= fs) {
            happy += 700;
        }
        sort(begin(times), end(times));
        reverse(begin(times), end(times));
        auto me = pair(pair(-cnt, penalty), times);
        auto it = lower_bound(begin(teams), end(teams), me) - begin(teams);
        it += 1;
        if (it <= n / 10) {
            happy += 1200;
        } else if (it <= 3 * n / 10) {
            happy += 800;
        } else if (it <= 6 * n / 10) {
            happy += 400;
        }
        if(myLast!=-1)if (myLast >= lastSubmisson) {
            happy += 500;
        }
        happy += 5000/it;
        ans = max(ans, happy);
    } while (next_permutation(begin(order), end(order)));
    cout << ans << '\n';
    // for (int i = 0; i < 10; i++) {
    //     cout << firstSubmission[i] << ' ';
    // }
    // cout << '\n';
    // for (auto x : teams) {
    //     cout << -x.first.first << ' ' << x.first.second << '\n';
    // }
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int T=1;

    // cin >> T;
    while (T--) {
        test();
    }
}
/*

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,-,120 8,241 3,94 1,-,28 7,109 8
280 6,246 5,58 9,-,-,-,-,-,-,-
38 10,-,227 10,187 9,182 1,-,203 9,254 7,-,-

*/

詳細信息

Test #1:

score: 100
Accepted
time: 268ms
memory: 3476kb

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:

1800

result:

ok 1 number(s): "1800"

Test #2:

score: 0
Accepted
time: 319ms
memory: 3576kb

input:

10
15 0,19 10,152 4,45 10,154 7,172 3,168 4,263 1,187 7,24 4
2 3,93 5,113 7,160 0,274 4,128 8,119 0,46 6,50 5,129 2
117 8,190 1,202 1,69 1,64 5,218 0,148 2,156 7,86 2,162 5
209 1,145 0,214 2,99 10,9 1,47 5,235 5,87 3,250 10,285 5
245 0,150 1,237 8,182 7,4 3,38 5,238 6,164 2,259 3,59 6
31 8,44 9,27 6...

output:

1300

result:

ok 1 number(s): "1300"

Test #3:

score: 0
Accepted
time: 103ms
memory: 3492kb

input:

300
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,...

output:

6200

result:

ok 1 number(s): "6200"

Test #4:

score: 0
Accepted
time: 79ms
memory: 3604kb

input:

300
164 7,180 10,59 4,162 10,16 3,140 1,204 10,73 9,289 5,14 8
97 3,18 1,153 4,160 6,166 10,25 8,300 9,183 8,98 10,195 10
195 5,247 10,116 1,129 7,79 5,238 7,198 3,192 2,282 7,117 2
125 1,269 10,188 9,72 8,65 5,249 5,46 1,192 3,77 0,241 3
18 1,147 0,12 6,34 9,120 3,282 4,44 1,206 2,50 10,125 10
174 ...

output:

16

result:

ok 1 number(s): "16"

Test #5:

score: 0
Accepted
time: 322ms
memory: 3456kb

input:

300
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,-,-
-,-,-,-,-,-,-,-,...

output:

9800

result:

ok 1 number(s): "9800"

Test #6:

score: 0
Accepted
time: 332ms
memory: 3468kb

input:

300
171 8,75 1,-,190 7,44 5,-,10 9,72 1,63 2,-
295 0,-,60 10,-,64 7,-,-,-,-,-
247 8,67 10,-,-,93 1,-,69 4,90 1,-,-
278 1,206 7,-,-,22 4,97 1,-,156 1,227 0,276 4
245 6,111 5,-,-,281 10,44 7,266 4,-,130 5,-
244 7,-,-,-,183 9,118 7,-,-,123 8,158 2
63 5,-,-,117 3,286 7,-,-,-,278 1,151 5
291 1,223 6,-,-,...

output:

20

result:

ok 1 number(s): "20"

Test #7:

score: 0
Accepted
time: 333ms
memory: 3612kb

input:

300
259 1,62 0,98 6,-,245 4,269 5,66 3,203 4,207 3,196 5
299 1,185 3,-,254 4,146 1,-,33 4,150 7,274 1,24 5
13 6,169 7,265 5,299 8,190 4,251 5,63 5,75 10,153 2,60 10
258 8,205 8,251 7,290 6,7 8,77 3,-,60 4,271 2,25 10
-,184 10,21 10,198 3,-,215 7,-,166 6,142 5,140 6
194 0,27 0,91 9,117 3,196 5,163 10...

output:

16

result:

ok 1 number(s): "16"

Test #8:

score: 0
Accepted
time: 285ms
memory: 3552kb

input:

300
139 2,-,-,68 5,290 9,146 8,128 10,192 6,67 6,-
-,-,291 4,50 1,286 2,260 9,222 0,120 8,186 8,-
95 9,46 10,91 4,53 7,135 7,197 9,240 2,111 1,-,-
118 1,-,-,295 7,56 7,139 4,-,-,102 10,260 2
277 4,39 4,256 2,56 5,106 6,11 0,-,116 2,39 2,238 0
246 1,117 9,267 10,-,-,285 0,222 5,283 3,275 9,-
-,97 10,...

output:

16

result:

ok 1 number(s): "16"

Test #9:

score: -100
Wrong Answer
time: 485ms
memory: 3608kb

input:

300
227 4,110 9,54 1,257 7,297 10,292 4,-,-,115 7,297 5
118 2,15 10,-,245 10,165 10,215 6,-,156 8,29 6,7 8
-,-,72 3,49 3,250 6,-,-,276 3,145 9,49 3
156 6,239 0,-,-,167 10,174 2,24 8,-,178 1,-
111 5,225 6,63 6,190 8,293 6,119 6,-,-,295 4,-
10 8,279 8,187 1,71 6,169 3,42 9,284 9,61 8,251 1,37 8
-,-,15...

output:

817

result:

wrong answer 1st numbers differ - expected: '17', found: '817'