QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#913255#3776. 超大型 LED 显示屏Horcruxs#AC ✓1ms3712kbC++141.7kb2025-02-24 13:19:552025-02-24 13:20:14

Judging History

This is the latest submission verdict.

  • [2025-02-24 13:20:14]
  • Judged
  • Verdict: AC
  • Time: 1ms
  • Memory: 3712kb
  • [2025-02-24 13:19:55]
  • Submitted

answer

#include <bits/stdc++.h>
#define int long long

using namespace std;

int cnt, hs, he;
std::string s, st, et;

constexpr int a[] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};

int get_hash(std::string s) {
    int num1 = (s[0] - '0') * 10 + (s[1] - '0');
    int num2 = (s[3] - '0') * 10 + (s[4] - '0');
    int num3 = (s[6] - '0') * 10 + (s[7] - '0');

    return num1 * 60 * 60 + num2 * 60 + num3;
}

int turn(int ns) {
    return a[ns / 100] * (ns >= 100) + a[ns / 10 % 10] * (ns >= 10) + a[ns % 10];
}

void solve() {
    std::cin >> st;
    hs = get_hash(st);

    int ans = 0, s1 = 0, s2 = 0;
    int lst1 = hs, lst2 = hs;

    std::vector < std::pair <int, int> > vec;
    while(std::cin >> s) {
        if(s == "END") {
            break ;
        }

        std::string t;
        std::cin >> t;

        int num = get_hash(t);

        std::string team;
        std::cin >> team;

        int x;
        std::cin >> x;

        if(team == "home") {
            vec.push_back(std::make_pair(num - lst1, s1));
            lst1 = num;
            s1 += x;
        } else {
            vec.push_back(std::make_pair(num - lst2, s2));
            lst2 = num;
            s2 += x;
        }
    }

    cin >> et;
    he = get_hash(et);

    vec.push_back(std::make_pair(he - lst1, s1));
    vec.push_back(std::make_pair(he - lst2, s2));

    for(auto p : vec) {
        int tt = p.first;
        int ns = p.second;

        ans += tt * turn(ns);
    }

    std::cout << "Case " << cnt << ": " << ans << '\n';
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    while(std::cin >> s) {
        cnt++;
        solve();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3712kb

input:

START 11:25:08
SCORE 11:27:55 home 2
SCORE 11:28:52 home 3
SCORE 11:31:11 guest 1
SCORE 11:31:42 home 2
SCORE 11:32:07 home 1
SCORE 11:32:14 guest 2
SCORE 11:33:04 home 3
SCORE 11:38:44 home 2
SCORE 11:39:58 home 1
SCORE 11:40:09 home 2
SCORE 11:40:38 home 2
SCORE 11:41:09 home 1
SCORE 11:41:18 gues...

output:

Case 1: 17293
Case 2: 295525
Case 3: 12777
Case 4: 95351
Case 5: 212123
Case 6: 25848
Case 7: 367109
Case 8: 8397
Case 9: 16939
Case 10: 49113
Case 11: 105472
Case 12: 450754
Case 13: 603297
Case 14: 48558
Case 15: 122569
Case 16: 37630
Case 17: 287970
Case 18: 150375
Case 19: 34195
Case 20: 17087
C...

result:

ok 100 lines