QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#791150#4251. Gameisirazeev0 1ms3956kbC++231.3kb2024-11-28 17:09:132024-11-28 17:09:13

Judging History

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

  • [2024-11-28 17:09:13]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3956kb
  • [2024-11-28 17:09:13]
  • 提交

answer

#include "game.h"

#include <bits/stdc++.h>

using namespace std;

const int N = 30010;

vector<int> g1[N], g2[N];
int mn[N], mx[N], used[N], timer = 0;

int n, k;

void init(int this_n, int this_k) {
    n = this_n, k = this_k;
    for (int i = 0; i < n; i++) mn[i] = (int) 1e9, mx[i] = -(int) 1e9;
    for (int i = 0; i < k; i++) mn[i] = i, mx[i] = k - 1;
    for (int i = 0; i < k - 1; i++) g2[i].emplace_back(i + 1);
    for (int i = 0; i < k - 1; i++) g1[i + 1].emplace_back(i);
}

int start;

void update_min(int v, int cur_mn = (int) 1e9) {
    if (used[v] == timer || (v != start && v >= k && cur_mn >= mn[v])) return;
    cur_mn = min(cur_mn, mn[v]);
    used[v] = timer;
    mn[v] = cur_mn;
    for (auto u: g1[v])
        update_min(u, cur_mn);
}

void update_max(int v, int cur_mx = -(int) 1e9) {
    if (used[v] == timer || (v != start && v >= k && cur_mx <= mx[v])) return;
    cur_mx = max(cur_mx, mx[v]);
    used[v] = timer;
    mx[v] = cur_mx;
    for (auto u: g2[v])
        update_max(u, cur_mx);
}

int add_teleporter(int u, int v) {
    if (u == v && u < k) return 1;
    if (mn[v] <= mx[u]) return 1;
    g1[v].emplace_back(u);
    g2[u].emplace_back(v);
    ++timer;
    start = v;
    update_min(v, mn[v]);
    ++timer;
    start = u;
    update_max(u, mx[u]);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 2
Accepted
time: 1ms
memory: 3824kb

input:

1 1
1
893123 893123
-1

output:

0

result:

ok interaction finished.

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 3956kb

input:

9 9
29
893122 893124
893121 893127
893120 893124
893123 893121
893122 893131
893125 893131
893121 893126
893123 893126
893126 893131
893123 893131
893123 893125
893123 893124
893127 893125
893120 893126
893123 893120
893121 893131
893123 893127
893122 893126
893122 893127
893127 893131
893122 893125...

output:

0

result:

wrong answer Wrong Answer [1]

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%