QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#718751#3567. Digital ClockOdyssey0 39ms3652kbC++172.5kb2024-11-06 21:21:222024-11-06 21:21:23

Judging History

This is the latest submission verdict.

  • [2024-11-06 21:21:23]
  • Judged
  • Verdict: 0
  • Time: 39ms
  • Memory: 3652kb
  • [2024-11-06 21:21:22]
  • Submitted

answer


#define _CRT_SECURE_NO_WARNINGS 
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N = 1e6 + 9;
int n;
int digit[] = {
    0b1111110, // 0
    0b0110000, // 1
    0b1101101, // 2
    0b1111001, // 3
    0b0110011, // 4
    0b1011011, // 5
    0b1011111, // 6
    0b1110000, // 7
    0b1111111, // 8
    0b1111011  // 9
};

bool isson(const string& look, const string& real) {
    for (int k = 0; k <= 4; k++) {
        if (k == 2) continue;
        int x = look[k] - '0', y = real[k] - '0';
        if ((digit[x] & digit[y]) != digit[x]) {
            return false;
        }
    }
    return true;
}

vector<string> all(int n, const vector<string>& ob) {
    vector<string> res;
    for (int i = 0; i < 24; i++) {
        for (int j = 0; j < 60; j++) {
            int h = i, m = j;
            bool flag = true;
            string now, start, tmp;
            for (int cnt = 0; cnt < n; cnt++) {
                /*ostringstream oss;
                oss << setfill('0') << setw(2) << h << ':' << setfill('0') << setw(2) << m;
                now = oss.str();*/


                string t1, t2;
                if (h < 10)t1 = '0';
                t1+=to_string(h);
                if(m<10)t2 = '0';
                 t2+= to_string(m);
                now = t1 + ':' + t2;
               /* cout << now << endl;
                cout << tmp << endl;
                if (now != tmp)cout << "sssssssssssssssssss" << endl;*/

                if (cnt == 0) start = now;
                if (!isson(ob[cnt], now)) {
                    flag = false;
                    break;
                }
                m++;
                if (m == 60) {
                    m = 0;
                    h = (h + 1) % 24;
                }
            }
            if (flag) {
                res.push_back(start);
            }
        }
    }
    return res;
}

void solve() {
    while (cin >> n) {
        vector<string> ob(n);
        for (int i = 0; i < n; i++) {
            cin >> ob[i];
        }
        vector<string> ans = all(n, ob);
        if (ans.empty()) {
            cout << "none\n";
        }
        else {
            for (size_t i = 0; i < ans.size(); i++) {
                if (i > 0) cout << " ";
                cout << ans[i];
            }
            cout << "\n";
        }
    }
}

int main() {
    IOS;
    solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests


Final Tests

Test #1:

score: 0
Wrong Answer
time: 39ms
memory: 3652kb

input:

1 88:88
2 23:25 23:26
3 71:57 71:57 71:07
1 00:00
1 11:11
1 22:22
1 33:33
1 44:44
1 55:55
1 66:66
1 77:77
1 88:88
1 99:99
1 08:28
1 78:48
1 24:11
1 31:11
1 11:60
5 23:11 23:11 23:11 23:11 23:11
6 23:11 23:11 23:11 23:11 23:11 23:11
6 23:11 23:11 23:11 23:11 23:11 23:12
2 08:19 08:20
2 27:77 27:17
2 ...

output:

none
23:25
00:58 03:58 07:58 08:58
00:00 00:08 08:00 08:08
00:00 00:01 00:03 00:04 00:07 00:08 00:09 00:10 00:11 00:13 00:14 00:17 00:18 00:19 00:30 00:31 00:33 00:34 00:37 00:38 00:39 00:40 00:41 00:43 00:44 00:47 00:48 00:49 01:00 01:01 01:03 01:04 01:07 01:08 01:09 01:10 01:11 01:13 01:14 01:17 0...

result:

wrong answer 21st lines differ - expected: 'none', found: '23:07 23:37'