QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#268244#5140. Frozen ScoreboardcatgokWA 0ms3536kbC++144.4kb2023-11-28 14:15:482023-11-28 14:15:49

Judging History

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

  • [2023-11-28 14:15:49]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3536kb
  • [2023-11-28 14:15:48]
  • 提交

answer

// 2023-11-28 12:34:27
#include <bits/stdc++.h>

#define x first
#define y second
#define ll long long
#define int long long
#define PII pair<int,int>
using namespace std;

const int N = 2e6 + 9, INF = 1e18;
int m;
struct problem {
    string status;
    int submit_cnt{}, submit_time{};
    int try_cnt{};
    int success_time{};

};

void solve() {
    int final_pass_cnt, final_time;
    vector<problem> p(m);
    cin >> final_pass_cnt >> final_time;

    for (int i = 0; i < m; i++) {
        cin >> p[i].status;
//        cout << p[i].status << " " << i << "\n";
        if (p[i].status == ".") continue;
        else if (p[i].status == "-") cin >> p[i].submit_cnt;
        else if (p[i].status == "?") cin >> p[i].try_cnt >> p[i].submit_cnt;
        else if (p[i].status == "+") {
            scanf("%lld/%lld", &p[i].submit_cnt, &p[i].submit_time);
            p[i].success_time = p[i].submit_time;
        }
    };

//    for (int i = 0; i < m; i++) cout << p[i].status << "\n";
//    cout << "\n";
//    return;

    for (int all_st = 0; all_st < (1 << m); all_st++) {
        int ok = 1;
        int time_l = 0, time_r = 0, pass_cnt = 0;
        for (int j = 0; j < m; j++) {
            if (((all_st >> j) & 1) == 1) { // pass
                if (p[j].status == "." || p[j].status == "-") ok = 0;
                else if (p[j].status == "+") {
                    pass_cnt++;
                    int tmp = (p[j].submit_cnt - 1) * 20 + p[j].submit_time;
                    time_l += tmp;
                    time_r += tmp;
                } else if (p[j].status == "?") {
                    pass_cnt++;
                    int tmpl = 240 + (p[j].submit_cnt - p[j].try_cnt) * 20;
                    int tmpr = 299 + (p[j].submit_cnt - 1) * 20;
                    time_l += tmpl;
                    time_r += tmpr;
                }
            } else {
                if (p[j].status == "+") ok = 0;
            }
        }

//        if (all_st == 2839) {
//            cout << "(((((((((\n";
//            cout << ok;
//        }
        if (ok) {
            if (final_pass_cnt == pass_cnt && time_l <= final_time && final_time <= time_r) {
                cout << "Yes\n";
                int calc_time = final_time - time_l;
//                cout << time_l << " " << time_r << "\n";
                for (int j = 0; j < m; j++) {
                    if (((all_st >> j) & 1) == 1) { // pass
                        if (p[j].status == "+") {
                            int tmp = (p[j].submit_cnt - 1) * 20 + p[j].submit_time;
                            cout << "+ " << p[j].submit_cnt << "/" << p[j].submit_time << "\n";
                        } else if (p[j].status == "?") {
                            int tmpl = 240 + (p[j].submit_cnt - p[j].try_cnt) * 20;
                            int tmpr = 299 + (p[j].submit_cnt - 1) * 20;
                            int det = tmpr - tmpl;
                            if (calc_time >= det) {
                                cout << "+ " << p[j].submit_cnt << "/" << 299 << "\n";
                                calc_time -= det;
                            } else {
                                if (calc_time <= 39) {
                                    cout << "+ " << p[j].submit_cnt - p[j].try_cnt + 1 << "/" << 240 + calc_time
                                         << "\n";
                                    calc_time = 0;
                                } else {
                                    int r = calc_time % 20;
                                    int k = (calc_time - 40) / 20;
                                    cout << "+ " << p[j].submit_cnt + k + 1 << "/" << 280 + r << "\n";
                                    calc_time = 0;
                                }
                            }
                        }
                    } else {
                        if (p[j].status == ".") cout << ".\n";
                        else if (p[j].status == "-") cout << "- " << p[j].submit_cnt << "\n";
                        else if (p[j].status == "?") cout << "- " << p[j].submit_cnt << "\n";
                    }
                }
                return;
            }
        }
    }

    cout << "No\n";

}

signed main() {
    freopen("z_in.txt", "r", stdin);
//    ios::sync_with_stdio(false);
    int T = 1;
    cin >> T >> m;
//    scanf("%lld%lld", &T, &m);
    while (T--) solve();
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3536kb

input:

1 13
7 951
+ 1/6
? 3 4
+ 4/183
- 2
+ 3/217
.
.
.
+ 2/29
+ 1/91
.
+ 1/22
.

output:

No

result:

wrong answer ans finds the answer, but out doesn't (test case 1)